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