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