|
@@ -1,47 +1,47 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.user.client.ui.*; |
7 |
|
- |
|
8 |
|
- |
public abstract class AbstractFormComponentAdapter |
9 |
|
- |
implements FormComponentAdapter { |
10 |
|
- |
protected FormInstanceComponentHandler mComponentFormHandler; |
11 |
|
- |
private boolean mDisabled = false; |
12 |
|
- |
private boolean mSavedEnabled = true; |
13 |
|
- |
|
14 |
|
- |
public AbstractFormComponentAdapter( FormInstanceComponentHandler pComponentHandler ) { |
15 |
|
- |
mComponentFormHandler = pComponentHandler; |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
abstract public Widget init(); |
19 |
|
- |
|
20 |
|
- |
/** |
21 |
|
- |
* Attempt to enable the widget, constraned by Disabled (from the ServicePeer) |
22 |
|
- |
*/ |
23 |
|
- |
public final void setEnabled( boolean pEnabled ) { |
24 |
|
- |
setWidgetEnabled( (mSavedEnabled = pEnabled) & !isDisabled() ); |
25 |
|
- |
} |
26 |
|
- |
|
27 |
|
- |
/** |
28 |
|
- |
* @return if the widget is Disabled (from the ServicePeer) |
29 |
|
- |
*/ |
30 |
|
- |
public final boolean isDisabled() { |
31 |
|
- |
return mDisabled; |
32 |
|
- |
} |
33 |
|
- |
|
34 |
|
- |
/** |
35 |
|
- |
* set the widget's Disabled state (from the ServicePeer) |
36 |
|
- |
*/ |
37 |
|
- |
public final void setDisabled( boolean pDisabled ) { |
38 |
|
- |
mDisabled = pDisabled; |
39 |
|
- |
setEnabled( mSavedEnabled ); |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
abstract protected void setWidgetEnabled( boolean pEnabled ); |
43 |
|
- |
|
44 |
|
- |
protected static boolean areEqual( Object pNonArray1, Object pNonArray2 ) { |
45 |
|
- |
return Objects.areNonArraysEqual( pNonArray1, pNonArray2 ); |
46 |
|
- |
} |
47 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.user.client.ui.*; |
|
7 |
+ |
|
|
8 |
+ |
public abstract class AbstractFormComponentAdapter |
|
9 |
+ |
implements FormComponentAdapter { |
|
10 |
+ |
protected FormInstanceComponentHandler mComponentFormHandler; |
|
11 |
+ |
private boolean mDisabled = false; |
|
12 |
+ |
private boolean mSavedEnabled = true; |
|
13 |
+ |
|
|
14 |
+ |
public AbstractFormComponentAdapter( FormInstanceComponentHandler pComponentHandler ) { |
|
15 |
+ |
mComponentFormHandler = pComponentHandler; |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
abstract public Widget init(); |
|
19 |
+ |
|
|
20 |
+ |
/** |
|
21 |
+ |
* Attempt to enable the widget, constraned by Disabled (from the ServicePeer) |
|
22 |
+ |
*/ |
|
23 |
+ |
public final void setEnabled( boolean pEnabled ) { |
|
24 |
+ |
setWidgetEnabled( (mSavedEnabled = pEnabled) & !isDisabled() ); |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
/** |
|
28 |
+ |
* @return if the widget is Disabled (from the ServicePeer) |
|
29 |
+ |
*/ |
|
30 |
+ |
public final boolean isDisabled() { |
|
31 |
+ |
return mDisabled; |
|
32 |
+ |
} |
|
33 |
+ |
|
|
34 |
+ |
/** |
|
35 |
+ |
* set the widget's Disabled state (from the ServicePeer) |
|
36 |
+ |
*/ |
|
37 |
+ |
public final void setDisabled( boolean pDisabled ) { |
|
38 |
+ |
mDisabled = pDisabled; |
|
39 |
+ |
setEnabled( mSavedEnabled ); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
abstract protected void setWidgetEnabled( boolean pEnabled ); |
|
43 |
+ |
|
|
44 |
+ |
protected static boolean areEqual( Object pNonArray1, Object pNonArray2 ) { |
|
45 |
+ |
return Currently.areEqual( pNonArray1, pNonArray2 ); |
|
46 |
+ |
} |
|
47 |
+ |
} |