@@ -36,53 +36,59 @@ if(!com.googlecode){
3636 throw new Error ( "com.googlecode exists but is not of type object" ) ;
3737}
3838
39- if ( com . googlecode . jsfFlex ) {
40- throw new Error ( "com.googlecode.jsfFlex namespace already exists" ) ;
39+ if ( ! com . googlecode . jsfFlex ) {
40+ com . googlecode . jsfFlex = { } ;
41+ } else if ( typeof com . googlecode . jsfFlex != "object" ) {
42+ throw new Error ( "com.googlecode.jsfFlex exists but is not of type object" ) ;
4143}
4244
43- com . googlecode . jsfFlex = {
45+ if ( ! com . googlecode . jsfFlex . communication ) {
46+ com . googlecode . jsfFlex . communication = { } ;
47+ } else if ( typeof com . googlecode . jsfFlex . communication != "object" ) {
48+ throw new Error ( "com.googlecode.jsfFlex.communication exists but is not of type object" ) ;
49+ }
50+
51+ if ( ! com . googlecode . jsfFlex . communication . core ) {
52+ com . googlecode . jsfFlex . communication . core = { } ;
53+ } else if ( typeof com . googlecode . jsfFlex . communication . core != "object" ) {
54+ throw new Error ( "com.googlecode.jsfFlex.communication.core exists but is not of type object" ) ;
55+ }
56+
57+ com . googlecode . jsfFlex . communication . core = {
58+ data : {
59+ flashAppsKeyNamingContainer : new dojox . collections . Dictionary ( ) ,
60+ flashAppsKeyAppId : new dojox . collections . Dictionary ( )
61+ } ,
62+
4463 addFlashApp : function ( _flashApp ) {
45- var _namingContainerPrefixList = com . googlecode . jsfFlex . flashAppsKeyNamingContainer . item ( _flashApp . namingContainerPrefix ) ;
64+ var _namingContainerPrefixList = com . googlecode . jsfFlex . communication . core . data . flashAppsKeyNamingContainer . item ( _flashApp . namingContainerPrefix ) ;
4665 if ( _namingContainerPrefixList == null ) {
4766 _namingContainerPrefixList = new Array ( ) ;
48- com . googlecode . jsfFlex . flashAppsKeyNamingContainer . add ( _flashApp . namingContainerPrefix , _namingContainerPrefixList ) ;
67+ com . googlecode . jsfFlex . communication . core . data . flashAppsKeyNamingContainer . add ( _flashApp . namingContainerPrefix , _namingContainerPrefixList ) ;
4968 }
50- com . googlecode . jsfFlex . flashAppsKeyAppId . add ( _flashApp . appId , _flashApp ) ;
69+ com . googlecode . jsfFlex . communication . core . data . flashAppsKeyAppId . add ( _flashApp . appId , _flashApp ) ;
5170 _namingContainerPrefixList . push ( _flashApp ) ;
5271 } ,
53- flashAppsKeyNamingContainer : new dojox . collections . Dictionary ( ) ,
54- flashAppsKeyAppId : new dojox . collections . Dictionary ( ) ,
55-
5672 getApplication : function ( _appId ) {
5773 if ( navigator . appName . indexOf ( "Microsoft" ) != - 1 ) {
5874 return document . getElementById ( _appId ) ;
5975 } else {
6076 return document [ _appId ] ;
6177 }
62- }
63- } ;
64-
65- if ( com . googlecode . jsfFlex . communication ) {
66- throw new Error ( "com.googlecode.jsfFlex.communication namespace already exists" ) ;
67- }
68-
69- com . googlecode . jsfFlex . communication = {
70-
78+ } ,
7179 getCompValue : function ( _appId , _objectId ) {
72- var _access = com . googlecode . jsfFlex . getApplication ( _appId ) ;
80+ var _access = com . googlecode . jsfFlex . communication . core . getApplication ( _appId ) ;
7381 if ( _access == null ) {
7482 throw new Error ( "appId [" + _appId + "] returned a null value during lookup" ) ;
7583 }
7684 var _value ;
77-
7885 try {
7986 _value = _access . getCompValue ( _objectId ) ;
8087 } catch ( error ) {
8188 throw new Error ( "Error while invoking getCompValue for appId, objectId [" + _appId + ", " + _objectId + "]" ) ;
8289 }
8390 return _value ;
8491 }
85-
8692} ;
8793
8894//private namespace
@@ -93,29 +99,27 @@ com.googlecode.jsfFlex.communication = {
9399 var currUnloaded = 0 ;
94100
95101 function amReady ( _readyAmI ) {
96- var _flashApp = com . googlecode . jsfFlex . flashAppsKeyAppId . item ( _readyAmI ) ;
102+ var _flashApp = com . googlecode . jsfFlex . communication . core . data . flashAppsKeyAppId . item ( _readyAmI ) ;
97103 if ( _flashApp ) {
98104 if ( _flashApp . arrayOfIds ) {
99105 return _flashApp ;
100106 }
101107 } else {
102- /* Must not have been added yet, so simply connect a function to com.googlecode.jsfFlex.addFlashApp */
103- var _handle = dojo . connect ( com . googlecode . jsfFlex , "addFlashApp" , function ( ) {
104- var _flashApp = com . googlecode . jsfFlex . flashAppsKeyAppId . item ( _readyAmI ) ;
108+ /* Must not have been added yet, so simply connect a function to com.googlecode.jsfFlex.communication.core. addFlashApp */
109+ var _handle = dojo . connect ( com . googlecode . jsfFlexcommunication . core , "addFlashApp" , function ( ) {
110+ var _flashApp = com . googlecode . jsfFlex . communication . core . data . flashAppsKeyAppId . item ( _readyAmI ) ;
105111 if ( _flashApp ) {
106112 if ( _flashApp . arrayOfIds ) {
107- var _access = com . googlecode . jsfFlex . getApplication ( _readyAmI ) ;
113+ var _access = com . googlecode . jsfFlex . communication . core . getApplication ( _readyAmI ) ;
108114 _access . populateInitValues ( _flashApp ) ;
109115 }
110116 dojo . disconnect ( _handle ) ;
111117 }
112- } ) ;
113-
118+ } ) ;
114119 }
115120 }
116121
117122 function appendElement ( _jsonNodes ) {
118-
119123 var _htmlType ;
120124 var _attributeArray ;
121125 var _ele ;
@@ -133,7 +137,6 @@ com.googlecode.jsfFlex.communication = {
133137 formSubmit . appendChild ( _ele ) ;
134138 }
135139 }
136-
137140 }
138141
139142 function checkUnLoadStatus ( ) {
@@ -151,21 +154,6 @@ com.googlecode.jsfFlex.communication = {
151154 return ( _event . target ) ? _event . target : _event . srcElement ;
152155 }
153156
154- function logFlashMessage ( _logMessage , _severity ) {
155- /*
156- * For simplicity, currently is supported for FireFox:FireBug only
157- * TODO: Consider supporting other browsers in the future
158- */
159- switch ( _severity ) {
160- case 1 : if ( console ) console . log ( _logMessage ) ; return ;
161- case 2 : if ( console ) console . debug ( _logMessage ) ; return ;
162- case 3 : if ( console ) console . info ( _logMessage ) ; return ;
163- case 4 : if ( console ) console . warn ( _logMessage ) ; return ;
164- case 5 : if ( console ) console . error ( _logMessage ) ; return ;
165- }
166-
167- }
168-
169157 function pageLoad ( ) {
170158 for ( var i = 0 ; i < document . forms . length ; i ++ ) {
171159 dojo . connect ( document . forms [ i ] , "onsubmit" , pageUnload ) ;
@@ -189,7 +177,7 @@ com.googlecode.jsfFlex.communication = {
189177 var _src = getSrcElement ( getEvent ( _event ) ) ;
190178 formSubmit = dojo . byId ( _src . id ) ;
191179
192- var _namingContainerPrefixList = com . googlecode . jsfFlex . flashAppsKeyNamingContainer . item ( _src . id ) ;
180+ var _namingContainerPrefixList = com . googlecode . jsfFlex . communication . core . data . flashAppsKeyNamingContainer . item ( _src . id ) ;
193181 flashAppsToUpdateCount = _namingContainerPrefixList . length ;
194182 var _access ;
195183 for ( var i = 0 ; i < _namingContainerPrefixList . length ; i ++ ) {
@@ -198,7 +186,7 @@ com.googlecode.jsfFlex.communication = {
198186 currUnloaded ++ ;
199187 continue ;
200188 }
201- _access = com . googlecode . jsfFlex . getApplication ( _namingContainerPrefixList [ i ] . appId ) ;
189+ _access = com . googlecode . jsfFlex . communication . core . getApplication ( _namingContainerPrefixList [ i ] . appId ) ;
202190 try {
203191 _access . pageUnloading ( _namingContainerPrefixList [ i ] ) ;
204192 } catch ( error ) {
@@ -228,9 +216,8 @@ com.googlecode.jsfFlex.communication = {
228216 }
229217
230218 //callers
231- com . googlecode . jsfFlex . communication . amReady = amReady ;
232- com . googlecode . jsfFlex . communication . logFlashMessage = logFlashMessage ;
233- com . googlecode . jsfFlex . communication . pageLoad = pageLoad ;
234- com . googlecode . jsfFlex . communication . updateValues = updateValues ;
219+ com . googlecode . jsfFlex . communication . core . amReady = amReady ;
220+ com . googlecode . jsfFlex . communication . core . pageLoad = pageLoad ;
221+ com . googlecode . jsfFlex . communication . core . updateValues = updateValues ;
235222
236- } ) ( ) ;
223+ } ) ( ) ;
0 commit comments