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.view.View;
25
26
27
28
29
30
31
32 @BeanTags({@BeanTag(name = "textAreaControl-bean", parent = "Uif-TextAreaControl"),
33 @BeanTag(name = "smallTextAreaControl-bean", parent = "Uif-SmallTextAreaControl"),
34 @BeanTag(name = "mediumTextAreaControl-bean", parent = "Uif-MediumTextAreaControl"),
35 @BeanTag(name = "largeTextAreaControl-bean", 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
61 @Override
62 public void performFinalize(View view, Object model, Component parent) {
63 super.performFinalize(view, model, parent);
64
65 if (parent instanceof InputField) {
66 InputField field = (InputField) parent;
67 if (getMaxLength() == null) {
68 setMaxLength(field.getMaxLength());
69 }
70
71 if (getMinLength() == null) {
72 setMinLength(field.getMinLength());
73 }
74 }
75 }
76
77
78
79
80
81
82 @BeanTagAttribute(name = "rows")
83 public int getRows() {
84 return this.rows;
85 }
86
87
88
89
90
91
92 public void setRows(int rows) {
93 this.rows = rows;
94 }
95
96
97
98
99
100
101 @BeanTagAttribute(name = "cols")
102 public int getCols() {
103 return this.cols;
104 }
105
106
107
108
109
110
111 public void setCols(int cols) {
112 this.cols = cols;
113 }
114
115
116
117
118
119
120
121
122 @BeanTagAttribute(name = "maxLength")
123 public Integer getMaxLength() {
124 return maxLength;
125 }
126
127
128
129
130
131
132 public void setMaxLength(Integer maxLength) {
133 this.maxLength = maxLength;
134 }
135
136
137
138
139
140
141
142
143 @BeanTagAttribute(name = "minLength")
144 public Integer getMinLength() {
145 return minLength;
146 }
147
148
149
150
151
152
153 public void setMinLength(Integer minLength) {
154 this.minLength = minLength;
155 }
156
157
158
159
160 @BeanTagAttribute(name = "watermarkText")
161 public String getWatermarkText() {
162 return this.watermarkText;
163 }
164
165
166
167
168 public void setWatermarkText(String watermarkText) {
169
170
171 if (StringUtils.isNotEmpty(watermarkText)) {
172 watermarkText = watermarkText + " ";
173 }
174 this.watermarkText = watermarkText;
175 }
176
177
178
179
180
181
182
183 @BeanTagAttribute(name = "textExpand")
184 public boolean isTextExpand() {
185 return this.textExpand;
186 }
187
188
189
190
191
192
193 public void setTextExpand(boolean textExpand) {
194 this.textExpand = textExpand;
195 }
196
197
198
199
200 @Override
201 protected <T> void copyProperties(T component) {
202 super.copyProperties(component);
203 TextAreaControl textAreaControlCopy = (TextAreaControl) component;
204 textAreaControlCopy.setRows(this.rows);
205 textAreaControlCopy.setCols(this.cols);
206 textAreaControlCopy.setMaxLength(this.maxLength);
207 textAreaControlCopy.setMinLength(this.minLength);
208 textAreaControlCopy.setTextExpand(this.textExpand);
209 textAreaControlCopy.setWatermarkText(this.watermarkText);
210 }
211 }