1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.element;
17
18 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20 import org.kuali.rice.krad.uif.UifConstants;
21 import org.kuali.rice.krad.uif.container.CollectionGroup;
22 import org.kuali.rice.krad.uif.util.LifecycleElement;
23 import org.kuali.rice.krad.uif.util.UrlInfo;
24 import org.kuali.rice.krad.web.form.UifFormBase;
25
26
27
28
29
30
31
32
33
34
35 @BeanTag(name = "multiFileUploadCollection", parent = "Uif-MultiFileUploadCollection")
36 public class MultiFileUploadCollection extends ContentElementBase {
37 private static final long serialVersionUID = 6324034860109503990L;
38
39 private CollectionGroup collection;
40
41 private String methodToCall;
42 private UrlInfo url;
43
44 private String addFilesButtonText;
45
46 private String acceptFileTypes;
47 private Integer maxFileSize;
48 private Integer minFileSize;
49
50 private String propertyPath;
51
52
53
54
55
56
57
58 @Override
59 public void performFinalize(Object model, LifecycleElement parent) {
60 super.performFinalize(model, parent);
61
62 UifFormBase form = (UifFormBase) model;
63
64
65 if (url == null && methodToCall != null) {
66 getTemplateOptions().put(UifConstants.MultiFileUploadOptions.URL,
67 "?methodToCall=" + methodToCall + "&formKey=" + form.getFormKey() + "&viewId=" + form.getViewId()
68 + "&bindingPath=" + collection.getBindingInfo().getBindingPath()
69 + "&updateComponentId=" + collection.getId() );
70 } else if (url != null) {
71 getTemplateOptions().put(UifConstants.MultiFileUploadOptions.URL, url.getHref());
72 }
73
74 if (acceptFileTypes != null) {
75 getTemplateOptions().put(UifConstants.MultiFileUploadOptions.ACCEPT_FILE_TYPES, acceptFileTypes);
76 }
77
78 if (maxFileSize != null) {
79 getTemplateOptions().put(UifConstants.MultiFileUploadOptions.MAX_SIZE, maxFileSize.toString());
80 }
81
82 if (minFileSize != null) {
83 getTemplateOptions().put(UifConstants.MultiFileUploadOptions.MIN_SIZE, minFileSize.toString());
84 }
85
86 this.propertyPath = collection.getBindingInfo().getBindingPath();
87
88
89 this.collection.setReadOnly(this.getReadOnly());
90 }
91
92
93
94
95
96
97 @BeanTagAttribute
98 public CollectionGroup getCollection() {
99 return collection;
100 }
101
102
103
104
105 public void setCollection(CollectionGroup collection) {
106 this.collection = collection;
107 }
108
109
110
111
112
113
114 @BeanTagAttribute
115 public String getMethodToCall() {
116 return methodToCall;
117 }
118
119
120
121
122 public void setMethodToCall(String methodToCall) {
123 this.methodToCall = methodToCall;
124 }
125
126
127
128
129
130
131
132 @BeanTagAttribute
133 public UrlInfo getUrl() {
134 return url;
135 }
136
137
138
139
140 public void setUrl(UrlInfo url) {
141 this.url = url;
142 }
143
144
145
146
147
148
149 @BeanTagAttribute
150 public String getAddFilesButtonText() {
151 return addFilesButtonText;
152 }
153
154
155
156
157 public void setAddFilesButtonText(String addFilesButtonText) {
158 this.addFilesButtonText = addFilesButtonText;
159 }
160
161
162
163
164
165
166 @BeanTagAttribute
167 public String getAcceptFileTypes() {
168 return acceptFileTypes;
169 }
170
171
172
173
174 public void setAcceptFileTypes(String acceptFileTypes) {
175 this.acceptFileTypes = acceptFileTypes;
176 }
177
178
179
180
181
182
183 @BeanTagAttribute
184 public Integer getMaxFileSize() {
185 return maxFileSize;
186 }
187
188
189
190
191 public void setMaxFileSize(Integer maxFileSize) {
192 this.maxFileSize = maxFileSize;
193 }
194
195
196
197
198
199
200 @BeanTagAttribute
201 public Integer getMinFileSize() {
202 return minFileSize;
203 }
204
205
206
207
208 public void setMinFileSize(Integer minFileSize) {
209 this.minFileSize = minFileSize;
210 }
211
212
213
214
215
216
217 public String getPropertyPath() {
218 return propertyPath;
219 }
220 }