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 import org.kuali.rice.krad.uif.widget.DatePicker;
26
27 import java.util.List;
28
29
30
31
32
33
34
35 @BeanTag(name = "passwordControl-bean", parent = "Uif-PasswordControl")
36 public class PasswordControl extends ControlBase implements SizedControl {
37 private static final long serialVersionUID = -8267606288443759880L;
38
39 private int size;
40 private Integer maxLength;
41 private Integer minLength;
42
43 private String watermarkText = StringUtils.EMPTY;
44
45 public PasswordControl() {
46 super();
47 }
48
49
50
51
52
53
54
55
56
57
58
59 @Override
60 public void performFinalize(View view, Object model, Component parent) {
61 super.performFinalize(view, model, parent);
62
63 if (parent instanceof InputField) {
64 InputField field = (InputField) parent;
65 if (getMaxLength() == null) {
66 setMaxLength(field.getMaxLength());
67 }
68
69 if (getMinLength() == null) {
70 setMinLength(field.getMinLength());
71 }
72 }
73 }
74
75
76
77
78 @BeanTagAttribute(name = "size")
79 public int getSize() {
80 return this.size;
81 }
82
83
84
85
86 public void setSize(int size) {
87 this.size = size;
88 }
89
90
91
92
93
94
95
96
97 @BeanTagAttribute(name = "maxLength")
98 public Integer getMaxLength() {
99 return maxLength;
100 }
101
102
103
104
105
106
107 public void setMaxLength(Integer maxLength) {
108 this.maxLength = maxLength;
109 }
110
111
112
113
114
115
116
117
118 @BeanTagAttribute(name = "minLength")
119 public Integer getMinLength() {
120 return minLength;
121 }
122
123
124
125
126
127
128 public void setMinLength(Integer minLength) {
129 this.minLength = minLength;
130 }
131
132
133
134
135
136
137
138
139
140
141
142
143 @BeanTagAttribute(name = "watermarkText")
144 public String getWatermarkText() {
145 return this.watermarkText;
146 }
147
148
149
150
151
152
153 public void setWatermarkText(String watermarkText) {
154
155
156 if (StringUtils.isNotEmpty(watermarkText)) {
157 watermarkText = watermarkText + " ";
158 }
159
160 this.watermarkText = watermarkText;
161 }
162
163
164
165
166 @Override
167 protected <T> void copyProperties(T component) {
168 super.copyProperties(component);
169 PasswordControl passwordControlCopy = (PasswordControl) component;
170 passwordControlCopy.setSize(this.size);
171 passwordControlCopy.setMaxLength(this.maxLength);
172 passwordControlCopy.setMinLength(this.minLength);
173 passwordControlCopy.setWatermarkText(this.watermarkText);
174 }
175 }