Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/InputField.java

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