1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.field;
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.uif.component.Component;
22 import org.kuali.rice.krad.uif.element.Header;
23 import org.kuali.rice.krad.uif.element.Image;
24 import org.kuali.rice.krad.uif.element.Message;
25 import org.kuali.rice.krad.uif.view.View;
26
27 import java.util.List;
28
29
30
31
32
33
34
35
36
37
38
39 @BeanTag(name = "imageField-bean", parent = "Uif-ImageField")
40 public class ImageField extends FieldBase {
41 private static final long serialVersionUID = -7994212503770623408L;
42
43 private Image image;
44
45 public ImageField() {
46 super();
47 }
48
49
50
51
52
53
54
55
56
57 @Override
58 public void performFinalize(View view, Object model, Component parent) {
59 super.performFinalize(view, model, parent);
60
61
62 if (this.getFieldLabel() != null && this.getImage() != null && StringUtils.isNotBlank(this.getImage().getId())) {
63 this.getFieldLabel().setLabelForComponentId(this.getImage().getId());
64 }
65 }
66
67
68
69
70 @Override
71 public List<Component> getComponentsForLifecycle() {
72 List<Component> components = super.getComponentsForLifecycle();
73
74 components.add(image);
75
76 return components;
77 }
78
79
80
81
82
83
84 @BeanTagAttribute(name="image",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
85 public Image getImage() {
86 return image;
87 }
88
89
90
91
92
93
94 public void setImage(Image image) {
95 this.image = image;
96 }
97
98
99
100
101
102
103
104 @BeanTagAttribute(name="source")
105 public String getSource() {
106 return image.getSource();
107 }
108
109
110
111
112
113
114 public void setSource(String source) {
115 image.setSource(source);
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129 @BeanTagAttribute(name="altText")
130 public String getAltText() {
131 return image.getAltText();
132 }
133
134
135
136
137
138
139 public void setAltText(String altText) {
140 image.setAltText(altText);
141 }
142
143
144
145
146
147
148 @BeanTagAttribute(name="height")
149 public String getHeight() {
150 return image.getHeight();
151 }
152
153
154
155
156
157
158 public void setHeight(String height) {
159 image.setHeight(height);
160 }
161
162
163
164
165
166
167 public void setWidth(String width) {
168 if (image != null) {
169 image.setWidth(width);
170 }
171 }
172
173
174
175
176
177
178 @BeanTagAttribute(name="width")
179 public String getWidth() {
180 return image.getWidth();
181 }
182
183
184
185
186
187
188 @BeanTagAttribute(name="captionHeaderText")
189 public String getCaptionHeaderText() {
190 return image.getCaptionHeaderText();
191 }
192
193
194
195
196
197
198 public void setCaptionHeaderText(String captionHeaderText) {
199 image.setCaptionHeaderText(captionHeaderText);
200 }
201
202
203
204
205
206
207 @BeanTagAttribute(name="captionHeader",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
208 public Header getCaptionHeader() {
209 return image.getCaptionHeader();
210 }
211
212
213
214
215
216
217 public void setCaptionHeader(Header captionHeader) {
218 image.setCaptionHeader(captionHeader);
219 }
220
221
222
223
224
225
226 @BeanTagAttribute(name="cutlineText")
227 public String getCutlineText() {
228 return image.getCutlineText();
229 }
230
231
232
233
234
235
236 public void setCutlineText(String cutlineText) {
237 image.setCutlineText(cutlineText);
238 }
239
240
241
242
243
244
245 @BeanTagAttribute(name="cutline",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
246 public Message getCutline() {
247 return image.getCutlineMessage();
248 }
249
250
251
252
253
254
255 public void setCutline(Message cutline) {
256 image.setCutlineMessage(cutline);
257 }
258
259
260
261
262
263
264 @BeanTagAttribute(name="captionHeaderAboveImage")
265 public boolean isCaptionHeaderAboveImage() {
266 return image.isCaptionHeaderPlacementAboveImage();
267 }
268
269
270
271
272
273
274 public void setCaptionHeaderAboveImage(boolean captionHeaderAboveImage) {
275 image.setCaptionHeaderPlacementAboveImage(captionHeaderAboveImage);
276 }
277
278
279
280
281 @Override
282 protected <T> void copyProperties(T component) {
283 super.copyProperties(component);
284
285 ImageField imageFieldCopy = (ImageField) component;
286
287 if (this.image != null) {
288 imageFieldCopy.setImage((Image) this.image.copy());
289 }
290 }
291 }