1 /**
2 * Copyright 2005-2014 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.uif.component;
17
18 import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean;
19 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
20 import org.kuali.rice.krad.uif.layout.CssGridSizes;
21 import org.kuali.rice.krad.uif.lifecycle.RunComponentModifiersTask;
22 import org.kuali.rice.krad.uif.modifier.ComponentModifier;
23 import org.kuali.rice.krad.uif.util.LifecycleElement;
24 import org.kuali.rice.krad.uif.widget.Tooltip;
25
26 import java.io.Serializable;
27 import java.util.List;
28 import java.util.Map;
29
30 /**
31 * Component defines basic properties and methods that all rendering element implement
32 *
33 * <p>
34 * All classes of the UIF that are used as a rendering element implement the
35 * component interface. All components within the framework have the
36 * following structure:
37 * <ul>
38 * <li>Dictionary Configuration/Composition</li>
39 * <li>Java Class (the Component implementation</li>
40 * <li>>JSP Template Renderer</li>
41 * </ul>
42 * </p>
43 * <p>
44 * There are three basic types of components:
45 * <ul>
46 * <li>Container Components: {@code View}, {@code Group}</li>
47 * <li>Field Components: {@code Field}</li>
48 * <li>Widget Components: {@code Widget}</li>
49 * </ul>
50 * </p>
51 *
52 * @author Kuali Rice Team (rice.collab@kuali.org)
53 * @see org.kuali.rice.krad.uif.container.Container
54 * @see org.kuali.rice.krad.uif.field.Field
55 * @see org.kuali.rice.krad.uif.widget.Widget
56 */
57 public interface Component extends UifDictionaryBean, LifecycleElement, Serializable, Ordered, ScriptEventSupport {
58
59 /**
60 * The name for the component type
61 *
62 * <p>
63 * This is used within the rendering layer to pass the component instance into the template. The component instance
64 * is exported under the name given by this method.
65 * </p>
66 *
67 * @return String type name
68 */
69 String getComponentTypeName();
70
71 /**
72 * Indicates whether the component has been fully rendered.
73 *
74 * @return True if the component has fully rendered, false if not.
75 */
76 boolean isRendered();
77
78 /**
79 * Invoked by the view lifecycle after expressions are evaluated at the apply model phase.
80 *
81 * <p>
82 * In general, this method is preferred to {@link #performApplyModel(Object, LifecycleElement)}
83 * for populating model data via code, since it is called before client-side state is synchronize.
84 * </p>
85 */
86 void afterEvaluateExpression();
87
88 /**
89 * Set the view lifecycle processing status for this component, explicitly.
90 *
91 * @param status The view status for this component.
92 */
93 void setViewStatus(String status);
94
95 /**
96 * The path to the JSP file that should be called to render the component
97 *
98 * <p>
99 * The path should be relative to the web root. An attribute will be available to the component to use under the
100 * name given by the method {@code getComponentTypeName}. Based on the component type, additional attributes could
101 * be available for use. See the component documentation for more information on such attributes.
102 * </p>
103 *
104 * <p>
105 * e.g. '/krad/WEB-INF/jsp/tiles/component.jsp'
106 * </p>
107 *
108 * @return String representing the template path
109 */
110 String getTemplate();
111
112 /**
113 * Setter for the components template
114 *
115 * @param template
116 */
117 void setTemplate(String template);
118
119 /**
120 * Gets additional templates that will be required during the rendering of this component.
121 *
122 * <p>
123 * If a parent or sibling component is referred to by this component's template,
124 * include that component's template here to ensure that it has been compiled already during
125 * bottom-up inline rendering.
126 * </p>
127 *
128 * @return additional templates required during rendering
129 */
130 List<String> getAdditionalTemplates();
131
132 /**
133 * The name for which the template can be invoked by
134 *
135 * <p>
136 * Whether the template name is needed depends on the underlying rendering engine being used. In the example of
137 * Freemarker, the template points to the actual source file, which then loads a macro. From then on the macro is
138 * simply invoked to execute the template
139 * </p>
140 *
141 * <p>
142 * e.g. 'uif_text'
143 * </p>
144 *
145 * @return template name
146 */
147 public String getTemplateName();
148
149 /**
150 * Setter for the name of the template (a name which can be used to invoke)
151 *
152 * @param templateName
153 */
154 public void setTemplateName(String templateName);
155
156 /**
157 * The component title
158 *
159 * <p>
160 * Depending on the component can be used in various ways. For example with a Container component the title is
161 * used to set the header text. For components like controls other other components that render an HTML element it
162 * is used to set the HTML title attribute.
163 * </p>
164 *
165 * @return String title for component
166 */
167 String getTitle();
168
169 /**
170 * Setter for the component's title
171 *
172 * @param title
173 */
174 void setTitle(String title);
175
176 /**
177 * List of components that are contained within the List of {@code PropertyReplacer} in component
178 *
179 * <p>
180 * Used to get all the nested components in the property replacers.
181 * </p>
182 *
183 * @return List<Component> {@code PropertyReplacer} child components
184 */
185 List<Component> getPropertyReplacerComponents();
186
187 /**
188 * {@code ComponentModifier} instances that should be invoked to
189 * initialize the component
190 *
191 * <p>
192 * These provide dynamic initialization behavior for the component and are
193 * configured through the components definition. Each initializer will get
194 * invoked by the initialize method.
195 * </p>
196 *
197 * @return List of component modifiers
198 * @see RunComponentModifiersTask
199 */
200 List<ComponentModifier> getComponentModifiers();
201
202 /**
203 * Setter for the components List of {@code ComponentModifier}
204 * instances
205 *
206 * @param componentModifiers
207 */
208 void setComponentModifiers(List<ComponentModifier> componentModifiers);
209
210 /**
211 * When true, this component will render as a placeholder component instead of rendering normally because the
212 * content will be later retrieved through manually ajax retrieval calls in the js
213 *
214 * <p>This flag does not imply any automation, there must be a js call invoked for the content to be retrieved
215 * by the server, but this does mark it with a placeholder component which KRAD js uses during these calls.
216 * This placeholder component is used for ajax retrievals. In particular, this flag is useful for use in
217 * combination with the <b>showLightboxComponent</b> js function which will automatically retrieve the
218 * real content of a component through ajax if a placeholder component is detected. This allows for the full
219 * content to only be retrieved when the lightbox is first opened.
220 * When this flag is set to true, the forceSessionPersistence
221 * flag is set to true AUTOMATICALLY because it is implied that this component will be retrieved by an ajax call
222 * in the future. This may also be useful for direct custom calls to <b>retrieveComponent</b> function,
223 * as well, which also relies on the placeholder being present.</p>
224 *
225 * @return true if this component is being rendered as a placeholder for use in replacement during and ajax call,
226 * false otherwise
227 */
228 public boolean isRetrieveViaAjax();
229
230 /**
231 * When true, this component will render as a placeholder component instead of rendering normally because the
232 * content will be later retrieved through manually ajax retrieval calls in the js
233 *
234 * @param useAjaxCallForContent
235 */
236 public void setRetrieveViaAjax(boolean useAjaxCallForContent);
237
238 /**
239 * Indicates whether the component should be hidden in the UI
240 *
241 * <p>
242 * How the hidden data is maintained depends on the views persistence mode.
243 * If the mode is request, the corresponding data will be rendered to the UI
244 * but not visible. If the mode is session, the data will not be rendered to
245 * the UI but maintained server side.
246 * </p>
247 *
248 * <p>
249 * For a {@code Container} component, the hidden setting will apply to
250 * all contained components (making a section hidden makes all fields within
251 * the section hidden)
252 * </p>
253 *
254 * @return boolean true if the component should be hidden, false if it
255 * should be visible
256 */
257 boolean isHidden();
258
259 /**
260 * Setter for the hidden indicator
261 *
262 * @param hidden
263 */
264 void setHidden(boolean hidden);
265
266 /**
267 * Indicates whether the component can be edited
268 *
269 * <p>
270 * When readOnly the controls and widgets of {@code Field} components
271 * will not be rendered. If the Field has an underlying value it will be
272 * displayed readOnly to the user.
273 * </p>
274 *
275 * <p>
276 * For a {@code Container} component, the readOnly setting will apply
277 * to all contained components (making a section readOnly makes all fields
278 * within the section readOnly).
279 * </p>
280 *
281 * @return boolean true if the component should be readOnly, false if is
282 * allows editing
283 */
284 Boolean getReadOnly();
285
286 /**
287 * Setter for the read only indicator
288 *
289 * @param readOnly
290 */
291 void setReadOnly(Boolean readOnly);
292
293 /**
294 * Indicates whether the component is required
295 *
296 * <p>
297 * At the general component level required means there is some action the
298 * user needs to take within the component. For example, within a section it
299 * might mean the fields within the section should be completed. At a field
300 * level, it means the field should be completed. This provides the ability
301 * for the renderers to indicate the required action.
302 * </p>
303 *
304 * @return boolean true if the component is required, false if it is not
305 * required
306 */
307 Boolean getRequired();
308
309 /**
310 * Setter for the required indicator
311 *
312 * @param required
313 */
314 void setRequired(Boolean required);
315
316 /**
317 * Horizontal alignment of the component within its container
318 *
319 * <p>
320 * All components belong to a <code>Container</code> and are placed using a
321 * <code>LayoutManager</code>. This property specifies how the component
322 * should be aligned horizontally within the container. During the finalize
323 * phase the CSS text-align style will be created for the align setting.
324 * </p>
325 *
326 * @return String horizontal align
327 * @see org.kuali.rice.krad.uif.CssConstants.TextAligns
328 */
329 public String getAlign();
330
331 /**
332 * Sets the components horizontal alignment
333 *
334 * @param align
335 */
336 public void setAlign(String align);
337
338 /**
339 * Vertical alignment of the component within its container
340 *
341 * <p>
342 * All components belong to a <code>Container</code> and are placed using a
343 * <code>LayoutManager</code>. This property specifies how the component
344 * should be aligned vertically within the container. During the finalize
345 * phase the CSS vertical-align style will be created for the valign
346 * setting.
347 * </p>
348 *
349 * @return String vertical align
350 * @see org.kuali.rice.krad.uif.CssConstants.VerticalAligns
351 */
352 public String getValign();
353
354 /**
355 * Setter for the component's vertical align
356 *
357 * @param valign
358 */
359 public void setValign(String valign);
360
361 /**
362 * Width the component should take up in the container
363 *
364 * <p>
365 * All components belong to a <code>Container</code> and are placed using a
366 * <code>LayoutManager</code>. This property specifies a width the component
367 * should take up in the Container. This is not applicable for all layout
368 * managers. During the finalize phase the CSS width style will be created
369 * for the width setting.
370 * </p>
371 *
372 * <p>
373 * e.g. '30%', '55px'
374 * </p>
375 *
376 * @return String width string
377 */
378 public String getWidth();
379
380 /**
381 * Setter for the components width
382 *
383 * @param width
384 */
385 public void setWidth(String width);
386
387 /**
388 * CSS style string to be applied to the component
389 *
390 * <p>
391 * Any style override or additions can be specified with this attribute.
392 * This is used by the renderer to set the style attribute on the
393 * corresponding element.
394 * </p>
395 *
396 * <p>
397 * e.g. 'color: #000000;text-decoration: underline;'
398 * </p>
399 *
400 * @return String css style string
401 */
402 String getStyle();
403
404 /**
405 * Setter for the components style
406 *
407 * @param style
408 */
409 void setStyle(String style);
410
411 public List<String> getLibraryCssClasses();
412
413 public void setLibraryCssClasses(List<String> libraryCssClasses);
414
415 /**
416 * CSS style class(s) to be applied to the component
417 *
418 * <p>
419 * Declares style classes for the component. Multiple classes are specified
420 * with a space delimiter. This is used by the renderer to set the class
421 * attribute on the corresponding element. The class(s) declared must be
422 * available in the common style sheets or the style sheets specified for
423 * the view
424 * </p>
425 *
426 * @return List<String> css style classes to appear on the 'class' attribute
427 */
428 List<String> getCssClasses();
429
430 /**
431 * Setter for the components style classes
432 *
433 * @param styleClasses
434 */
435 void setCssClasses(List<String> styleClasses);
436
437 /**
438 * Convenience property for adding css class names to the end of the list of cssClasses that may already exist on
439 * this Component (this is to avoid explicitly having to set list merge in the bean definition)
440 *
441 * @return the additionalCssClasses
442 */
443 List<String> getAdditionalCssClasses();
444
445 /**
446 * Set the additionalCssClasses
447 *
448 * @param styleClasses
449 */
450 void setAdditionalCssClasses(List<String> styleClasses);
451
452 /**
453 * Adds a single style to the list of styles on this component
454 *
455 * @param styleClass
456 */
457 void addStyleClass(String styleClass);
458
459 /**
460 * Appends to the inline style set on a component
461 *
462 * @param itemStyle
463 */
464 void appendToStyle(String itemStyle);
465
466 /**
467 * Number of places the component should take up horizontally in the
468 * container; when using a CssGridLayoutManager this is converted to the appropriate medium size.
469 *
470 * <p>
471 * All components belong to a {@code Container} and are placed using a
472 * {@code LayoutManager}. This property specifies how many places
473 * horizontally the component should take up within the container. This is
474 * only applicable for table based layout managers. Default is 1
475 * </p>
476 *
477 * TODO: this should not be on component interface since it only applies if
478 * the layout manager supports it, need some sort of layoutOptions map for
479 * field level options that depend on the manager
480 *
481 * @return int number of columns to span
482 */
483 int getColSpan();
484
485 /**
486 * Setter for the components column span
487 *
488 * @param colSpan
489 */
490 void setColSpan(int colSpan);
491
492 /**
493 * Number of places the component should take up vertically in the container
494 *
495 * <p>
496 * All components belong to a {@code Container} and are placed using a
497 * {@code LayoutManager}. This property specifies how many places
498 * vertically the component should take up within the container. This is
499 * only applicable for table based layout managers. Default is 1
500 * </p>
501 *
502 * TODO: this should not be on component interface since it only applies if
503 * the layout manager supports it, need some sort of layoutOptions map for
504 * field level options that depend on the manager
505 *
506 * @return int number of rows to span
507 */
508 int getRowSpan();
509
510 /**
511 * Setter for the component row span
512 *
513 * @param rowSpan
514 */
515 void setRowSpan(int rowSpan);
516
517 /**
518 * The cellCssClasses property defines the classes that will be placed on the corresponding td (or th) elements
519 * relating to this component when used in a table backed layout. This property has no effect on other layouts.
520 *
521 * @return the css classes to apply to the wrapping td (or th) element for this component
522 */
523 public List<String> getWrapperCssClasses();
524
525 /**
526 * Set the cellCssClasses property which defines the classes that will be placed on the corresponding td (or th)
527 * relating to this component when used in a table backed layout. This property has no effect on other layouts.
528 *
529 * @param cellCssClasses
530 */
531 public void setWrapperCssClasses(List<String> cellCssClasses);
532
533 /**
534 * Add a cell css class to the cell classes list
535 *
536 * @param cssClass the name of the class to add
537 */
538 public void addWrapperCssClass(String cssClass);
539
540 /**
541 * CSS style string to be applied to the cell containing the component (only applies within
542 * table based layouts)
543 *
544 * <p>
545 * e.g. 'align: right;'
546 * </p>
547 *
548 * @return String css style string
549 */
550 public String getWrapperStyle();
551
552 /**
553 * Setter for the cell style attribute
554 *
555 * @param cellStyle
556 */
557 public void setWrapperStyle(String cellStyle);
558
559 /**
560 * Width setting for the cell containing the component (only applies within table based
561 * layouts)
562 *
563 * @return String width ('25%', '155px')
564 */
565 public String getCellWidth();
566
567 /**
568 * Setter for the containing cell width
569 *
570 * @param cellWidth
571 */
572 public void setCellWidth(String cellWidth);
573
574 /**
575 * CssGridSizes represent the size (width) the content's div "cell" will take up in the "row" at each screen
576 * size (extra small, small, medium, large) when using a group backed by a CssGridLayoutManager.
577 *
578 * <p>
579 * This object is NOT used by other layouts.
580 * For specifics of how css grids work, refer to the krad guide and bootstrap css grid documentation.
581 * </p>
582 *
583 * @return
584 */
585 public CssGridSizes getCssGridSizes();
586
587 /**
588 * @see org.kuali.rice.krad.uif.component.Component#getCssGridSizes()
589 */
590 public void setCssGridSizes(CssGridSizes cssGridSizes);
591
592 /**
593 * Context map for the component
594 *
595 * <p>
596 * Any el statements configured for the components properties (e.g.
597 * title="@{foo.property}") are evaluated using the el context map. This map
598 * will get populated with default objects like the model, view, and request
599 * from the {@code ViewHelperService}. Other components can push
600 * further objects into the context so that they are available for use with
601 * that component. For example, {@code Field} instances that are part
602 * of a collection line as receive the current line instance
603 * </p>
604 *
605 * <p>
606 * Context map also provides objects to methods that are invoked for
607 * {@code GeneratedField} instances
608 * </p>
609 *
610 * <p>
611 * The Map key gives the name of the variable that can be used within
612 * expressions, and the Map value gives the object instance for which
613 * expressions containing the variable should evaluate against
614 * </p>
615 *
616 * <p>
617 * NOTE: Calling getContext().putAll() will skip updating any configured property replacers for the
618 * component. Instead you should call #pushAllToContextDeep
619 * </p>
620 *
621 * @return Map<String, Object> context
622 */
623 Map<String, Object> getContext();
624
625 /**
626 * Setter for the context Map
627 *
628 * @param context
629 */
630 void setContext(Map<String, Object> context);
631
632 /**
633 * gets a list of {@code PropertyReplacer} instances
634 *
635 * <p>They will be evaluated
636 * during the view lifecycle to conditionally set properties on the
637 * {@code Component} based on expression evaluations</p>
638 *
639 * @return List<PropertyReplacer> replacers to evaluate
640 */
641 List<PropertyReplacer> getPropertyReplacers();
642
643 /**
644 * Setter for the components property substitutions
645 *
646 * @param propertyReplacers
647 */
648 void setPropertyReplacers(List<PropertyReplacer> propertyReplacers);
649
650 /**
651 * The options that are passed through to the Component renderer
652 *
653 * <p>
654 * The Map key is the option name, with the Map value as the option value. See
655 * documentation on the particular widget render for available options.
656 * </p>
657 *
658 * @return Map<String, String> options
659 */
660 Map<String, String> getTemplateOptions();
661
662 /**
663 * Setter for the template's options
664 *
665 * @param templateOptions
666 */
667 void setTemplateOptions(Map<String, String> templateOptions);
668
669 /**
670 * Builds a string from the underlying <code>Map</code> of template options that will export that options as a
671 * JavaScript Map for use in js and jQuery plugins
672 *
673 * <p>
674 * See documentation on the particular component render for available options.
675 * </p>
676 *
677 * @return String options
678 */
679 String getTemplateOptionsJSString();
680
681 /**
682 * Setter for the template's options
683 *
684 * @param templateOptionsJSString
685 */
686 void setTemplateOptionsJSString(String templateOptionsJSString);
687
688 /**
689 * Order of a component within a List of other components
690 *
691 * <p>Lower numbers are placed higher up in the list, while higher numbers are placed
692 * lower in the list</p>
693 *
694 * @return int ordering number
695 * @see org.springframework.core.Ordered#getOrder()
696 */
697 int getOrder();
698
699 /**
700 * Setter for the component's order
701 *
702 * @param order
703 */
704 void setOrder(int order);
705
706 /**
707 * The Tooltip widget that renders a tooltip with additional information about the element on
708 * specified trigger event
709 *
710 * @return Tooltip
711 */
712 Tooltip getToolTip();
713
714 /**
715 * Setter for the component tooltip widget instance
716 *
717 * @param toolTip
718 */
719 void setToolTip(Tooltip toolTip);
720
721 /**
722 * String containing JavaScript code for registering event handlers for this component
723 * (blur, focus, click, etc.)
724 *
725 * @return JS event handler script
726 */
727 public String getEventHandlerScript();
728
729 /**
730 * The name of the method that should be invoked for finalizing the component
731 * configuration (full method name, without parameters or return type)
732 *
733 * <p>
734 * Note the method can also be set with the finalizeMethodInvoker
735 * targetMethod property. If the method is on the configured
736 * {@code ViewHelperService}, only this property needs to be configured
737 * </p>
738 *
739 * <p>
740 * The model backing the view will be passed as the first argument method and then
741 * the {@code Component} instance as the second argument. If any additional method
742 * arguments are declared with the finalizeMethodAdditionalArguments, they will then
743 * be passed in the order declared in the list
744 * </p>
745 *
746 * <p>
747 * If the component is selfRendered, the finalize method can return a string which
748 * will be set as the component's renderOutput. The selfRendered indicator will also
749 * be set to true on the component.
750 * </p>
751 *
752 * @return String method name
753 */
754 String getFinalizeMethodToCall();
755
756 /**
757 * The List of Object instances that should be passed as arguments to the finalize method
758 *
759 * <p>
760 * These arguments are passed to the finalize method after the standard model and component
761 * arguments. They are passed in the order declared in the list
762 * </p>
763 *
764 * @return List<Object> additional method arguments
765 */
766 List<Object> getFinalizeMethodAdditionalArguments();
767
768 /**
769 * {@code MethodInvokerConfig} instance for the method that should be invoked
770 * for finalizing the component configuration
771 *
772 * <p>
773 * MethodInvoker can be configured to specify the class or object the method
774 * should be called on. For static method invocations, the targetClass
775 * property can be configured. For object invocations, that targetObject
776 * property can be configured
777 * </p>
778 *
779 * <p>
780 * If the component is selfRendered, the finalize method can return a string which
781 * will be set as the component's renderOutput. The selfRendered indicator will also
782 * be set to true on the component.
783 * </p>
784 *
785 * @return MethodInvokerConfig instance
786 */
787 MethodInvokerConfig getFinalizeMethodInvoker();
788
789 /**
790 * Indicates whether the component contains its own render output (through
791 * the renderOutput property)
792 *
793 * <p>
794 * If self rendered is true, the corresponding template for the component
795 * will not be invoked and the renderOutput String will be written to the
796 * response as is.
797 * </p>
798 *
799 * @return boolean true if component is self rendered, false if not (renders
800 * through template)
801 */
802 boolean isSelfRendered();
803
804 /**
805 * Setter for the self render indicator
806 *
807 * @param selfRendered
808 */
809 void setSelfRendered(boolean selfRendered);
810
811 /**
812 * Rendering output for the component that will be sent as part of the
813 * response (can contain static text and HTML)
814 *
815 * @return String render output
816 */
817 String getRenderedHtmlOutput();
818
819 /**
820 * Setter for the component's render output
821 *
822 * @param renderOutput
823 */
824 void setRenderedHtmlOutput(String renderOutput);
825
826 /**
827 * Disables the storage of the component in session (when the framework determines it needs to be due to a
828 * refresh condition)
829 *
830 * <p>
831 * When the framework determines there is a condition on the component that requires it to keep around between
832 * posts, it will store the component instance in session. This flag can be set to disable this behavior (which
833 * would require custom application logic to support behavior such as refresh)
834 * </p>
835 *
836 * @return boolean true if the component should not be stored in session, false if session storage is allowed
837 */
838 boolean isDisableSessionPersistence();
839
840 /**
841 * Setter for disabling storage of the component in session
842 *
843 * @param disableSessionPersistence
844 */
845 void setDisableSessionPersistence(boolean disableSessionPersistence);
846
847 /**
848 * Indicates whether the component should be stored with the session view regardless of configuration
849 *
850 * <p>
851 * By default the framework nulls out any components that do not have a refresh condition or are needed for
852 * collection processing. This can be a problem if custom application code is written to refresh a component
853 * without setting the corresponding component flag. In this case this property can be set to true to force the
854 * framework to keep the component in session. Defaults to false
855 * </p>
856 *
857 * @return boolean true if the component should be stored in session, false if not
858 */
859 boolean isForceSessionPersistence();
860
861 /**
862 * Setter for the indicator to force persistence of the component in session
863 *
864 * @param persistInSession
865 */
866 void setForceSessionPersistence(boolean persistInSession);
867
868 /**
869 * Security object that indicates what authorization (permissions) exist for the component
870 *
871 * @return ComponentSecurity instance
872 */
873 ComponentSecurity getComponentSecurity();
874
875 /**
876 * Setter for the components security object
877 *
878 * @param componentSecurity
879 */
880 void setComponentSecurity(ComponentSecurity componentSecurity);
881
882 /**
883 * Spring EL expression, which when evaluates to true, makes this component visible
884 *
885 * @return the SpEl expression string
886 */
887 String getProgressiveRender();
888
889 /**
890 * Setter for progressiveRender Spring EL expression
891 *
892 * @param progressiveRender the progressiveRender to set
893 */
894 void setProgressiveRender(String progressiveRender);
895
896 /**
897 * Spring EL expression, which when evaluates to true, causes this component to be refreshed
898 *
899 * @return the SpEl expression string
900 */
901 String getConditionalRefresh();
902
903 /**
904 * Setter for conditionalRefresh Spring EL expression
905 *
906 * @param conditionalRefresh the conditionalRefresh to set
907 */
908 void setConditionalRefresh(String conditionalRefresh);
909
910 /**
911 * List of control names (ids) extracted from {@link #getProgressiveRender()}
912 *
913 * @return the list of control names
914 */
915 List<String> getProgressiveDisclosureControlNames();
916
917 /**
918 * A JavaScript expression constructed from {@link #getConditionalRefresh()}
919 *
920 * <p>The script can be executed on the client to determine if the original exp was satisfied before
921 * interacting with the server.</p>
922 *
923 * @return the JS script
924 */
925 String getProgressiveDisclosureConditionJs();
926
927 /**
928 * A JavaScript expression constructed from {@link #getProgressiveRender()}
929 *
930 * <p>The script can be executed on the client to determine if the original exp was satisfied before
931 * interacting with the server.</p>
932 *
933 * @return the JS script
934 */
935 String getConditionalRefreshConditionJs();
936
937 /**
938 * The list of control names (ids) extracted from {@link #getConditionalRefresh()}
939 *
940 * @return the list of control names
941 */
942 List<String> getConditionalRefreshControlNames();
943
944 /**
945 * Indicates whether the component will be stored on the client, but hidden, after the first retrieval
946 *
947 * <p>
948 * The component will not be rendered hidden after first retrieval if this flag is set to true. The component will
949 * then be fetched via an ajax call when it should be rendered.
950 * </p>
951 *
952 * @return the progressiveRenderViaAJAX
953 */
954 boolean isProgressiveRenderViaAJAX();
955
956 /**
957 * Setter for the progressiveRenderViaAJAX flag
958 *
959 * @param progressiveRenderViaAJAX the progressiveRenderViaAJAX to set
960 */
961 void setProgressiveRenderViaAJAX(boolean progressiveRenderViaAJAX);
962
963 /**
964 * Determines whether the component will always be retrieved from the server and shown
965 *
966 * <p>
967 * If true, when the progressiveRender condition is satisfied, the component
968 * will always be retrieved from the server and shown(as opposed to being
969 * stored on the client, but hidden, after the first retrieval as is the
970 * case with the progressiveRenderViaAJAX option). <b>By default, this is
971 * false, so components with progressive render capabilities will always be
972 * already within the client html and toggled to be hidden or visible.</b> </p>
973 *
974 * @return the progressiveRenderAndRefresh
975 */
976 boolean isProgressiveRenderAndRefresh();
977
978 /**
979 * Setter for the progressiveRenderAndRefresh flag
980 *
981 * @param progressiveRenderAndRefresh the progressiveRenderAndRefresh to set
982 */
983 void setProgressiveRenderAndRefresh(boolean progressiveRenderAndRefresh);
984
985 /**
986 * Specifies a property by name that when its value changes will automatically perform
987 * a refresh on this component
988 *
989 * <p>
990 * This can be a comma
991 * separated list of multiple properties that require this component to be
992 * refreshed when any of them change. <Br>DO NOT use with progressiveRender
993 * unless it is know that progressiveRender condition will always be
994 * satisfied before one of these fields can be changed.
995 * </p>
996 *
997 * @return List property names that should trigger a refresh when their values change
998 */
999 List<String> getRefreshWhenChangedPropertyNames();
1000
1001 /**
1002 * Setter for the list of property names that trigger a refresh
1003 *
1004 * @param refreshWhenChangedPropertyNames
1005 */
1006 void setRefreshWhenChangedPropertyNames(List<String> refreshWhenChangedPropertyNames);
1007
1008 /**
1009 * Returns a list of componentIds which will be also be refreshed when this component is refreshed
1010 *
1011 * <p>
1012 * This will be a comma separated list of componentIds that need to be refreshed when a refresh
1013 * condition has been set on this component.
1014 * </p>
1015 *
1016 * @return List<String>
1017 */
1018 public List<String> getAdditionalComponentsToRefresh();
1019
1020 /**
1021 * Setter for alsoRefreshComponents
1022 *
1023 * @param additionalComponentsToRefresh
1024 */
1025 public void setAdditionalComponentsToRefresh(List<String> additionalComponentsToRefresh);
1026
1027 /**
1028 * Returns a string for representing the list of additional components to be refreshed as
1029 * a JavaScript value
1030 *
1031 * @return String representation of the list of componentIds for the components that need to be refreshed
1032 */
1033 public String getAdditionalComponentsToRefreshJs();
1034
1035 /**
1036 * Indicates the component can be refreshed by an action
1037 *
1038 * <p>
1039 * This is set by the framework for configured ajax action buttons, should not be set in
1040 * configuration
1041 * </p>
1042 *
1043 * @return boolean true if the component is refreshed by an action, false if not
1044 */
1045 boolean isRefreshedByAction();
1046
1047 /**
1048 * Setter for the refreshed by action indicator
1049 *
1050 * <p>
1051 * This is set by the framework for configured ajax action buttons, should not be set in
1052 * configuration
1053 * </p>
1054 *
1055 * @param refreshedByAction
1056 */
1057 void setRefreshedByAction(boolean refreshedByAction);
1058
1059 /**
1060 * If true if this component is disclosed by an action in js, a placeholder will be put in this components place
1061 * if render is also false.
1062 *
1063 * @return true if this component is disclosed by an action
1064 */
1065 public boolean isDisclosedByAction();
1066
1067 /**
1068 * Set if this component is disclosed by some outside action
1069 *
1070 * @param disclosedByAction
1071 */
1072 public void setDisclosedByAction(boolean disclosedByAction);
1073
1074 /**
1075 * Indicates whether data contained within the component should be reset (set to default) when the
1076 * component is refreshed
1077 *
1078 * @return boolean true if data should be refreshed, false if data should remain as is
1079 */
1080 boolean isResetDataOnRefresh();
1081
1082 /**
1083 * Setter for the reset data on refresh indicator
1084 *
1085 * @param resetDataOnRefresh
1086 */
1087 void setResetDataOnRefresh(boolean resetDataOnRefresh);
1088
1089 /**
1090 * Time in seconds after which the component is automatically refreshed
1091 *
1092 * @return time in seconds
1093 */
1094 int getRefreshTimer();
1095
1096 /**
1097 * Setter for refreshTimer
1098 *
1099 * @param refreshTimer
1100 */
1101 void setRefreshTimer(int refreshTimer);
1102
1103 /**
1104 * The DataAttributes that will be written to the html element for this component as data-
1105 *
1106 * <p>They can be access through .data() call in jQuery.</p>
1107 *
1108 * @return map of data attributes, where key is data attribute name and the map value is the data
1109 * attribute value
1110 */
1111 Map<String, String> getDataAttributes();
1112
1113 /**
1114 * Setter for data attributes to include for the component
1115 *
1116 * @param dataAttributes
1117 */
1118 void setDataAttributes(Map<String, String> dataAttributes);
1119
1120 /**
1121 * Setter for script data attributes to include for the component
1122 *
1123 * @param dataAttributes
1124 */
1125 void setScriptDataAttributes(Map<String, String> dataAttributes);
1126
1127 /**
1128 * The DataAttributes that will be written to the html as a script call to data for this component (these cannot be
1129 * used for jQuery selection directly)
1130 *
1131 * <p>They can be accessed through .data() call in jQuery.</p>
1132 *
1133 * @return map of data attributes, where key is data attribute name and the map value is the data
1134 * attribute value
1135 */
1136 Map<String, String> getScriptDataAttributes();
1137
1138 /**
1139 * Add a data attribute to the dataAttributes map
1140 *
1141 * @param key
1142 * @param value
1143 */
1144 void addDataAttribute(String key, String value);
1145
1146 /**
1147 * Add a script data attribute to the scriptDataAttributes map
1148 *
1149 * @param key
1150 * @param value
1151 */
1152 void addScriptDataAttribute(String key, String value);
1153
1154 /**
1155 * The string that can be put into a the tag of a component to add data attributes inline
1156 *
1157 * @return html string for data attributes as html formatted element attributes
1158 */
1159 String getSimpleDataAttributes();
1160
1161 /**
1162 * Returns a js string that can be used to right js data attributes to for the component
1163 *
1164 * @return html string for the js required to add the script data attributes
1165 */
1166 String getScriptDataAttributesJs();
1167
1168 /**
1169 * The role attribute of this component, use to define aria roles
1170 *
1171 * @return the role attribute
1172 */
1173 String getRole();
1174
1175 /**
1176 * @see Component#getRole()
1177 */
1178 void setRole(String role);
1179
1180 /**
1181 * The aria attributes of this component and their values
1182 * (without "aria-", this is automatically appended during rendering)
1183 *
1184 * @return the aria attributes of this component
1185 */
1186 Map<String, String> getAriaAttributes();
1187
1188 /**
1189 * @see org.kuali.rice.krad.uif.component.Component#getAriaAttributes()
1190 */
1191 void setAriaAttributes(Map<String, String> ariaAttributes);
1192
1193 /**
1194 * Add an aria attribute to the ariaAttributes list
1195 *
1196 * @param key the attribute (no "aria-" prefix)
1197 * @param value the attribute's value
1198 */
1199 void addAriaAttribute(String key, String value);
1200
1201 /**
1202 * Get the aria attributes as a String that can be used during template output
1203 *
1204 * @return the aria attributes as a string
1205 */
1206 String getAriaAttributesAsString();
1207
1208 /**
1209 * Validates different requirements of component compiling a series of reports detailing information on errors
1210 * found in the component. Used by the RiceDictionaryValidator.
1211 *
1212 * @param tracer Record of component's location
1213 */
1214 void completeValidation(ValidationTrace tracer);
1215
1216 /**
1217 * Raw html or string content to render before this component renders
1218 *
1219 * @return the preRenderContent string
1220 */
1221 public String getPreRenderContent();
1222
1223 /**
1224 * Set the preRenderContent
1225 *
1226 * @param preRenderContent
1227 */
1228 public void setPreRenderContent(String preRenderContent);
1229
1230 /**
1231 * Raw html or string content to render after this component renders
1232 *
1233 * @return the postRenderContent string
1234 */
1235 public String getPostRenderContent();
1236
1237 /**
1238 * Set the postRenderContent
1239 *
1240 * @param postRenderContent
1241 */
1242 public void setPostRenderContent(String postRenderContent);
1243
1244 /**
1245 * Gets the method to call on refresh.
1246 *
1247 * @return method to call
1248 */
1249 String getMethodToCallOnRefresh();
1250
1251 /**
1252 * Gets a string representing all CSS style classes.
1253 *
1254 * @return string representation of CSS classes
1255 */
1256 String getStyleClassesAsString();
1257
1258 }