litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/util/HasEnabledSetManager.java
|
@@ -1,6 +1,6 @@ |
1 |
1 |
|
package com.temp.client.foundation.util; |
2 |
2 |
|
|
3 |
|
- |
import com.google.gwt.user.client.ui.HasEnabled; |
|
3 |
+ |
import com.google.gwt.user.client.ui.*; |
4 |
4 |
|
|
5 |
5 |
|
/** |
6 |
6 |
|
* The purpose of this class is to manage the "Enabled" State of a a bunch of |
|
@@ -9,7 +9,7 @@ |
9 |
9 |
|
* super class that has "setEnabled(boolean)"). It is planned to be used for |
10 |
10 |
|
* disabling a bunch of widgets when the data is being collected from the |
11 |
11 |
|
* Server. |
12 |
|
- |
* |
|
12 |
+ |
* <p/> |
13 |
13 |
|
* This class, when disable is requested, snags the current Enabled State of all |
14 |
14 |
|
* the Objects, and will then restore this state when enable is requested. |
15 |
15 |
|
* |
|
@@ -19,34 +19,34 @@ |
19 |
19 |
|
private final HasEnabled[] enableManageables; |
20 |
20 |
|
private boolean[] snaggedState; |
21 |
21 |
|
|
22 |
|
- |
public HasEnabledSetManager(HasEnabled... enableManageables) { |
|
22 |
+ |
public HasEnabledSetManager( HasEnabled... enableManageables ) { |
23 |
23 |
|
this.enableManageables = enableManageables; |
24 |
24 |
|
} |
25 |
25 |
|
|
26 |
26 |
|
public void snagStateAndDisable() { |
27 |
|
- |
snagStateAndSetState(false); |
|
27 |
+ |
snagStateAndSetState( false ); |
28 |
28 |
|
} |
29 |
29 |
|
|
30 |
30 |
|
public void snagStateAndEnable() { |
31 |
|
- |
snagStateAndSetState(true); |
|
31 |
+ |
snagStateAndSetState( true ); |
32 |
32 |
|
} |
33 |
33 |
|
|
34 |
34 |
|
public boolean restoreState() { |
35 |
|
- |
if (snaggedState == null) { |
|
35 |
+ |
if ( snaggedState == null ) { |
36 |
36 |
|
return false; |
37 |
37 |
|
} |
38 |
|
- |
for (int i = 0; i < enableManageables.length; i++) { |
39 |
|
- |
enableManageables[i].setEnabled(snaggedState[i]); |
|
38 |
+ |
for ( int i = 0; i < enableManageables.length; i++ ) { |
|
39 |
+ |
enableManageables[i].setEnabled( snaggedState[i] ); |
40 |
40 |
|
} |
41 |
41 |
|
return true; |
42 |
42 |
|
} |
43 |
43 |
|
|
44 |
|
- |
private void snagStateAndSetState(boolean enable) { |
|
44 |
+ |
private void snagStateAndSetState( boolean enable ) { |
45 |
45 |
|
snaggedState = new boolean[enableManageables.length]; |
46 |
|
- |
for (int i = 0; i < enableManageables.length; i++) { |
|
46 |
+ |
for ( int i = 0; i < enableManageables.length; i++ ) { |
47 |
47 |
|
HasEnabled enableManageable = enableManageables[i]; |
48 |
48 |
|
snaggedState[i] = enableManageable.isEnabled(); |
49 |
|
- |
enableManageable.setEnabled(enable); |
|
49 |
+ |
enableManageable.setEnabled( enable ); |
50 |
50 |
|
} |
51 |
51 |
|
} |
52 |
52 |
|
} |