|
@@ -1,9 +1,11 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt |
2 |
2 |
|
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
3 |
|
|
|
4 |
+ |
import java.io.*; |
|
5 |
+ |
|
4 |
6 |
|
import org.litesoft.GWT.forms.client.components.*; |
|
7 |
+ |
import org.litesoft.GWT.client.*; |
5 |
8 |
|
import org.litesoft.core.util.*; |
6 |
|
- |
import org.litesoft.rpcpassable.*; |
7 |
9 |
|
import org.litesoft.ui.def.nonpublic.support.*; |
8 |
10 |
|
|
9 |
11 |
|
import com.google.gwt.user.client.ui.*; |
|
@@ -39,7 +41,7 @@ |
39 |
41 |
|
mComponentFormHandler.addAttributeAdapter( this ); |
40 |
42 |
|
Widget widget = initWidget(); |
41 |
43 |
|
Object zComponentCurrentValue = getComponentCurrentValue(); |
42 |
|
- |
RPCpassable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
|
44 |
+ |
Serializable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
43 |
45 |
|
LLsetErrorText( null, zSendableCurrentValue, zComponentCurrentValue ); |
44 |
46 |
|
return widget; |
45 |
47 |
|
} |
|
@@ -84,7 +86,7 @@ |
84 |
86 |
|
public void setErrorText( String pErrorText ) |
85 |
87 |
|
{ |
86 |
88 |
|
Object zComponentCurrentValue = getComponentCurrentValue(); |
87 |
|
- |
RPCpassable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
|
89 |
+ |
Serializable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
88 |
90 |
|
setErrorTextAndPublish( pErrorText, zSendableCurrentValue, zComponentCurrentValue ); |
89 |
91 |
|
} |
90 |
92 |
|
|
|
@@ -93,24 +95,24 @@ |
93 |
95 |
|
return !areEqual( mBaseComponentValue, getComponentCurrentValue() ); |
94 |
96 |
|
} |
95 |
97 |
|
|
96 |
|
- |
public RPCpassable getBaseValue() |
|
98 |
+ |
public Serializable getBaseValue() |
97 |
99 |
|
{ |
98 |
100 |
|
return convertComponentValueToSendable( mBaseComponentValue ); |
99 |
101 |
|
} |
100 |
102 |
|
|
101 |
|
- |
public void setBaseValue( RPCpassable pBaseValue ) |
|
103 |
+ |
public void setBaseValue( Serializable pBaseValue ) |
102 |
104 |
|
{ |
103 |
105 |
|
mBaseComponentValue = convertSendableToComponentValue( pBaseValue ); |
104 |
106 |
|
setComponentCurrentValue( mPublishedComponentValue = mBaseComponentValue ); |
105 |
107 |
|
chkChangeOccurred( pBaseValue, mBaseComponentValue ); |
106 |
108 |
|
} |
107 |
109 |
|
|
108 |
|
- |
public RPCpassable getCurrentValue() |
|
110 |
+ |
public Serializable getCurrentValue() |
109 |
111 |
|
{ |
110 |
112 |
|
return convertComponentValueToSendable( getComponentCurrentValue() ); |
111 |
113 |
|
} |
112 |
114 |
|
|
113 |
|
- |
public void setCurrentValue( RPCpassable pCurrentValue ) |
|
115 |
+ |
public void setCurrentValue( Serializable pCurrentValue ) |
114 |
116 |
|
{ |
115 |
117 |
|
Object zComponentCurrentValue = convertSendableToComponentValue( pCurrentValue ); |
116 |
118 |
|
setComponentCurrentValue( zComponentCurrentValue ); |
|
@@ -128,7 +130,7 @@ |
128 |
130 |
|
|
129 |
131 |
|
// handle change |
130 |
132 |
|
Object zComponentCurrentValue = getComponentCurrentValue(); |
131 |
|
- |
RPCpassable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
|
133 |
+ |
Serializable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
132 |
134 |
|
chkChangeOccurred( zSendableCurrentValue, zComponentCurrentValue ); |
133 |
135 |
|
|
134 |
136 |
|
// handle update |
|
@@ -149,7 +151,7 @@ |
149 |
151 |
|
mComponent.publishAnyPendingChanges(); |
150 |
152 |
|
} |
151 |
153 |
|
|
152 |
|
- |
public void updateValidOptions( RPCpassable[] pValidOptions ) |
|
154 |
+ |
public void updateValidOptions( Serializable[] pValidOptions ) |
153 |
155 |
|
{ |
154 |
156 |
|
// Do nothing as most components do NOT support valid Options |
155 |
157 |
|
} |
|
@@ -182,7 +184,7 @@ |
182 |
184 |
|
{ |
183 |
185 |
|
Object zComponentCurrentValue = getComponentCurrentValue(); |
184 |
186 |
|
// System.out.println( "changeOccurred: " + this + " | " + zComponentCurrentValue ); |
185 |
|
- |
RPCpassable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
|
187 |
+ |
Serializable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
186 |
188 |
|
chkChangeOccurred( zSendableCurrentValue, zComponentCurrentValue ); |
187 |
189 |
|
} |
188 |
190 |
|
|
|
@@ -211,7 +213,7 @@ |
211 |
213 |
|
mComponent.setCurrentValue( pNewComponentCurrentValue ); |
212 |
214 |
|
} |
213 |
215 |
|
|
214 |
|
- |
protected void setErrorTextAndPublish( String pErrorText, RPCpassable pSendableCurrentValue, |
|
216 |
+ |
protected void setErrorTextAndPublish( String pErrorText, Serializable pSendableCurrentValue, |
215 |
217 |
|
Object pComponentCurrentValue ) |
216 |
218 |
|
{ |
217 |
219 |
|
LLsetErrorText( pErrorText, pSendableCurrentValue, pComponentCurrentValue ); |
|
@@ -219,7 +221,7 @@ |
219 |
221 |
|
publishErrorState( isErrorState() ); |
220 |
222 |
|
} |
221 |
223 |
|
|
222 |
|
- |
protected void LLsetErrorText( String pErrorText, RPCpassable pSendableCurrentValue, |
|
224 |
+ |
protected void LLsetErrorText( String pErrorText, Serializable pSendableCurrentValue, |
223 |
225 |
|
Object pComponentCurrentValue ) |
224 |
226 |
|
{ |
225 |
227 |
|
mComponent.setError( mErrorText = transformErrorText( pErrorText, // |
|
@@ -227,7 +229,7 @@ |
227 |
229 |
|
pComponentCurrentValue ) ); |
228 |
230 |
|
} |
229 |
231 |
|
|
230 |
|
- |
protected String transformErrorText( String pErrorText, RPCpassable pSendableCurrentValue, |
|
232 |
+ |
protected String transformErrorText( String pErrorText, Serializable pSendableCurrentValue, |
231 |
233 |
|
Object pComponentCurrentValue ) |
232 |
234 |
|
{ |
233 |
235 |
|
pErrorText = UtilsCommon.noEmpty( pErrorText ); |
|
@@ -238,7 +240,7 @@ |
238 |
240 |
|
return pErrorText; |
239 |
241 |
|
} |
240 |
242 |
|
|
241 |
|
- |
protected void chkChangeOccurred( RPCpassable pSendableCurrentValue, Object pComponentCurrentValue ) |
|
243 |
+ |
protected void chkChangeOccurred( Serializable pSendableCurrentValue, Object pComponentCurrentValue ) |
242 |
244 |
|
{ |
243 |
245 |
|
boolean changedFromBaseCV = !areEqual( mBaseComponentValue, pComponentCurrentValue ); |
244 |
246 |
|
boolean changedFromErrorCV = !areEqual( mErrorComponentValue, pComponentCurrentValue ); |
|
@@ -253,7 +255,7 @@ |
253 |
255 |
|
protected void optionallyPublishUpdatedValue() |
254 |
256 |
|
{ |
255 |
257 |
|
Object zComponentCurrentValue = getComponentCurrentValue(); |
256 |
|
- |
RPCpassable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
|
258 |
+ |
Serializable zSendableCurrentValue = convertComponentValueToSendable( zComponentCurrentValue ); |
257 |
259 |
|
if ( !areEqual( mPublishedComponentValue, zComponentCurrentValue ) ) |
258 |
260 |
|
{ |
259 |
261 |
|
mPublishedComponentValue = zComponentCurrentValue; |
|
@@ -271,19 +273,19 @@ |
271 |
273 |
|
mComponentFormHandler.componentChangedState( pChangedState ); |
272 |
274 |
|
} |
273 |
275 |
|
|
274 |
|
- |
protected void publishUpdatedValue( RPCpassable pCurrentValue ) |
|
276 |
+ |
protected void publishUpdatedValue( Serializable pCurrentValue ) |
275 |
277 |
|
{ |
276 |
278 |
|
mComponentFormHandler.componentUpdatedValue( this, pCurrentValue ); |
277 |
279 |
|
} |
278 |
280 |
|
|
279 |
|
- |
protected void resetErrorOnChangeOccurred( RPCpassable pSendableCurrentValue, |
|
281 |
+ |
protected void resetErrorOnChangeOccurred( Serializable pSendableCurrentValue, |
280 |
282 |
|
Object pComponentCurrentValue ) |
281 |
283 |
|
{ |
282 |
284 |
|
setErrorTextAndPublish( null, pSendableCurrentValue, |
283 |
285 |
|
pComponentCurrentValue ); // Turn off error - assume no error |
284 |
286 |
|
} |
285 |
287 |
|
|
286 |
|
- |
protected RPCpassable convertComponentValueToSendable( Object pValue ) |
|
288 |
+ |
protected Serializable convertComponentValueToSendable( Object pValue ) |
287 |
289 |
|
{ |
288 |
290 |
|
if ( (pValue == null) || (pValue instanceof FormTextInputErrorValue) ) |
289 |
291 |
|
{ |
|
@@ -292,12 +294,12 @@ |
292 |
294 |
|
return LLconvertNonNullComponentValueToSendable( pValue ); |
293 |
295 |
|
} |
294 |
296 |
|
|
295 |
|
- |
protected RPCpassable LLconvertNonNullComponentValueToSendable( Object pValue ) |
|
297 |
+ |
protected Serializable LLconvertNonNullComponentValueToSendable( Object pValue ) |
296 |
298 |
|
{ |
297 |
|
- |
return (RPCpassable) pValue; |
|
299 |
+ |
return (Serializable) pValue; |
298 |
300 |
|
} |
299 |
301 |
|
|
300 |
|
- |
abstract protected Object convertSendableToComponentValue( RPCpassable pValue ); |
|
302 |
+ |
abstract protected Object convertSendableToComponentValue( Serializable pValue ); |
301 |
303 |
|
|
302 |
304 |
|
abstract protected String convertComponentValueToString( Object pValue ); |
303 |
305 |
|
|
|
@@ -307,4 +309,9 @@ |
307 |
309 |
|
{ |
308 |
310 |
|
return "FormAttributeAdapter(" + getAttributeReference() + ")"; |
309 |
311 |
|
} |
|
312 |
+ |
|
|
313 |
+ |
@Override public void enterPressed( KeyboardKeyModifier pModifiers ) |
|
314 |
+ |
{ |
|
315 |
+ |
// todo: Implement! |
|
316 |
+ |
} |
310 |
317 |
|
} |