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", parent = "Uif-TextControl"),
34 @BeanTag(name = "smallTextControl", parent = "Uif-SmallTextControl"),
35 @BeanTag(name = "mediumTextControl", parent = "Uif-MediumTextControl"),
36 @BeanTag(name = "largeTextControl", parent = "Uif-LargeTextControl"),
37 @BeanTag(name = "currencyTextControl", parent = "Uif-CurrencyTextControl"),
38 @BeanTag(name = "dateControl", 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 || (datePicker != null && datePicker.isRender())) {
78 field.setRenderInputAddonGroup(true);
79 }
80 }
81 }
82
83
84
85
86 @Override
87 @BeanTagAttribute
88 public int getSize() {
89 return this.size;
90 }
91
92
93
94
95 @Override
96 public void setSize(int size) {
97 this.size = size;
98 }
99
100
101
102
103 @Override
104 @BeanTagAttribute
105 public Integer getMaxLength() {
106 return maxLength;
107 }
108
109
110
111
112 @Override
113 public void setMaxLength(Integer maxLength) {
114 this.maxLength = maxLength;
115 }
116
117
118
119
120 @Override
121 @BeanTagAttribute
122 public Integer getMinLength() {
123 return minLength;
124 }
125
126
127
128
129 @Override
130 public void setMinLength(Integer minLength) {
131 this.minLength = minLength;
132 }
133
134
135
136
137 @Override
138 @BeanTagAttribute(type = BeanTagAttribute.AttributeType.DIRECTORBYTYPE)
139 public DatePicker getDatePicker() {
140 return this.datePicker;
141 }
142
143
144
145
146 @Override
147 public void setDatePicker(DatePicker datePicker) {
148 this.datePicker = datePicker;
149 }
150
151
152
153
154 @Override
155 @BeanTagAttribute
156 public boolean isTextExpand() {
157 return this.textExpand;
158 }
159
160
161
162
163 @Override
164 public void setTextExpand(boolean textExpand) {
165 this.textExpand = textExpand;
166 }
167
168
169
170
171 @Override
172 @BeanTagAttribute(name = "watermarkText")
173 public String getWatermarkText() {
174 return this.watermarkText;
175 }
176
177
178
179
180 @Override
181 public void setWatermarkText(String watermarkText) {
182
183
184 if (StringUtils.isNotEmpty(watermarkText)) {
185 watermarkText = watermarkText + " ";
186 }
187
188 this.watermarkText = watermarkText;
189 }
190 }