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