Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ComponentBase |
|
| 1.3108108108108107;1.311 |
1 | /* | |
2 | * Copyright 2007 The Kuali Foundation Licensed under the Educational Community | |
3 | * License, Version 1.0 (the "License"); you may not use this file except in | |
4 | * compliance with the License. You may obtain a copy of the License at | |
5 | * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law | |
6 | * or agreed to in writing, software distributed under the License is | |
7 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
8 | * KIND, either express or implied. See the License for the specific language | |
9 | * governing permissions and limitations under the License. | |
10 | */ | |
11 | package org.kuali.rice.krad.uif.core; | |
12 | ||
13 | import org.apache.commons.lang.StringUtils; | |
14 | import org.kuali.rice.krad.uif.CssConstants; | |
15 | import org.kuali.rice.krad.uif.UifConstants; | |
16 | import org.kuali.rice.krad.uif.UifConstants.ViewStatus; | |
17 | import org.kuali.rice.krad.uif.UifPropertyPaths; | |
18 | import org.kuali.rice.krad.uif.container.CollectionGroup; | |
19 | import org.kuali.rice.krad.uif.container.View; | |
20 | import org.kuali.rice.krad.uif.control.ControlBase; | |
21 | import org.kuali.rice.krad.uif.field.AttributeField; | |
22 | import org.kuali.rice.krad.uif.modifier.ComponentModifier; | |
23 | import org.kuali.rice.krad.uif.util.ComponentUtils; | |
24 | import org.kuali.rice.krad.uif.util.ViewModelUtils; | |
25 | ||
26 | import java.util.ArrayList; | |
27 | import java.util.HashMap; | |
28 | import java.util.HashSet; | |
29 | import java.util.List; | |
30 | import java.util.ListIterator; | |
31 | import java.util.Map; | |
32 | import java.util.Set; | |
33 | ||
34 | /** | |
35 | * Base implementation of <code>Component</code> which other component | |
36 | * implementations should extend | |
37 | * | |
38 | * <p> | |
39 | * Provides base component properties such as id and template. Also provides | |
40 | * default implementation for the <code>ScriptEventSupport</code> and | |
41 | * <code>Ordered</code> interfaces. By default no script events except the | |
42 | * onDocumentReady are supported. | |
43 | * </p> | |
44 | * | |
45 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
46 | */ | |
47 | public abstract class ComponentBase implements Component { | |
48 | private static final long serialVersionUID = -4449335748129894350L; | |
49 | ||
50 | private String id; | |
51 | private String baseId; | |
52 | private String template; | |
53 | private String title; | |
54 | ||
55 | private boolean render; | |
56 | private boolean refresh; | |
57 | private String conditionalRender; | |
58 | ||
59 | private String progressiveRender; | |
60 | private boolean progressiveRenderViaAJAX; | |
61 | private boolean progressiveRenderAndRefresh; | |
62 | private List<String> progressiveDisclosureControlNames; | |
63 | private String progressiveDisclosureConditionJs; | |
64 | ||
65 | private String conditionalRefresh; | |
66 | private String conditionalRefreshConditionJs; | |
67 | private List<String> conditionalRefreshControlNames; | |
68 | ||
69 | private String refreshWhenChanged; | |
70 | private List<String> refreshWhenChangedControlNames; | |
71 | ||
72 | private boolean hidden; | |
73 | ||
74 | private boolean readOnly; | |
75 | private String conditionalReadOnly; | |
76 | ||
77 | private Boolean required; | |
78 | private String conditionalRequired; | |
79 | ||
80 | private String align; | |
81 | private String valign; | |
82 | private String width; | |
83 | ||
84 | private int colSpan; | |
85 | private String conditionalColSpan; | |
86 | ||
87 | private int rowSpan; | |
88 | private String conditionalRowSpan; | |
89 | ||
90 | private String style; | |
91 | private List<String> styleClasses; | |
92 | ||
93 | private int order; | |
94 | ||
95 | private boolean skipInTabOrder; | |
96 | ||
97 | private String finalizeMethodToCall; | |
98 | private List<Object> finalizeMethodAdditionalArguments; | |
99 | private MethodInvokerConfig finalizeMethodInvoker; | |
100 | private boolean selfRendered; | |
101 | private String renderOutput; | |
102 | ||
103 | private String onLoadScript; | |
104 | private String onUnloadScript; | |
105 | private String onCloseScript; | |
106 | private String onBlurScript; | |
107 | private String onChangeScript; | |
108 | private String onClickScript; | |
109 | private String onDblClickScript; | |
110 | private String onFocusScript; | |
111 | private String onSubmitScript; | |
112 | private String onKeyPressScript; | |
113 | private String onKeyUpScript; | |
114 | private String onKeyDownScript; | |
115 | private String onMouseOverScript; | |
116 | private String onMouseOutScript; | |
117 | private String onMouseUpScript; | |
118 | private String onMouseDownScript; | |
119 | private String onMouseMoveScript; | |
120 | private String onDocumentReadyScript; | |
121 | ||
122 | private List<ComponentModifier> componentModifiers; | |
123 | ||
124 | private Map<String, String> componentOptions; | |
125 | ||
126 | @ReferenceCopy(newCollectionInstance = true) | |
127 | private transient Map<String, Object> context; | |
128 | ||
129 | private Map<String, String> propertyExpressions; | |
130 | private List<PropertyReplacer> propertyReplacers; | |
131 | ||
132 | 0 | public ComponentBase() { |
133 | 0 | order = 0; |
134 | 0 | colSpan = 1; |
135 | 0 | rowSpan = 1; |
136 | ||
137 | 0 | render = true; |
138 | 0 | selfRendered = false; |
139 | 0 | progressiveRenderViaAJAX = false; |
140 | 0 | progressiveRenderAndRefresh = false; |
141 | ||
142 | 0 | finalizeMethodAdditionalArguments = new ArrayList<Object>(); |
143 | 0 | styleClasses = new ArrayList<String>(); |
144 | 0 | componentModifiers = new ArrayList<ComponentModifier>(); |
145 | 0 | componentOptions = new HashMap<String, String>(); |
146 | 0 | context = new HashMap<String, Object>(); |
147 | 0 | propertyExpressions = new HashMap<String, String>(); |
148 | 0 | propertyReplacers = new ArrayList<PropertyReplacer>(); |
149 | 0 | } |
150 | ||
151 | /** | |
152 | * The following initialization is performed: progressiveRender and | |
153 | * conditionalRefresh variables are processed if set. | |
154 | * <ul> | |
155 | * </ul> | |
156 | * | |
157 | * @see org.kuali.rice.krad.uif.core.ComponentBase#performInitialization(org.kuali.rice.krad.uif.container.View) | |
158 | */ | |
159 | public void performInitialization(View view) { | |
160 | 0 | if (StringUtils.isNotEmpty(progressiveRender)) { |
161 | // progressive anded with conditional render, will not render at | |
162 | // least one of the two are false. | |
163 | 0 | if (StringUtils.isNotEmpty(conditionalRender)) { |
164 | 0 | conditionalRender = "(" + conditionalRender + ") and (" + progressiveRender + ")"; |
165 | } else { | |
166 | 0 | conditionalRender = progressiveRender; |
167 | } | |
168 | 0 | progressiveDisclosureControlNames = new ArrayList<String>(); |
169 | 0 | progressiveDisclosureConditionJs = |
170 | ComponentUtils.parseExpression(progressiveRender, progressiveDisclosureControlNames); | |
171 | } | |
172 | ||
173 | 0 | if (StringUtils.isNotEmpty(conditionalRefresh)) { |
174 | 0 | conditionalRefreshControlNames = new ArrayList<String>(); |
175 | 0 | conditionalRefreshConditionJs = |
176 | ComponentUtils.parseExpression(conditionalRefresh, conditionalRefreshControlNames); | |
177 | } | |
178 | ||
179 | 0 | if (StringUtils.isNotEmpty(refreshWhenChanged)) { |
180 | 0 | refreshWhenChangedControlNames = new ArrayList<String>(); |
181 | 0 | String[] names = StringUtils.split(refreshWhenChanged, ","); |
182 | 0 | for (String name : names) { |
183 | 0 | refreshWhenChangedControlNames.add(name.trim()); |
184 | } | |
185 | } | |
186 | 0 | } |
187 | ||
188 | /** | |
189 | * The following updates are done here: | |
190 | * <ul> | |
191 | * <li></li> | |
192 | * </ul> | |
193 | * | |
194 | * @see org.kuali.rice.krad.uif.core.Component#performApplyModel(org.kuali.rice.krad.uif.container.View, | |
195 | * java.lang.Object) | |
196 | */ | |
197 | public void performApplyModel(View view, Object model, Component parent) { | |
198 | ||
199 | 0 | } |
200 | ||
201 | /** | |
202 | * The following finalization is done here: | |
203 | * <ul> | |
204 | * <li>If any of the style properties were given, sets the style string on | |
205 | * the style property</li> | |
206 | * <li>Setup the decorator chain (if component has decorators) for rendering | |
207 | * </li> | |
208 | * <li>Set the skipInTabOrder flag for nested components</li> | |
209 | * </ul> | |
210 | * | |
211 | * @see org.kuali.rice.krad.uif.core.Component#performFinalize(org.kuali.rice.krad.uif.container.View, | |
212 | * java.lang.Object, org.kuali.rice.krad.uif.core.Component) | |
213 | */ | |
214 | public void performFinalize(View view, Object model, Component parent) { | |
215 | 0 | if (!ViewStatus.FINAL.equals(view.getViewStatus())) { |
216 | // add the align, valign, and width settings to style | |
217 | 0 | if (StringUtils.isNotBlank(getAlign()) && !StringUtils.contains(getStyle(), CssConstants.TEXT_ALIGN)) { |
218 | 0 | appendToStyle(CssConstants.TEXT_ALIGN + getAlign() + ";"); |
219 | } | |
220 | ||
221 | 0 | if (StringUtils.isNotBlank(getValign()) && !StringUtils.contains(getStyle(), CssConstants.VERTICAL_ALIGN)) { |
222 | 0 | appendToStyle(CssConstants.VERTICAL_ALIGN + getValign() + ";"); |
223 | } | |
224 | ||
225 | 0 | if (StringUtils.isNotBlank(getWidth()) && !StringUtils.contains(getStyle(), CssConstants.WIDTH)) { |
226 | 0 | appendToStyle(CssConstants.WIDTH + getWidth() + ";"); |
227 | } | |
228 | } | |
229 | ||
230 | // Set the skipInTabOrder flag on all nested components | |
231 | // Set the tabIndex on controls to -1 in order to be skipped on tabbing | |
232 | 0 | for (Component component : getNestedComponents()) { |
233 | 0 | if (component != null && component instanceof ComponentBase && skipInTabOrder) { |
234 | 0 | ((ComponentBase) component).setSkipInTabOrder(skipInTabOrder); |
235 | 0 | if (component instanceof ControlBase) { |
236 | 0 | ((ControlBase) component).setTabIndex(-1); |
237 | } | |
238 | } | |
239 | } | |
240 | // replace the #line? collections place holder with the correct binding | |
241 | // path | |
242 | 0 | CollectionGroup collectionGroup = |
243 | (CollectionGroup) (this.getContext().get(UifConstants.ContextVariableNames.COLLECTION_GROUP)); | |
244 | 0 | String linePath = ""; |
245 | 0 | if (collectionGroup != null) { |
246 | 0 | linePath = ComponentUtils.getLinePathValue(this); |
247 | //ProgressiveRender conditions | |
248 | 0 | if (StringUtils.isNotEmpty(progressiveRender) && StringUtils.isNotEmpty(linePath)) { |
249 | 0 | progressiveDisclosureConditionJs = |
250 | ComponentUtils.replaceLineAttr(progressiveDisclosureConditionJs, linePath); | |
251 | 0 | ListIterator<String> listIterator = progressiveDisclosureControlNames.listIterator(); |
252 | 0 | while (listIterator.hasNext()) { |
253 | 0 | String name = listIterator.next(); |
254 | 0 | name = ComponentUtils.replaceLineAttr(name, linePath); |
255 | 0 | listIterator.set(name); |
256 | 0 | } |
257 | } | |
258 | ||
259 | //Refresh conditions | |
260 | 0 | if (StringUtils.isNotEmpty(conditionalRefresh) && StringUtils.isNotEmpty(linePath)) { |
261 | 0 | conditionalRefreshConditionJs = ComponentUtils.replaceLineAttr(conditionalRefreshConditionJs, linePath); |
262 | 0 | ListIterator<String> listIterator = conditionalRefreshControlNames.listIterator(); |
263 | 0 | while (listIterator.hasNext()) { |
264 | 0 | String name = listIterator.next(); |
265 | 0 | name = ComponentUtils.replaceLineAttr(name, linePath); |
266 | 0 | listIterator.set(name); |
267 | 0 | } |
268 | } | |
269 | ||
270 | 0 | if (StringUtils.isNotEmpty(refreshWhenChanged)) { |
271 | 0 | ListIterator<String> listIterator = refreshWhenChangedControlNames.listIterator(); |
272 | 0 | while (listIterator.hasNext()) { |
273 | 0 | String name = listIterator.next(); |
274 | 0 | name = ComponentUtils.replaceLineAttr(name, linePath); |
275 | 0 | listIterator.set(name); |
276 | 0 | } |
277 | } | |
278 | } | |
279 | 0 | } |
280 | ||
281 | /** | |
282 | * @see org.kuali.rice.krad.uif.core.Component#getNestedComponents() | |
283 | */ | |
284 | @Override | |
285 | public List<Component> getNestedComponents() { | |
286 | 0 | List<Component> components = new ArrayList<Component>(); |
287 | ||
288 | 0 | return components; |
289 | } | |
290 | ||
291 | /** | |
292 | * Set of property names for the component base for which on the property | |
293 | * value reference should be copied. Subclasses can override this but should | |
294 | * include a call to super | |
295 | * | |
296 | * @see org.kuali.rice.krad.uif.core.Component#getPropertiesForReferenceCopy() | |
297 | */ | |
298 | public Set<String> getPropertiesForReferenceCopy() { | |
299 | 0 | Set<String> refCopyProperties = new HashSet<String>(); |
300 | ||
301 | 0 | refCopyProperties.add(UifPropertyPaths.COMPONENT_MODIFIERS); |
302 | 0 | refCopyProperties.add(UifPropertyPaths.CONTEXT); |
303 | ||
304 | 0 | return refCopyProperties; |
305 | } | |
306 | ||
307 | /** | |
308 | * @see org.kuali.rice.krad.uif.core.Component#getId() | |
309 | */ | |
310 | public String getId() { | |
311 | 0 | return this.id; |
312 | } | |
313 | ||
314 | /** | |
315 | * @see org.kuali.rice.krad.uif.core.Component#setId(java.lang.String) | |
316 | */ | |
317 | public void setId(String id) { | |
318 | 0 | this.id = id; |
319 | 0 | } |
320 | ||
321 | /** | |
322 | * @see org.kuali.rice.krad.uif.core.Component#getTemplate() | |
323 | */ | |
324 | public String getTemplate() { | |
325 | 0 | return this.template; |
326 | } | |
327 | ||
328 | /** | |
329 | * @see org.kuali.rice.krad.uif.core.Component#setTemplate(java.lang.String) | |
330 | */ | |
331 | public void setTemplate(String template) { | |
332 | 0 | this.template = template; |
333 | 0 | } |
334 | ||
335 | /** | |
336 | * @see org.kuali.rice.krad.uif.core.Component#getTitle() | |
337 | */ | |
338 | public String getTitle() { | |
339 | 0 | return this.title; |
340 | } | |
341 | ||
342 | /** | |
343 | * @see org.kuali.rice.krad.uif.core.Component#setTitle(java.lang.String) | |
344 | */ | |
345 | public void setTitle(String title) { | |
346 | 0 | this.title = title; |
347 | 0 | } |
348 | ||
349 | /** | |
350 | * @see org.kuali.rice.krad.uif.core.Component#isHidden() | |
351 | */ | |
352 | public boolean isHidden() { | |
353 | 0 | return this.hidden; |
354 | } | |
355 | ||
356 | /** | |
357 | * @see org.kuali.rice.krad.uif.core.Component#setHidden(boolean) | |
358 | */ | |
359 | public void setHidden(boolean hidden) { | |
360 | 0 | this.hidden = hidden; |
361 | 0 | } |
362 | ||
363 | /** | |
364 | * @see org.kuali.rice.krad.uif.core.Component#isReadOnly() | |
365 | */ | |
366 | public boolean isReadOnly() { | |
367 | 0 | return this.readOnly; |
368 | } | |
369 | ||
370 | /** | |
371 | * @see org.kuali.rice.krad.uif.core.Component#setReadOnly(boolean) | |
372 | */ | |
373 | public void setReadOnly(boolean readOnly) { | |
374 | 0 | this.readOnly = readOnly; |
375 | 0 | } |
376 | ||
377 | /** | |
378 | * @see org.kuali.rice.krad.uif.core.Component#getConditionalReadOnly() | |
379 | */ | |
380 | public String getConditionalReadOnly() { | |
381 | 0 | return this.conditionalReadOnly; |
382 | } | |
383 | ||
384 | /** | |
385 | * @see org.kuali.rice.krad.uif.core.Component#setConditionalReadOnly(java.lang.String) | |
386 | */ | |
387 | public void setConditionalReadOnly(String conditionalReadOnly) { | |
388 | 0 | this.conditionalReadOnly = conditionalReadOnly; |
389 | 0 | } |
390 | ||
391 | /** | |
392 | * @see org.kuali.rice.krad.uif.core.Component#getRequired() | |
393 | */ | |
394 | public Boolean getRequired() { | |
395 | 0 | return this.required; |
396 | } | |
397 | ||
398 | /** | |
399 | * @see org.kuali.rice.krad.uif.core.Component#setRequired(java.lang.Boolean) | |
400 | */ | |
401 | public void setRequired(Boolean required) { | |
402 | 0 | this.required = required; |
403 | 0 | } |
404 | ||
405 | /** | |
406 | * Expression language string for conditionally setting the required | |
407 | * property | |
408 | * | |
409 | * @return String el that should evaluate to boolean | |
410 | */ | |
411 | public String getConditionalRequired() { | |
412 | 0 | return this.conditionalRequired; |
413 | } | |
414 | ||
415 | /** | |
416 | * Setter for the conditional required string | |
417 | * | |
418 | * @param conditionalRequired | |
419 | */ | |
420 | public void setConditionalRequired(String conditionalRequired) { | |
421 | 0 | this.conditionalRequired = conditionalRequired; |
422 | 0 | } |
423 | ||
424 | /** | |
425 | * @see org.kuali.rice.krad.uif.core.Component#isRender() | |
426 | */ | |
427 | public boolean isRender() { | |
428 | 0 | return this.render; |
429 | } | |
430 | ||
431 | /** | |
432 | * @see org.kuali.rice.krad.uif.core.Component#setRender(boolean) | |
433 | */ | |
434 | public void setRender(boolean render) { | |
435 | 0 | this.render = render; |
436 | 0 | } |
437 | ||
438 | public void setRender(String render) { | |
439 | 0 | this.propertyExpressions.put("render", render); |
440 | 0 | } |
441 | ||
442 | /** | |
443 | * @see org.kuali.rice.krad.uif.core.Component#getConditionalRender() | |
444 | */ | |
445 | public String getConditionalRender() { | |
446 | 0 | return this.conditionalRender; |
447 | } | |
448 | ||
449 | /** | |
450 | * @see org.kuali.rice.krad.uif.core.Component#setConditionalRender(java.lang.String) | |
451 | */ | |
452 | public void setConditionalRender(String conditionalRender) { | |
453 | 0 | this.conditionalRender = conditionalRender; |
454 | 0 | } |
455 | ||
456 | /** | |
457 | * @see org.kuali.rice.krad.uif.core.Component#getColSpan() | |
458 | */ | |
459 | public int getColSpan() { | |
460 | 0 | return this.colSpan; |
461 | } | |
462 | ||
463 | /** | |
464 | * @see org.kuali.rice.krad.uif.core.Component#setColSpan(int) | |
465 | */ | |
466 | public void setColSpan(int colSpan) { | |
467 | 0 | this.colSpan = colSpan; |
468 | 0 | } |
469 | ||
470 | /** | |
471 | * Expression language string for conditionally setting the colSpan property | |
472 | * | |
473 | * @return String el that should evaluate to int | |
474 | */ | |
475 | public String getConditionalColSpan() { | |
476 | 0 | return this.conditionalColSpan; |
477 | } | |
478 | ||
479 | /** | |
480 | * Setter for the conditional colSpan string | |
481 | * | |
482 | * @param conditionalColSpan | |
483 | */ | |
484 | public void setConditionalColSpan(String conditionalColSpan) { | |
485 | 0 | this.conditionalColSpan = conditionalColSpan; |
486 | 0 | } |
487 | ||
488 | /** | |
489 | * @see org.kuali.rice.krad.uif.core.Component#getRowSpan() | |
490 | */ | |
491 | public int getRowSpan() { | |
492 | 0 | return this.rowSpan; |
493 | } | |
494 | ||
495 | /** | |
496 | * @see org.kuali.rice.krad.uif.core.Component#setRowSpan(int) | |
497 | */ | |
498 | public void setRowSpan(int rowSpan) { | |
499 | 0 | this.rowSpan = rowSpan; |
500 | 0 | } |
501 | ||
502 | /** | |
503 | * Expression language string for conditionally setting the rowSpan property | |
504 | * | |
505 | * @return String el that should evaluate to int | |
506 | */ | |
507 | public String getConditionalRowSpan() { | |
508 | 0 | return this.conditionalRowSpan; |
509 | } | |
510 | ||
511 | /** | |
512 | * Setter for the conditional rowSpan string | |
513 | * | |
514 | * @param conditionalRowSpan | |
515 | */ | |
516 | public void setConditionalRowSpan(String conditionalRowSpan) { | |
517 | 0 | this.conditionalRowSpan = conditionalRowSpan; |
518 | 0 | } |
519 | ||
520 | /** | |
521 | * Horizontal alignment of the component within its container | |
522 | * <p> | |
523 | * All components belong to a <code>Container</code> and are placed using a | |
524 | * <code>LayoutManager</code>. This property specifies how the component | |
525 | * should be aligned horizontally within the container. During the finalize | |
526 | * phase the CSS text-align style will be created for the align setting. | |
527 | * </p> | |
528 | * | |
529 | * @return String horizontal align | |
530 | * @see org.kuali.rice.krad.uif.CssConstants.TextAligns | |
531 | */ | |
532 | public String getAlign() { | |
533 | 0 | return this.align; |
534 | } | |
535 | ||
536 | /** | |
537 | * Sets the components horizontal alignment | |
538 | * | |
539 | * @param align | |
540 | */ | |
541 | public void setAlign(String align) { | |
542 | 0 | this.align = align; |
543 | 0 | } |
544 | ||
545 | /** | |
546 | * Vertical alignment of the component within its container | |
547 | * <p> | |
548 | * All components belong to a <code>Container</code> and are placed using a | |
549 | * <code>LayoutManager</code>. This property specifies how the component | |
550 | * should be aligned vertically within the container. During the finalize | |
551 | * phase the CSS vertical-align style will be created for the valign | |
552 | * setting. | |
553 | * </p> | |
554 | * | |
555 | * @return String vertical align | |
556 | * @see org.kuali.rice.krad.uif.CssConstants.VerticalAligns | |
557 | */ | |
558 | public String getValign() { | |
559 | 0 | return this.valign; |
560 | } | |
561 | ||
562 | /** | |
563 | * Setter for the component's vertical align | |
564 | * | |
565 | * @param valign | |
566 | */ | |
567 | public void setValign(String valign) { | |
568 | 0 | this.valign = valign; |
569 | 0 | } |
570 | ||
571 | /** | |
572 | * Width the component should take up in the container | |
573 | * <p> | |
574 | * All components belong to a <code>Container</code> and are placed using a | |
575 | * <code>LayoutManager</code>. This property specifies a width the component | |
576 | * should take up in the Container. This is not applicable for all layout | |
577 | * managers. During the finalize phase the CSS width style will be created | |
578 | * for the width setting. | |
579 | * </p> | |
580 | * <p> | |
581 | * e.g. '30%', '55px' | |
582 | * </p> | |
583 | * | |
584 | * @return String width string | |
585 | */ | |
586 | public String getWidth() { | |
587 | 0 | return this.width; |
588 | } | |
589 | ||
590 | /** | |
591 | * Setter for the components width | |
592 | * | |
593 | * @param width | |
594 | */ | |
595 | public void setWidth(String width) { | |
596 | 0 | this.width = width; |
597 | 0 | } |
598 | ||
599 | /** | |
600 | * @see org.kuali.rice.krad.uif.core.Component#getStyle() | |
601 | */ | |
602 | public String getStyle() { | |
603 | 0 | return this.style; |
604 | } | |
605 | ||
606 | /** | |
607 | * @see org.kuali.rice.krad.uif.core.Component#setStyle(java.lang.String) | |
608 | */ | |
609 | public void setStyle(String style) { | |
610 | 0 | this.style = style; |
611 | 0 | } |
612 | ||
613 | /** | |
614 | * @see org.kuali.rice.krad.uif.core.Component#getStyleClasses() | |
615 | */ | |
616 | public List<String> getStyleClasses() { | |
617 | 0 | return this.styleClasses; |
618 | } | |
619 | ||
620 | /** | |
621 | * @see org.kuali.rice.krad.uif.core.Component#setStyleClasses(java.util.List) | |
622 | */ | |
623 | public void setStyleClasses(List<String> styleClasses) { | |
624 | 0 | this.styleClasses = styleClasses; |
625 | 0 | } |
626 | ||
627 | /** | |
628 | * Builds the HTML class attribute string by combining the styleClasses list | |
629 | * with a space delimiter | |
630 | * | |
631 | * @return String class attribute string | |
632 | */ | |
633 | public String getStyleClassesAsString() { | |
634 | 0 | if (styleClasses != null) { |
635 | 0 | return StringUtils.join(styleClasses, " "); |
636 | } | |
637 | ||
638 | 0 | return ""; |
639 | } | |
640 | ||
641 | /** | |
642 | * @see org.kuali.rice.krad.uif.core.Component#addStyleClass(java.lang.String) | |
643 | */ | |
644 | public void addStyleClass(String styleClass) { | |
645 | 0 | if (!styleClasses.contains(styleClass)) { |
646 | 0 | styleClasses.add(styleClass); |
647 | } | |
648 | 0 | } |
649 | ||
650 | /** | |
651 | * @see org.kuali.rice.krad.uif.Component#appendToStyle(java.lang.String) | |
652 | */ | |
653 | public void appendToStyle(String styleRules) { | |
654 | 0 | if (style == null) { |
655 | 0 | style = ""; |
656 | } | |
657 | 0 | style = style + styleRules; |
658 | 0 | } |
659 | ||
660 | /** | |
661 | * @see org.kuali.rice.krad.uif.core.Component#getFinalizeMethodToCall() | |
662 | */ | |
663 | public String getFinalizeMethodToCall() { | |
664 | 0 | return this.finalizeMethodToCall; |
665 | } | |
666 | ||
667 | /** | |
668 | * Setter for the finalize method | |
669 | * | |
670 | * @param finalizeMethodToCall | |
671 | */ | |
672 | public void setFinalizeMethodToCall(String finalizeMethodToCall) { | |
673 | 0 | this.finalizeMethodToCall = finalizeMethodToCall; |
674 | 0 | } |
675 | ||
676 | /** | |
677 | * @see org.kuali.rice.krad.uif.core.Component#getFinalizeMethodAdditionalArguments() | |
678 | */ | |
679 | public List<Object> getFinalizeMethodAdditionalArguments() { | |
680 | 0 | return finalizeMethodAdditionalArguments; |
681 | } | |
682 | ||
683 | /** | |
684 | * Setter for the finalize additional arguments list | |
685 | * | |
686 | * @param finalizeMethodAdditionalArguments | |
687 | */ | |
688 | public void setFinalizeMethodAdditionalArguments(List<Object> finalizeMethodAdditionalArguments) { | |
689 | 0 | this.finalizeMethodAdditionalArguments = finalizeMethodAdditionalArguments; |
690 | 0 | } |
691 | ||
692 | /** | |
693 | * @see org.kuali.rice.krad.uif.core.Component#getFinalizeMethodInvoker() | |
694 | */ | |
695 | public MethodInvokerConfig getFinalizeMethodInvoker() { | |
696 | 0 | return this.finalizeMethodInvoker; |
697 | } | |
698 | ||
699 | /** | |
700 | * Setter for the method invoker instance | |
701 | * | |
702 | * @param renderingMethodInvoker | |
703 | */ | |
704 | public void setFinalizeMethodInvoker(MethodInvokerConfig finalizeMethodInvoker) { | |
705 | 0 | this.finalizeMethodInvoker = finalizeMethodInvoker; |
706 | 0 | } |
707 | ||
708 | /** | |
709 | * @see org.kuali.rice.krad.uif.core.Component#isSelfRendered() | |
710 | */ | |
711 | public boolean isSelfRendered() { | |
712 | 0 | return this.selfRendered; |
713 | } | |
714 | ||
715 | /** | |
716 | * @see org.kuali.rice.krad.uif.core.Component#setSelfRendered(boolean) | |
717 | */ | |
718 | public void setSelfRendered(boolean selfRendered) { | |
719 | 0 | this.selfRendered = selfRendered; |
720 | 0 | } |
721 | ||
722 | /** | |
723 | * @see org.kuali.rice.krad.uif.core.Component#getRenderOutput() | |
724 | */ | |
725 | public String getRenderOutput() { | |
726 | 0 | return this.renderOutput; |
727 | } | |
728 | ||
729 | /** | |
730 | * @see org.kuali.rice.krad.uif.core.Component#setRenderOutput(java.lang.String) | |
731 | */ | |
732 | public void setRenderOutput(String renderOutput) { | |
733 | 0 | this.renderOutput = renderOutput; |
734 | 0 | } |
735 | ||
736 | /** | |
737 | * @see org.kuali.rice.krad.uif.core.Component#getComponentModifiers() | |
738 | */ | |
739 | public List<ComponentModifier> getComponentModifiers() { | |
740 | 0 | return this.componentModifiers; |
741 | } | |
742 | ||
743 | /** | |
744 | * @see org.kuali.rice.krad.uif.core.Component#setComponentModifiers(java.util.List) | |
745 | */ | |
746 | public void setComponentModifiers(List<ComponentModifier> componentModifiers) { | |
747 | 0 | this.componentModifiers = componentModifiers; |
748 | 0 | } |
749 | ||
750 | /** | |
751 | * @see org.kuali.rice.krad.uif.core.Component#getContext() | |
752 | */ | |
753 | public Map<String, Object> getContext() { | |
754 | 0 | return this.context; |
755 | } | |
756 | ||
757 | /** | |
758 | * @see org.kuali.rice.krad.uif.core.Component#setContext(java.util.Map) | |
759 | */ | |
760 | public void setContext(Map<String, Object> context) { | |
761 | 0 | this.context = context; |
762 | 0 | } |
763 | ||
764 | /** | |
765 | * @see org.kuali.rice.krad.uif.core.Component#pushObjectToContext(java.lang.String, | |
766 | * java.lang.Object) | |
767 | */ | |
768 | public void pushObjectToContext(String objectName, Object object) { | |
769 | 0 | if (this.context == null) { |
770 | 0 | this.context = new HashMap<String, Object>(); |
771 | } | |
772 | ||
773 | 0 | this.context.put(objectName, object); |
774 | 0 | } |
775 | ||
776 | public Map<String, String> getPropertyExpressions() { | |
777 | 0 | return propertyExpressions; |
778 | } | |
779 | ||
780 | public void setPropertyExpressions(Map<String, String> propertyExpressions) { | |
781 | 0 | this.propertyExpressions = propertyExpressions; |
782 | 0 | } |
783 | ||
784 | /** | |
785 | * @see org.kuali.rice.krad.uif.core.Component#getPropertyReplacers() | |
786 | */ | |
787 | public List<PropertyReplacer> getPropertyReplacers() { | |
788 | 0 | return this.propertyReplacers; |
789 | } | |
790 | ||
791 | /** | |
792 | * @see org.kuali.rice.krad.uif.core.Component#setPropertyReplacers(java.util.List) | |
793 | */ | |
794 | public void setPropertyReplacers(List<PropertyReplacer> propertyReplacers) { | |
795 | 0 | this.propertyReplacers = propertyReplacers; |
796 | 0 | } |
797 | ||
798 | /** | |
799 | * @see org.springframework.core.Ordered#getOrder() | |
800 | */ | |
801 | public int getOrder() { | |
802 | 0 | return this.order; |
803 | } | |
804 | ||
805 | /** | |
806 | * Setter for the component's order | |
807 | * | |
808 | * @param order | |
809 | */ | |
810 | public void setOrder(int order) { | |
811 | 0 | this.order = order; |
812 | 0 | } |
813 | ||
814 | /** | |
815 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnLoad() | |
816 | */ | |
817 | public boolean getSupportsOnLoad() { | |
818 | 0 | return false; |
819 | } | |
820 | ||
821 | /** | |
822 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnLoadScript() | |
823 | */ | |
824 | public String getOnLoadScript() { | |
825 | 0 | return onLoadScript; |
826 | } | |
827 | ||
828 | /** | |
829 | * Setter for the components onLoad script | |
830 | * | |
831 | * @param onLoadScript | |
832 | */ | |
833 | public void setOnLoadScript(String onLoadScript) { | |
834 | 0 | this.onLoadScript = onLoadScript; |
835 | 0 | } |
836 | ||
837 | /** | |
838 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnDocumentReady() | |
839 | */ | |
840 | public boolean getSupportsOnDocumentReady() { | |
841 | 0 | return true; |
842 | } | |
843 | ||
844 | /** | |
845 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnDocumentReadyScript() | |
846 | */ | |
847 | public String getOnDocumentReadyScript() { | |
848 | 0 | return onDocumentReadyScript; |
849 | } | |
850 | ||
851 | /** | |
852 | * Setter for the components onDocumentReady script | |
853 | * | |
854 | * @param onDocumentReadyScript | |
855 | */ | |
856 | public void setOnDocumentReadyScript(String onDocumentReadyScript) { | |
857 | 0 | this.onDocumentReadyScript = onDocumentReadyScript; |
858 | 0 | } |
859 | ||
860 | /** | |
861 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnUnload() | |
862 | */ | |
863 | public boolean getSupportsOnUnload() { | |
864 | 0 | return false; |
865 | } | |
866 | ||
867 | /** | |
868 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnUnloadScript() | |
869 | */ | |
870 | public String getOnUnloadScript() { | |
871 | 0 | return onUnloadScript; |
872 | } | |
873 | ||
874 | /** | |
875 | * Setter for the components onUnload script | |
876 | * | |
877 | * @param onUnloadScript | |
878 | */ | |
879 | public void setOnUnloadScript(String onUnloadScript) { | |
880 | 0 | this.onUnloadScript = onUnloadScript; |
881 | 0 | } |
882 | ||
883 | /** | |
884 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnClose() | |
885 | */ | |
886 | public boolean getSupportsOnClose() { | |
887 | 0 | return false; |
888 | } | |
889 | ||
890 | /** | |
891 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnCloseScript() | |
892 | */ | |
893 | public String getOnCloseScript() { | |
894 | 0 | return onCloseScript; |
895 | } | |
896 | ||
897 | /** | |
898 | * Setter for the components onClose script | |
899 | * | |
900 | * @param onCloseScript | |
901 | */ | |
902 | public void setOnCloseScript(String onCloseScript) { | |
903 | 0 | this.onCloseScript = onCloseScript; |
904 | 0 | } |
905 | ||
906 | /** | |
907 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnBlur() | |
908 | */ | |
909 | public boolean getSupportsOnBlur() { | |
910 | 0 | return false; |
911 | } | |
912 | ||
913 | /** | |
914 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnBlurScript() | |
915 | */ | |
916 | public String getOnBlurScript() { | |
917 | 0 | return onBlurScript; |
918 | } | |
919 | ||
920 | /** | |
921 | * Setter for the components onBlur script | |
922 | * | |
923 | * @param onBlurScript | |
924 | */ | |
925 | public void setOnBlurScript(String onBlurScript) { | |
926 | 0 | this.onBlurScript = onBlurScript; |
927 | 0 | } |
928 | ||
929 | /** | |
930 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnChange() | |
931 | */ | |
932 | public boolean getSupportsOnChange() { | |
933 | 0 | return false; |
934 | } | |
935 | ||
936 | /** | |
937 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnChangeScript() | |
938 | */ | |
939 | public String getOnChangeScript() { | |
940 | 0 | return onChangeScript; |
941 | } | |
942 | ||
943 | /** | |
944 | * Setter for the components onChange script | |
945 | * | |
946 | * @param onChangeScript | |
947 | */ | |
948 | public void setOnChangeScript(String onChangeScript) { | |
949 | 0 | this.onChangeScript = onChangeScript; |
950 | 0 | } |
951 | ||
952 | /** | |
953 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnClick() | |
954 | */ | |
955 | public boolean getSupportsOnClick() { | |
956 | 0 | return false; |
957 | } | |
958 | ||
959 | /** | |
960 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnClickScript() | |
961 | */ | |
962 | public String getOnClickScript() { | |
963 | 0 | return onClickScript; |
964 | } | |
965 | ||
966 | /** | |
967 | * Setter for the components onClick script | |
968 | * | |
969 | * @param onClickScript | |
970 | */ | |
971 | public void setOnClickScript(String onClickScript) { | |
972 | 0 | this.onClickScript = onClickScript; |
973 | 0 | } |
974 | ||
975 | /** | |
976 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnDblClick() | |
977 | */ | |
978 | public boolean getSupportsOnDblClick() { | |
979 | 0 | return false; |
980 | } | |
981 | ||
982 | /** | |
983 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnDblClickScript() | |
984 | */ | |
985 | public String getOnDblClickScript() { | |
986 | 0 | return onDblClickScript; |
987 | } | |
988 | ||
989 | /** | |
990 | * Setter for the components onDblClick script | |
991 | * | |
992 | * @param onDblClickScript | |
993 | */ | |
994 | public void setOnDblClickScript(String onDblClickScript) { | |
995 | 0 | this.onDblClickScript = onDblClickScript; |
996 | 0 | } |
997 | ||
998 | /** | |
999 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnFocus() | |
1000 | */ | |
1001 | public boolean getSupportsOnFocus() { | |
1002 | 0 | return false; |
1003 | } | |
1004 | ||
1005 | /** | |
1006 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnFocusScript() | |
1007 | */ | |
1008 | public String getOnFocusScript() { | |
1009 | 0 | return onFocusScript; |
1010 | } | |
1011 | ||
1012 | /** | |
1013 | * Setter for the components onFocus script | |
1014 | * | |
1015 | * @param onFocusScript | |
1016 | */ | |
1017 | public void setOnFocusScript(String onFocusScript) { | |
1018 | 0 | this.onFocusScript = onFocusScript; |
1019 | 0 | } |
1020 | ||
1021 | /** | |
1022 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnSubmit() | |
1023 | */ | |
1024 | public boolean getSupportsOnSubmit() { | |
1025 | 0 | return false; |
1026 | } | |
1027 | ||
1028 | /** | |
1029 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnSubmitScript() | |
1030 | */ | |
1031 | public String getOnSubmitScript() { | |
1032 | 0 | return onSubmitScript; |
1033 | } | |
1034 | ||
1035 | /** | |
1036 | * Setter for the components onSubmit script | |
1037 | * | |
1038 | * @param onSubmitScript | |
1039 | */ | |
1040 | public void setOnSubmitScript(String onSubmitScript) { | |
1041 | 0 | this.onSubmitScript = onSubmitScript; |
1042 | 0 | } |
1043 | ||
1044 | /** | |
1045 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnKeyPress() | |
1046 | */ | |
1047 | public boolean getSupportsOnKeyPress() { | |
1048 | 0 | return false; |
1049 | } | |
1050 | ||
1051 | /** | |
1052 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnKeyPressScript() | |
1053 | */ | |
1054 | public String getOnKeyPressScript() { | |
1055 | 0 | return onKeyPressScript; |
1056 | } | |
1057 | ||
1058 | /** | |
1059 | * Setter for the components onKeyPress script | |
1060 | * | |
1061 | * @param onKeyPressScript | |
1062 | */ | |
1063 | public void setOnKeyPressScript(String onKeyPressScript) { | |
1064 | 0 | this.onKeyPressScript = onKeyPressScript; |
1065 | 0 | } |
1066 | ||
1067 | /** | |
1068 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnKeyUp() | |
1069 | */ | |
1070 | public boolean getSupportsOnKeyUp() { | |
1071 | 0 | return false; |
1072 | } | |
1073 | ||
1074 | /** | |
1075 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnKeyUpScript() | |
1076 | */ | |
1077 | public String getOnKeyUpScript() { | |
1078 | 0 | return onKeyUpScript; |
1079 | } | |
1080 | ||
1081 | /** | |
1082 | * Setter for the components onKeyUp script | |
1083 | * | |
1084 | * @param onKeyUpScript | |
1085 | */ | |
1086 | public void setOnKeyUpScript(String onKeyUpScript) { | |
1087 | 0 | this.onKeyUpScript = onKeyUpScript; |
1088 | 0 | } |
1089 | ||
1090 | /** | |
1091 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnKeyDown() | |
1092 | */ | |
1093 | public boolean getSupportsOnKeyDown() { | |
1094 | 0 | return false; |
1095 | } | |
1096 | ||
1097 | /** | |
1098 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnKeyDownScript() | |
1099 | */ | |
1100 | public String getOnKeyDownScript() { | |
1101 | 0 | return onKeyDownScript; |
1102 | } | |
1103 | ||
1104 | /** | |
1105 | * Setter for the components onKeyDown script | |
1106 | * | |
1107 | * @param onKeyDownScript | |
1108 | */ | |
1109 | public void setOnKeyDownScript(String onKeyDownScript) { | |
1110 | 0 | this.onKeyDownScript = onKeyDownScript; |
1111 | 0 | } |
1112 | ||
1113 | /** | |
1114 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnMouseOver() | |
1115 | */ | |
1116 | public boolean getSupportsOnMouseOver() { | |
1117 | 0 | return false; |
1118 | } | |
1119 | ||
1120 | /** | |
1121 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnMouseOverScript() | |
1122 | */ | |
1123 | public String getOnMouseOverScript() { | |
1124 | 0 | return onMouseOverScript; |
1125 | } | |
1126 | ||
1127 | /** | |
1128 | * Setter for the components onMouseOver script | |
1129 | * | |
1130 | * @param onMouseOverScript | |
1131 | */ | |
1132 | public void setOnMouseOverScript(String onMouseOverScript) { | |
1133 | 0 | this.onMouseOverScript = onMouseOverScript; |
1134 | 0 | } |
1135 | ||
1136 | /** | |
1137 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnMouseOut() | |
1138 | */ | |
1139 | public boolean getSupportsOnMouseOut() { | |
1140 | 0 | return false; |
1141 | } | |
1142 | ||
1143 | /** | |
1144 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnMouseOutScript() | |
1145 | */ | |
1146 | public String getOnMouseOutScript() { | |
1147 | 0 | return onMouseOutScript; |
1148 | } | |
1149 | ||
1150 | /** | |
1151 | * Setter for the components onMouseOut script | |
1152 | * | |
1153 | * @param onMouseOutScript | |
1154 | */ | |
1155 | public void setOnMouseOutScript(String onMouseOutScript) { | |
1156 | 0 | this.onMouseOutScript = onMouseOutScript; |
1157 | 0 | } |
1158 | ||
1159 | /** | |
1160 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnMouseUp() | |
1161 | */ | |
1162 | public boolean getSupportsOnMouseUp() { | |
1163 | 0 | return false; |
1164 | } | |
1165 | ||
1166 | /** | |
1167 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnMouseUpScript() | |
1168 | */ | |
1169 | public String getOnMouseUpScript() { | |
1170 | 0 | return onMouseUpScript; |
1171 | } | |
1172 | ||
1173 | /** | |
1174 | * Setter for the components onMouseUp script | |
1175 | * | |
1176 | * @param onMouseUpScript | |
1177 | */ | |
1178 | public void setOnMouseUpScript(String onMouseUpScript) { | |
1179 | 0 | this.onMouseUpScript = onMouseUpScript; |
1180 | 0 | } |
1181 | ||
1182 | /** | |
1183 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnMouseDown() | |
1184 | */ | |
1185 | public boolean getSupportsOnMouseDown() { | |
1186 | 0 | return false; |
1187 | } | |
1188 | ||
1189 | /** | |
1190 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnMouseDownScript() | |
1191 | */ | |
1192 | public String getOnMouseDownScript() { | |
1193 | 0 | return onMouseDownScript; |
1194 | } | |
1195 | ||
1196 | /** | |
1197 | * Setter for the components onMouseDown script | |
1198 | * | |
1199 | * @param onMouseDownScript | |
1200 | */ | |
1201 | public void setOnMouseDownScript(String onMouseDownScript) { | |
1202 | 0 | this.onMouseDownScript = onMouseDownScript; |
1203 | 0 | } |
1204 | ||
1205 | /** | |
1206 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getSupportsOnMouseMove() | |
1207 | */ | |
1208 | public boolean getSupportsOnMouseMove() { | |
1209 | 0 | return false; |
1210 | } | |
1211 | ||
1212 | /** | |
1213 | * @see org.kuali.rice.krad.uif.core.ScriptEventSupport#getOnMouseMoveScript() | |
1214 | */ | |
1215 | public String getOnMouseMoveScript() { | |
1216 | 0 | return onMouseMoveScript; |
1217 | } | |
1218 | ||
1219 | /** | |
1220 | * Setter for the components onMouseMove script | |
1221 | * | |
1222 | * @param onMouseMoveScript | |
1223 | */ | |
1224 | public void setOnMouseMoveScript(String onMouseMoveScript) { | |
1225 | 0 | this.onMouseMoveScript = onMouseMoveScript; |
1226 | 0 | } |
1227 | ||
1228 | /** | |
1229 | * @see org.kuali.rice.krad.uif.widget.Widget#getWidgetOptions() | |
1230 | */ | |
1231 | public Map<String, String> getComponentOptions() { | |
1232 | 0 | if (componentOptions == null) { |
1233 | 0 | componentOptions = new HashMap<String, String>(); |
1234 | } | |
1235 | 0 | return this.componentOptions; |
1236 | } | |
1237 | ||
1238 | /** | |
1239 | * @see org.kuali.rice.krad.uif.widget.Widget#setWidgetOptions(java.util.Map) | |
1240 | */ | |
1241 | public void setComponentOptions(Map<String, String> componentOptions) { | |
1242 | 0 | this.componentOptions = componentOptions; |
1243 | 0 | } |
1244 | ||
1245 | /** | |
1246 | * Builds a string from the underlying <code>Map</code> of component options | |
1247 | * that will export that options as a JavaScript Map for use in js and | |
1248 | * jQuery plugins | |
1249 | * | |
1250 | * @return String of widget options formatted as JS Map | |
1251 | */ | |
1252 | public String getComponentOptionsJSString() { | |
1253 | 0 | if (componentOptions == null) { |
1254 | 0 | componentOptions = new HashMap<String, String>(); |
1255 | } | |
1256 | 0 | StringBuffer sb = new StringBuffer(); |
1257 | ||
1258 | 0 | sb.append("{"); |
1259 | ||
1260 | 0 | for (String optionKey : componentOptions.keySet()) { |
1261 | 0 | String optionValue = componentOptions.get(optionKey); |
1262 | ||
1263 | 0 | if (sb.length() > 1) { |
1264 | 0 | sb.append(","); |
1265 | } | |
1266 | ||
1267 | 0 | sb.append(optionKey); |
1268 | 0 | sb.append(":"); |
1269 | ||
1270 | 0 | boolean isNumber = false; |
1271 | 0 | if (StringUtils.isNotBlank(optionValue) && (StringUtils.isNumeric(optionValue.trim().substring(0, 1)) || |
1272 | optionValue.trim().substring(0, 1).equals("-"))) { | |
1273 | try { | |
1274 | 0 | Double.parseDouble(optionValue.trim()); |
1275 | 0 | isNumber = true; |
1276 | 0 | } catch (NumberFormatException e) { |
1277 | 0 | isNumber = false; |
1278 | 0 | } |
1279 | } | |
1280 | // If an option value starts with { or [, it would be a nested value | |
1281 | // and it should not use quotes around it | |
1282 | 0 | if (StringUtils.startsWith(optionValue, "{") || StringUtils.startsWith(optionValue, "[")) { |
1283 | 0 | sb.append(optionValue); |
1284 | } | |
1285 | // need to be the base boolean value "false" is true in js - a non | |
1286 | // empty string | |
1287 | 0 | else if (optionValue.equalsIgnoreCase("false") || optionValue.equalsIgnoreCase("true")) { |
1288 | 0 | sb.append(optionValue); |
1289 | } | |
1290 | // if it is a call back function, do not add the quotes | |
1291 | 0 | else if (StringUtils.startsWith(optionValue, "function") && StringUtils.endsWith(optionValue, "}")) { |
1292 | 0 | sb.append(optionValue); |
1293 | } | |
1294 | // for numerics | |
1295 | 0 | else if (isNumber) { |
1296 | 0 | sb.append(optionValue); |
1297 | } else { | |
1298 | 0 | sb.append("\"" + optionValue + "\""); |
1299 | } | |
1300 | 0 | } |
1301 | ||
1302 | 0 | sb.append("}"); |
1303 | ||
1304 | 0 | return sb.toString(); |
1305 | } | |
1306 | ||
1307 | public String getEventCode() { | |
1308 | 0 | String eventCode = ""; |
1309 | ||
1310 | 0 | return eventCode; |
1311 | } | |
1312 | ||
1313 | /** | |
1314 | * When set if the condition is satisfied, the component will be displayed. | |
1315 | * The component MUST BE a container or field type. progressiveRender is | |
1316 | * defined in a limited Spring EL syntax. Only valid form property names, | |
1317 | * and, or, logical comparison operators (non-arithmetic), and the matches | |
1318 | * clause are allowed. String and regex values must use single quotes ('), | |
1319 | * booleans must be either true or false, numbers must be a valid double, | |
1320 | * either negative or positive. <br> | |
1321 | * DO NOT use progressiveRender and conditionalRefresh on the same component | |
1322 | * unless it is known that the component will always be visible in all cases | |
1323 | * when a conditionalRefresh happens (ie conditionalRefresh has | |
1324 | * progressiveRender's condition anded with its own condition). <b>If a | |
1325 | * component should be refreshed every time it is shown, use the | |
1326 | * progressiveRenderAndRefresh option with this property instead.</b> | |
1327 | * | |
1328 | * @return the progressiveRender | |
1329 | */ | |
1330 | public String getProgressiveRender() { | |
1331 | 0 | return this.progressiveRender; |
1332 | } | |
1333 | ||
1334 | /** | |
1335 | * @param progressiveRender the progressiveRender to set | |
1336 | */ | |
1337 | public void setProgressiveRender(String progressiveRender) { | |
1338 | 0 | this.progressiveRender = progressiveRender; |
1339 | 0 | } |
1340 | ||
1341 | /** | |
1342 | * When set if the condition is satisfied, the component will be refreshed. | |
1343 | * The component MUST BE a container or field type. conditionalRefresh is | |
1344 | * defined in a limited Spring EL syntax. Only valid form property names, | |
1345 | * and, or, logical comparison operators (non-arithmetic), and the matches | |
1346 | * clause are allowed. String and regex values must use single quotes ('), | |
1347 | * booleans must be either true or false, numbers must be a valid double | |
1348 | * either negative or positive. <br> | |
1349 | * DO NOT use progressiveRender and conditionalRefresh on the same component | |
1350 | * unless it is known that the component will always be visible in all cases | |
1351 | * when a conditionalRefresh happens (ie conditionalRefresh has | |
1352 | * progressiveRender's condition anded with its own condition). <b>If a | |
1353 | * component should be refreshed every time it is shown, use the | |
1354 | * progressiveRenderAndRefresh option with this property instead.</b> | |
1355 | * | |
1356 | * @return the conditionalRefresh | |
1357 | */ | |
1358 | public String getConditionalRefresh() { | |
1359 | 0 | return this.conditionalRefresh; |
1360 | } | |
1361 | ||
1362 | /** | |
1363 | * @param conditionalRefresh the conditionalRefresh to set | |
1364 | */ | |
1365 | public void setConditionalRefresh(String conditionalRefresh) { | |
1366 | 0 | this.conditionalRefresh = conditionalRefresh; |
1367 | 0 | } |
1368 | ||
1369 | /** | |
1370 | * Control names used to control progressive disclosure, set internally | |
1371 | * cannot be set. | |
1372 | * | |
1373 | * @return the progressiveDisclosureControlNames | |
1374 | */ | |
1375 | public List<String> getProgressiveDisclosureControlNames() { | |
1376 | 0 | return this.progressiveDisclosureControlNames; |
1377 | } | |
1378 | ||
1379 | /** | |
1380 | * The condition to show this component progressively converted to a js | |
1381 | * expression, set internally cannot be set. | |
1382 | * | |
1383 | * @return the progressiveDisclosureConditionJs | |
1384 | */ | |
1385 | public String getProgressiveDisclosureConditionJs() { | |
1386 | 0 | return this.progressiveDisclosureConditionJs; |
1387 | } | |
1388 | ||
1389 | /** | |
1390 | * The condition to refresh this component converted to a js expression, set | |
1391 | * internally cannot be set. | |
1392 | * | |
1393 | * @return the conditionalRefreshConditionJs | |
1394 | */ | |
1395 | public String getConditionalRefreshConditionJs() { | |
1396 | 0 | return this.conditionalRefreshConditionJs; |
1397 | } | |
1398 | ||
1399 | /** | |
1400 | * Control names used to control conditional refresh, set internally cannot | |
1401 | * be set. | |
1402 | * | |
1403 | * @return the conditionalRefreshControlNames | |
1404 | */ | |
1405 | public List<String> getConditionalRefreshControlNames() { | |
1406 | 0 | return this.conditionalRefreshControlNames; |
1407 | } | |
1408 | ||
1409 | /** | |
1410 | * When progressiveRenderViaAJAX is true, this component will be retrieved | |
1411 | * from the server when it first satisfies its progressive render condition. | |
1412 | * After the first retrieval, it is hidden/shown in the html by the js when | |
1413 | * its progressive condition result changes. <b>By default, this is false, | |
1414 | * so components with progressive render capabilities will always be already | |
1415 | * within the client html and toggled to be hidden or visible.</b> | |
1416 | * | |
1417 | * @return the progressiveRenderViaAJAX | |
1418 | */ | |
1419 | public boolean isProgressiveRenderViaAJAX() { | |
1420 | 0 | return this.progressiveRenderViaAJAX; |
1421 | } | |
1422 | ||
1423 | /** | |
1424 | * @param progressiveRenderViaAJAX the progressiveRenderViaAJAX to set | |
1425 | */ | |
1426 | public void setProgressiveRenderViaAJAX(boolean progressiveRenderViaAJAX) { | |
1427 | 0 | this.progressiveRenderViaAJAX = progressiveRenderViaAJAX; |
1428 | 0 | } |
1429 | ||
1430 | /** | |
1431 | * If true, when the progressiveRender condition is satisfied, the component | |
1432 | * will always be retrieved from the server and shown(as opposed to being | |
1433 | * stored on the client, but hidden, after the first retrieval as is the | |
1434 | * case with the progressiveRenderViaAJAX option). <b>By default, this is | |
1435 | * false, so components with progressive render capabilities will always be | |
1436 | * already within the client html and toggled to be hidden or visible.</b> | |
1437 | * | |
1438 | * @return the progressiveRenderAndRefresh | |
1439 | */ | |
1440 | public boolean isProgressiveRenderAndRefresh() { | |
1441 | 0 | return this.progressiveRenderAndRefresh; |
1442 | } | |
1443 | ||
1444 | /** | |
1445 | * @param progressiveRenderAndRefresh the progressiveRenderAndRefresh to set | |
1446 | */ | |
1447 | public void setProgressiveRenderAndRefresh(boolean progressiveRenderAndRefresh) { | |
1448 | 0 | this.progressiveRenderAndRefresh = progressiveRenderAndRefresh; |
1449 | 0 | } |
1450 | ||
1451 | /** | |
1452 | * Specifies a property by name that when it value changes will | |
1453 | * automatically perform a refresh on this component. This can be a comma | |
1454 | * separated list of multiple properties that require this component to be | |
1455 | * refreshed when any of them change. <Br>DO NOT use with progressiveRender | |
1456 | * unless it is know that progressiveRender condition will always be | |
1457 | * satisfied before one of these fields can be changed. | |
1458 | * | |
1459 | * @return the refreshWhenChanged | |
1460 | */ | |
1461 | public String getRefreshWhenChanged() { | |
1462 | 0 | return this.refreshWhenChanged; |
1463 | } | |
1464 | ||
1465 | /** | |
1466 | * @param refreshWhenChanged the refreshWhenChanged to set | |
1467 | */ | |
1468 | public void setRefreshWhenChanged(String refreshWhenChanged) { | |
1469 | 0 | this.refreshWhenChanged = refreshWhenChanged; |
1470 | 0 | } |
1471 | ||
1472 | /** | |
1473 | * Control names which will refresh this component when they are changed, added | |
1474 | * internally | |
1475 | * | |
1476 | * @return the refreshWhenChangedControlNames | |
1477 | */ | |
1478 | public List<String> getRefreshWhenChangedControlNames() { | |
1479 | 0 | return this.refreshWhenChangedControlNames; |
1480 | } | |
1481 | ||
1482 | /** | |
1483 | * @return the refresh | |
1484 | */ | |
1485 | public boolean isRefresh() { | |
1486 | 0 | return this.refresh; |
1487 | } | |
1488 | ||
1489 | /** | |
1490 | * @param refresh the refresh to set | |
1491 | */ | |
1492 | public void setRefresh(boolean refresh) { | |
1493 | 0 | this.refresh = refresh; |
1494 | 0 | } |
1495 | ||
1496 | /** | |
1497 | * @param setter for the skipInTabOrder flag | |
1498 | */ | |
1499 | public void setSkipInTabOrder(boolean skipInTabOrder) { | |
1500 | 0 | this.skipInTabOrder = skipInTabOrder; |
1501 | 0 | } |
1502 | ||
1503 | /** | |
1504 | * Flag indicating that this component and its nested components must be | |
1505 | * skipped when keyboard tabbing. | |
1506 | * | |
1507 | * @return the skipInTabOrder flag | |
1508 | */ | |
1509 | public boolean isSkipInTabOrder() { | |
1510 | 0 | return skipInTabOrder; |
1511 | } | |
1512 | ||
1513 | /** | |
1514 | * The original generated id. During the component lifecycle the id may get manipulated | |
1515 | * and changed based on the type of component it is. This id represents the original id | |
1516 | * assigned before any additional suffixes were appended. | |
1517 | * | |
1518 | * @return the baseId | |
1519 | */ | |
1520 | public String getBaseId() { | |
1521 | 0 | return this.baseId; |
1522 | } | |
1523 | ||
1524 | /** | |
1525 | * @param baseId the baseId to set | |
1526 | */ | |
1527 | public void setBaseId(String baseId) { | |
1528 | 0 | this.baseId = baseId; |
1529 | 0 | } |
1530 | } |