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
26
27
28
29
30
31
32 @BeanTags({@BeanTag(name = "textAreaControl", parent = "Uif-TextAreaControl"),
33 @BeanTag(name = "smallTextAreaControl", parent = "Uif-SmallTextAreaControl"),
34 @BeanTag(name = "mediumTextAreaControl", parent = "Uif-MediumTextAreaControl"),
35 @BeanTag(name = "largeTextAreaControl", parent = "Uif-LargeTextAreaControl")})
36 public class TextAreaControl extends ControlBase {
37 private static final long serialVersionUID = -4664558047325456844L;
38
39 private int rows;
40 private int cols;
41 private Integer maxLength;
42 private Integer minLength;
43
44 private boolean textExpand;
45 private String watermarkText = StringUtils.EMPTY;
46
47 public TextAreaControl() {
48 super();
49 }
50
51
52
53
54
55
56
57
58
59
60 @Override
61 public void performFinalize(Object model, LifecycleElement parent) {
62 super.performFinalize(model, parent);
63
64 if (parent instanceof InputField) {
65 InputField field = (InputField) parent;
66 if (getMaxLength() == null) {
67 setMaxLength(field.getMaxLength());
68 }
69
70 if (getMinLength() == null) {
71 setMinLength(field.getMinLength());
72 }
73
74 if (textExpand) {
75 field.setRenderInputAddonGroup(true);
76 }
77 }
78 }
79
80
81
82
83
84
85 @BeanTagAttribute
86 public int getRows() {
87 return this.rows;
88 }
89
90
91
92
93
94
95 public void setRows(int rows) {
96 this.rows = rows;
97 }
98
99
100
101
102
103
104 @BeanTagAttribute
105 public int getCols() {
106 return this.cols;
107 }
108
109
110
111
112
113
114 public void setCols(int cols) {
115 this.cols = cols;
116 }
117
118
119
120
121
122
123
124
125 @BeanTagAttribute
126 public Integer getMaxLength() {
127 return maxLength;
128 }
129
130
131
132
133
134
135 public void setMaxLength(Integer maxLength) {
136 this.maxLength = maxLength;
137 }
138
139
140
141
142
143
144
145
146 @BeanTagAttribute
147 public Integer getMinLength() {
148 return minLength;
149 }
150
151
152
153
154
155
156 public void setMinLength(Integer minLength) {
157 this.minLength = minLength;
158 }
159
160
161
162
163 @BeanTagAttribute
164 public String getWatermarkText() {
165 return this.watermarkText;
166 }
167
168
169
170
171 public void setWatermarkText(String watermarkText) {
172
173
174 if (StringUtils.isNotEmpty(watermarkText)) {
175 watermarkText = watermarkText + " ";
176 }
177 this.watermarkText = watermarkText;
178 }
179
180
181
182
183
184
185
186 @BeanTagAttribute
187 public boolean isTextExpand() {
188 return this.textExpand;
189 }
190
191
192
193
194
195
196 public void setTextExpand(boolean textExpand) {
197 this.textExpand = textExpand;
198 }
199 }