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