|
@@ -1,18 +1,17 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget.input.fieldsupport; |
2 |
2 |
|
|
3 |
|
- |
import com.google.gwt.user.client.ui.*; |
4 |
|
- |
import com.temp.shared.utils.*; |
|
3 |
+ |
import com.google.gwt.user.client.ui.Focusable; |
|
4 |
+ |
import com.google.gwt.user.client.ui.HasEnabled; |
|
5 |
+ |
import com.google.gwt.user.client.ui.Widget; |
5 |
6 |
|
|
6 |
|
- |
public class InputFieldAccessor<T> implements Enableable |
7 |
|
- |
{ |
|
7 |
+ |
public class InputFieldAccessor<T> implements HasEnabled { |
8 |
8 |
|
protected final Widget inputWidget; |
9 |
9 |
|
protected final InputWidgetValueAdapter<T> valueAdapter; |
10 |
10 |
|
protected final InputWidgetValidator<T> validator; |
11 |
11 |
|
protected final InputWidgetChangeFilter<T> input; |
12 |
12 |
|
protected final Focusable[] focusables; |
13 |
13 |
|
|
14 |
|
- |
public InputFieldAccessor( InputWidgetChangeFilter<T> input, InputWidgetValidator<T> validator, InputWidgetValueAdapter<T> valueAdapter, Widget inputWidget, Focusable... focusables ) |
15 |
|
- |
{ |
|
14 |
+ |
public InputFieldAccessor(InputWidgetChangeFilter<T> input, InputWidgetValidator<T> validator, InputWidgetValueAdapter<T> valueAdapter, Widget inputWidget, Focusable... focusables) { |
16 |
15 |
|
this.input = input; |
17 |
16 |
|
this.validator = validator; |
18 |
17 |
|
this.valueAdapter = valueAdapter; |
|
@@ -21,44 +20,49 @@ |
21 |
20 |
|
} |
22 |
21 |
|
|
23 |
22 |
|
@Override |
24 |
|
- |
public boolean isEnabled() |
25 |
|
- |
{ |
|
23 |
+ |
public boolean isEnabled() { |
26 |
24 |
|
return getEnableable().isEnabled(); |
27 |
25 |
|
} |
28 |
26 |
|
|
29 |
27 |
|
@Override |
30 |
|
- |
public void setEnabled( boolean enabled ) |
31 |
|
- |
{ |
32 |
|
- |
getEnableable().setEnabled( enabled ); |
|
28 |
+ |
public void setEnabled(boolean enabled) { |
|
29 |
+ |
getEnableable().setEnabled(enabled); |
33 |
30 |
|
} |
34 |
31 |
|
|
35 |
|
- |
public Widget getInputWidget() |
36 |
|
- |
{ |
|
32 |
+ |
public Widget getInputWidget() { |
37 |
33 |
|
return inputWidget; |
38 |
34 |
|
} |
39 |
35 |
|
|
40 |
|
- |
public InputWidgetValueAdapter<T> getValueAdapter() |
41 |
|
- |
{ |
|
36 |
+ |
public InputWidgetValueAdapter<T> getValueAdapter() { |
42 |
37 |
|
return valueAdapter; |
43 |
38 |
|
} |
44 |
39 |
|
|
45 |
|
- |
public InputWidgetValidator<T> getValidator() |
46 |
|
- |
{ |
|
40 |
+ |
public InputWidgetValidator<T> getValidator() { |
47 |
41 |
|
return validator; |
48 |
42 |
|
} |
49 |
43 |
|
|
50 |
|
- |
public InputWidgetChangeFilter<T> getInput() |
51 |
|
- |
{ |
|
44 |
+ |
public InputWidgetChangeFilter<T> getInput() { |
52 |
45 |
|
return input; |
53 |
46 |
|
} |
54 |
47 |
|
|
55 |
|
- |
public Focusable[] getFocusables() |
56 |
|
- |
{ |
|
48 |
+ |
public Focusable[] getFocusables() { |
57 |
49 |
|
return focusables; |
58 |
50 |
|
} |
59 |
51 |
|
|
60 |
|
- |
private Enableable getEnableable() |
61 |
|
- |
{ |
62 |
|
- |
return (inputWidget instanceof Enableable) ? (Enableable)inputWidget : Enableable.ALWAYS_ENABLED; |
|
52 |
+ |
private HasEnabled getEnableable() { |
|
53 |
+ |
return (inputWidget instanceof HasEnabled) ? (HasEnabled) inputWidget : ALWAYS_ENABLED; |
63 |
54 |
|
} |
|
55 |
+ |
|
|
56 |
+ |
private static final HasEnabled ALWAYS_ENABLED = new HasEnabled() { |
|
57 |
+ |
@Override |
|
58 |
+ |
public boolean isEnabled() { |
|
59 |
+ |
return true; |
|
60 |
+ |
} |
|
61 |
+ |
|
|
62 |
+ |
@Override |
|
63 |
+ |
public void setEnabled(boolean enabled) { |
|
64 |
+ |
|
|
65 |
+ |
// Whatever |
|
66 |
+ |
} |
|
67 |
+ |
}; |
64 |
68 |
|
} |