litesoft
Diff Revisions
634
vs
635
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/FormEngine.java
|
@@ -4,6 +4,7 @@ |
4 |
4 |
|
|
5 |
5 |
|
import com.google.gwt.event.dom.client.*; |
6 |
6 |
|
import com.google.gwt.user.client.ui.*; |
|
7 |
+ |
import com.temp.client.foundation.util.HasEnabledSetManager; |
7 |
8 |
|
import com.temp.client.foundation.widget.*; |
8 |
9 |
|
import com.temp.client.foundation.widget.input.support.*; |
9 |
10 |
|
import com.temp.shared.*; |
|
@@ -49,6 +50,8 @@ |
49 |
50 |
|
private Callback submitCallback = null; |
50 |
51 |
|
private final List<FormEngine> subForms = new ArrayList<FormEngine>(); |
51 |
52 |
|
|
|
53 |
+ |
private HasEnabledSetManager serverInteractionHelper; |
|
54 |
+ |
|
52 |
55 |
|
private boolean enabled = true; |
53 |
56 |
|
private E13nResolver resolver = null; |
54 |
57 |
|
|
|
@@ -111,17 +114,25 @@ |
111 |
114 |
|
|
112 |
115 |
|
resolver = new OptionallyPrefixingE13nResolver( name, parentResolver ); // add our name to keys! |
113 |
116 |
|
|
|
117 |
+ |
List<HasEnabled> simpleChildren = new ArrayList<HasEnabled>(); |
|
118 |
+ |
|
114 |
119 |
|
for ( FormEngineMember member : members ) |
115 |
120 |
|
{ |
116 |
121 |
|
member.init( resolver ); |
|
122 |
+ |
if ( member instanceof InputField ) |
|
123 |
+ |
{ |
|
124 |
+ |
simpleChildren.add( member ); |
|
125 |
+ |
} |
117 |
126 |
|
} |
118 |
127 |
|
for ( ButtonBase button : managedButtons ) |
119 |
128 |
|
{ |
120 |
129 |
|
buttonInit( button ); |
|
130 |
+ |
simpleChildren.add( button ); |
121 |
131 |
|
} |
122 |
132 |
|
if ( submitButton != null ) |
123 |
133 |
|
{ |
124 |
134 |
|
buttonInit( submitButton ); |
|
135 |
+ |
simpleChildren.add(submitButton); |
125 |
136 |
|
submitButton.addClickHandler( new ClickHandler() |
126 |
137 |
|
{ |
127 |
138 |
|
@Override |
|
@@ -137,6 +148,8 @@ |
137 |
148 |
|
} |
138 |
149 |
|
} ); |
139 |
150 |
|
} |
|
151 |
+ |
|
|
152 |
+ |
serverInteractionHelper = new HasEnabledSetManager( simpleChildren.toArray( new HasEnabled[simpleChildren.size()] ) ); |
140 |
153 |
|
} |
141 |
154 |
|
|
142 |
155 |
|
// Callable anytime: |
|
@@ -316,6 +329,10 @@ |
316 |
329 |
|
{ |
317 |
330 |
|
member.addNamedWidgetsTo( nameToID ); |
318 |
331 |
|
} |
|
332 |
+ |
nameToID.tryAdd(submitButton); |
|
333 |
+ |
for (ButtonBase button : managedButtons) { |
|
334 |
+ |
nameToID.tryAdd(button); |
|
335 |
+ |
} |
319 |
336 |
|
return nameToID; |
320 |
337 |
|
} |
321 |
338 |
|
|
|
@@ -323,14 +340,20 @@ |
323 |
340 |
|
public void busyInteractingWithServer() |
324 |
341 |
|
{ |
325 |
342 |
|
checkRunMode( "busyInteractingWithServer" ); |
326 |
|
- |
System.out.println( "FormEngine.busyInteractingWithServer" ); |
|
343 |
+ |
serverInteractionHelper.snagStateAndDisable(); |
|
344 |
+ |
for (FormEngine subForm : subForms) { |
|
345 |
+ |
subForm.busyInteractingWithServer(); |
|
346 |
+ |
} |
327 |
347 |
|
} |
328 |
348 |
|
|
329 |
349 |
|
@Override |
330 |
350 |
|
public void doneInteractingWithServer() |
331 |
351 |
|
{ |
332 |
352 |
|
checkRunMode( "doneInteractingWithServer" ); |
333 |
|
- |
System.out.println( "FormEngine.doneInteractingWithServer" ); |
|
353 |
+ |
serverInteractionHelper.restoreState(); |
|
354 |
+ |
for (FormEngine subForm : subForms) { |
|
355 |
+ |
subForm.doneInteractingWithServer(); |
|
356 |
+ |
} |
334 |
357 |
|
} |
335 |
358 |
|
|
336 |
359 |
|
protected final void assertBuildMode( String method ) |