litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
package com.temp.client.foundation.widget.input;
import com.google.gwt.user.client.ui.HasName;
import com.google.gwt.user.client.ui.Widget;
import com.temp.client.foundation.widget.input.fieldsupport.FocusChangedListener;
import com.temp.client.foundation.widget.input.fieldsupport.InputWidgetChangeFilter;
import com.temp.client.foundation.widget.input.fieldsupport.InputWidgetValidator;
import com.temp.client.foundation.widget.input.support.FormEngineMember;
import com.temp.shared.externalization.E13nData;
import com.temp.shared.utils.Visible;
/**
* An interface for an Input Field.
* <p/>
* Implementation should be able to be used directly or as a widget in a UI Binding file.
* <p/>
* It operates in two distinct states:
* <p/>
* <li>Builder Mode - Where properties of the final widget are specified (and parts of the widget are NOT accessable)</li>
* <li>Run Mode - Where the parts of the Widget are accessable (and the specification properties are NOT changeable)</li>
* <p/>
* The transition between the states is one way ('Builder' to 'Run') and is a result of the call to 'init'.
* <p/>
* An Input Field has the following:
* <p/>
* <ul>
* <li>Name</li>
* <li>Base Value **,</li>
* <li>Current Value **,</li>
* <li>Changed State,</li>
* <li>Errored State,</li>
* <li>Enabled State,</li>
* <li>Visibility State, and</li>
* <li>Following Widgets:</li>
* <ol>
* <li>InputWidget</li>
* <li>LabelLabel</li>
* <li>ExtendedLabel</li>
* <li>ExampleLabel</li>
* <li>ErrorLabel</li>
* <li>HelpWidget</li>
* </ol>
* </ul>
* <p/>
* ** - These values are "normalized" in both directions (to & from the underlying Input Widget(s)).
* This means that a value set and then fetched may be different (however a value fetched, then set,
* then fetched should match the original value fetched)! For String based input fields the normalization
* is that leading and trailing whitespace is ignored and empty strings and nulls are substituted based
* on direction ("" -> null when fetching from the underlying input widget, and null -> "" when setting
* into the underlying input widget). For non-String based input fields the normalization could appear
* a bit strange, for example: CheckBox input fields will interpret null as false.
*
* @param <T> the data type returned by this InputField
*/
public interface InputField<T> extends FormEngineMember, HasName, Visible {
interface ChangeListener<T2> {
void changed(InputField<T2> field);
}
// Callable anytime:
InputField<T> add(FocusChangedListener focusChangedListener);
boolean remove(FocusChangedListener focusChangedListener);
void removeAllFocusChangeListeners();
InputField<T> add(ChangeListener<T> changeListener);
boolean remove(ChangeListener<T> changeListener);
void removeAllChangeListeners();
// For Enableable
InputField<T> enable();
InputField<T> disable();
// For Visible
InputField<T> visible();
InputField<T> cloak();
InputField<T> invisible();
// Only callable in Run Mode:
/**
* Return Current Error Data (or null if not in Error)
*/
E13nData getErrorData();
/**
* set the Current value and the "Base" value (the "Base" value is what "change" is determined from).
* <p/>
* Note: The value is "normalized" before giving it to the actual Input Widget
*
* @param value null OK
* @return "normalized" round-tripped value (null possible) as if <code>getCurrentValue()</code> was called.
*/
T setCurrentValue(T value);
/**
* Returned the "normalized" Current value.
*
* @return null possible
*/
T getCurrentValue();
/**
* Returned the "normalized" Base value.
*
* @return null possible
*/
T getBaseValue();
}
|