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 package com.ivata.mask.field;
69 import java.util.List;
70 import java.util.Properties;
71 import com.ivata.mask.Mask;
72 /***
73 * Defines a single field within a mask or group of masks.
74 *
75 * @since ivata masks 0.1 (2004-02-26)
76 * @author Colin MacLeod
77 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
78 */
79 public interface Field {
80 /***
81 * Indicates the fields contents should be formatted as an amount.
82 */
83 String TYPE_AMOUNT = "amount";
84 /***
85 * Indicates the fields contents should be formatted as a date.
86 */
87 String TYPE_DATE = "date";
88 /***
89 * Indicates the fields contents should be formatted as a number.
90 */
91 String TYPE_NUMBER = "number";
92 /***
93 * Indicates the field is an option to be displayed as a radio button.
94 */
95 String TYPE_RADIO = "radio";
96 /***
97 * Indicates the field is displayed as a choice combo box.
98 */
99 String TYPE_SELECT = "select";
100 /***
101 * Indicates the field is displayed as a short text.
102 */
103 String TYPE_STRING = "string";
104 /***
105 * Indicates the field is displayed as a long text.
106 */
107 String TYPE_TEXTAREA = "textarea";
108 /***
109 * If this field represents a combo (select) type, returns the choices as a
110 * <code>Properties</code> instance.
111 *
112 * @return <code>Properties</code> instance representing the possible
113 * values.
114 */
115 Properties getChoiceProperties();
116 /***
117 * If this field represents a combo (select) type, returns the choice keys
118 * as a <code>List</code> of <code>String</code> instances.
119 *
120 * @return <code>List</code> of <code>String</code> instances
121 * representing the key values of all choice options.
122 */
123 List getChoicePropertyKeys();
124 /***
125 * Get the default value for this field. If no default has been defined for
126 * this field, is <code>null</code>.
127 *
128 * @return default value for this field, or <code>null</code> if none is
129 * defined.
130 */
131 String getDefaultValue();
132 /***
133 * Get the data object class for this field, if appropriate.
134 *
135 * @return data object class if this field links to a data object, otherwise
136 * <code>null</code>.
137 */
138 Class getDOClass();
139 /***
140 * Id of just this field.
141 *
142 * @return Id of just this field.
143 */
144 String getName();
145 /***
146 * <p>
147 * Get the field which contains this one.
148 * </p>
149 *
150 * @return Field which contains this field, or <code>null</code> if this
151 * is a top-level field.
152 */
153 Field getParent();
154 /***
155 * <p>
156 * Return the full path to this field, including the names of parent fields
157 * separated by '.' characters. </p >
158 *
159 * @return Full path to this field, to uniquely identify it within the
160 * system.
161 */
162 String getPath();
163 /***
164 * Indicates what sort of data this field should hold.
165 *
166 * @return type of the field, from one of the <code>TYPE_</code> values in
167 * this interface.
168 */
169 String getType();
170 /***
171 * <p>
172 * If this field represents a value object, get the mask associated with
173 * this value object. <b>Note: </b> this is not the mask the field is in!.
174 * </p>
175 *
176 * @return Mask associated with this value object or <code>null</code> if
177 * this field is not a value object.
178 */
179 Mask getValueObjectMask();
180 /***
181 * Get whether or not this field can be amended. Useful for automatically
182 * generated fields such as timestamps.
183 * @return <code>true</code> if the field <u>cannot</u> be manually changed.
184 */
185 boolean isDisplayOnly();
186 /***
187 * <p>
188 * Is this field hidden or displayed?
189 * </p>
190 *
191 * @return <code>true</code> if this field is hidden.
192 */
193 boolean isHidden();
194 /***
195 * <p>
196 * Is this field required or optional?
197 * </p>
198 *
199 * @return <code>true</code> if this field is required and must have a
200 * non- <code>null</code>, non-empty value. Otherwise,
201 * <code>false</code> for an optional field.
202 */
203 boolean isMandatory();
204 /***
205 * If this field represents another value object, but the relationship with
206 * its container is one-to-one, then it can be included in the parent's
207 * mask directly.
208 *
209 * @return <code>true</code> if this field should be displayed directly
210 * in the mask of the parent field.
211 */
212 boolean isOneToOne();
213 }