1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.control;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21 import org.kuali.rice.krad.uif.field.InputField;
22 import org.kuali.rice.krad.uif.view.View;
23 import org.kuali.rice.krad.uif.component.Component;
24 import org.kuali.rice.krad.uif.widget.DatePicker;
25
26 import java.util.List;
27
28
29
30
31
32
33
34 @BeanTag(name="textControl")
35 public class TextControl extends ControlBase implements SizedControl {
36 private static final long serialVersionUID = -8267606288443759880L;
37
38 private int size;
39 private Integer maxLength;
40 private Integer minLength;
41
42 private DatePicker datePicker;
43 private String watermarkText = StringUtils.EMPTY;
44 private boolean textExpand;
45
46 public TextControl() {
47 super();
48 }
49
50
51
52
53 @Override
54 public List<Component> getComponentsForLifecycle() {
55 List<Component> components = super.getComponentsForLifecycle();
56
57 components.add(datePicker);
58
59 return components;
60 }
61
62
63
64
65
66
67
68
69
70
71
72 @Override
73 public void performFinalize(View view, Object model, Component parent) {
74 super.performFinalize(view, model, parent);
75
76 if (parent instanceof InputField) {
77 InputField field = (InputField) parent;
78 if (getMaxLength() == null) {
79 setMaxLength(field.getMaxLength());
80 }
81
82 if (getMinLength() == null) {
83 setMinLength(field.getMinLength());
84 }
85 }
86 }
87
88
89
90
91 @BeanTagAttribute(name="size")
92 public int getSize() {
93 return this.size;
94 }
95
96
97
98
99 public void setSize(int size) {
100 this.size = size;
101 }
102
103
104
105
106
107
108
109
110 @BeanTagAttribute(name="maxLength")
111 public Integer getMaxLength() {
112 return maxLength;
113 }
114
115
116
117
118
119
120 public void setMaxLength(Integer maxLength) {
121 this.maxLength = maxLength;
122 }
123
124
125
126
127
128
129
130
131 @BeanTagAttribute(name="minLength")
132 public Integer getMinLength() {
133 return minLength;
134 }
135
136
137
138
139
140
141 public void setMinLength(Integer minLength) {
142 this.minLength = minLength;
143 }
144
145
146
147
148
149
150
151
152 @BeanTagAttribute(name="datePicker",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
153 public DatePicker getDatePicker() {
154 return this.datePicker;
155 }
156
157
158
159
160
161
162 public void setDatePicker(DatePicker datePicker) {
163 this.datePicker = datePicker;
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177 @BeanTagAttribute(name="watermarkText")
178 public String getWatermarkText() {
179 return this.watermarkText;
180 }
181
182
183
184
185
186
187 public void setWatermarkText(String watermarkText) {
188
189
190 if (StringUtils.isNotEmpty(watermarkText)) {
191 watermarkText = watermarkText + " ";
192 }
193 this.watermarkText = watermarkText;
194 }
195
196
197
198
199
200
201
202 @BeanTagAttribute(name="textExpand")
203 public boolean isTextExpand() {
204 return this.textExpand;
205 }
206
207
208
209
210
211
212 public void setTextExpand(boolean textExpand) {
213 this.textExpand = textExpand;
214 }
215
216
217 }