1 /** 2 * Copyright 2005-2013 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>Placeholder components are used for ajax retrievals. In particular, this flag is useful for use in 307 * combination with the showLightboxComponent js function which will automatically retrieve the real content of 308 * a component through ajax if a placeholder component is detected. This allows for the full content to only 309 * be retrieved when the lightbox is first opened. When this flag is set to true, the forceSessionPersistence 310 * flag is set to true AUTOMATICALLY because it is implied that this component will be retrieved by an ajax call 311 * in the future. This may also be useful for direct custom calls to retrieveComponent function, as well.</p> 312 * 313 * @return true if this component is being rendered as a placeholder for use in replacement during and ajax call, 314 * false otherwise 315 */ 316 public boolean isUseAjaxCallForContent(); 317 318 /** 319 * When true, this component will render as a placeholder component instead of rendering normally because the 320 * content will be later retrieved through manually ajax retrieval calls in the js 321 * 322 * @param useAjaxCallForContent 323 */ 324 public void setUseAjaxCallForContent(boolean useAjaxCallForContent); 325 326 /** 327 * Indicates whether the component should be hidden in the UI 328 * 329 * <p> 330 * How the hidden data is maintained depends on the views persistence mode. 331 * If the mode is request, the corresponding data will be rendered to the UI 332 * but not visible. If the mode is session, the data will not be rendered to 333 * the UI but maintained server side. 334 * </p> 335 * 336 * <p> 337 * For a {@code Container} component, the hidden setting will apply to 338 * all contained components (making a section hidden makes all fields within 339 * the section hidden) 340 * </p> 341 * 342 * @return boolean true if the component should be hidden, false if it 343 * should be visible 344 */ 345 boolean isHidden(); 346 347 /** 348 * Setter for the hidden indicator 349 * 350 * @param hidden 351 */ 352 void setHidden(boolean hidden); 353 354 /** 355 * Indicates whether the component can be edited 356 * 357 * <p> 358 * When readOnly the controls and widgets of {@code Field} components 359 * will not be rendered. If the Field has an underlying value it will be 360 * displayed readOnly to the user. 361 * </p> 362 * 363 * <p> 364 * For a {@code Container} component, the readOnly setting will apply 365 * to all contained components (making a section readOnly makes all fields 366 * within the section readOnly). 367 * </p> 368 * 369 * @return boolean true if the component should be readOnly, false if is 370 * allows editing 371 */ 372 boolean isReadOnly(); 373 374 /** 375 * Setter for the read only indicator 376 * 377 * @param readOnly 378 */ 379 void setReadOnly(boolean readOnly); 380 381 /** 382 * Indicates whether the component is required 383 * 384 * <p> 385 * At the general component level required means there is some action the 386 * user needs to take within the component. For example, within a section it 387 * might mean the fields within the section should be completed. At a field 388 * level, it means the field should be completed. This provides the ability 389 * for the renderers to indicate the required action. 390 * </p> 391 * 392 * @return boolean true if the component is required, false if it is not 393 * required 394 */ 395 Boolean getRequired(); 396 397 /** 398 * Setter for the required indicator 399 * 400 * @param required 401 */ 402 void setRequired(Boolean required); 403 404 /** 405 * Horizontal alignment of the component within its container 406 * 407 * <p> 408 * All components belong to a <code>Container</code> and are placed using a 409 * <code>LayoutManager</code>. This property specifies how the component 410 * should be aligned horizontally within the container. During the finalize 411 * phase the CSS text-align style will be created for the align setting. 412 * </p> 413 * 414 * @return String horizontal align 415 * @see org.kuali.rice.krad.uif.CssConstants.TextAligns 416 */ 417 public String getAlign(); 418 419 /** 420 * Sets the components horizontal alignment 421 * 422 * @param align 423 */ 424 public void setAlign(String align); 425 426 /** 427 * Vertical alignment of the component within its container 428 * 429 * <p> 430 * All components belong to a <code>Container</code> and are placed using a 431 * <code>LayoutManager</code>. This property specifies how the component 432 * should be aligned vertically within the container. During the finalize 433 * phase the CSS vertical-align style will be created for the valign 434 * setting. 435 * </p> 436 * 437 * @return String vertical align 438 * @see org.kuali.rice.krad.uif.CssConstants.VerticalAligns 439 */ 440 public String getValign(); 441 442 /** 443 * Setter for the component's vertical align 444 * 445 * @param valign 446 */ 447 public void setValign(String valign); 448 449 /** 450 * Width the component should take up in the container 451 * 452 * <p> 453 * All components belong to a <code>Container</code> and are placed using a 454 * <code>LayoutManager</code>. This property specifies a width the component 455 * should take up in the Container. This is not applicable for all layout 456 * managers. During the finalize phase the CSS width style will be created 457 * for the width setting. 458 * </p> 459 * 460 * <p> 461 * e.g. '30%', '55px' 462 * </p> 463 * 464 * @return String width string 465 */ 466 public String getWidth(); 467 468 /** 469 * Setter for the components width 470 * 471 * @param width 472 */ 473 public void setWidth(String width); 474 475 /** 476 * CSS style string to be applied to the component 477 * 478 * <p> 479 * Any style override or additions can be specified with this attribute. 480 * This is used by the renderer to set the style attribute on the 481 * corresponding element. 482 * </p> 483 * 484 * <p> 485 * e.g. 'color: #000000;text-decoration: underline;' 486 * </p> 487 * 488 * @return String css style string 489 */ 490 String getStyle(); 491 492 /** 493 * Setter for the components style 494 * 495 * @param style 496 */ 497 void setStyle(String style); 498 499 /** 500 * CSS style class(s) to be applied to the component 501 * 502 * <p> 503 * Declares style classes for the component. Multiple classes are specified 504 * with a space delimiter. This is used by the renderer to set the class 505 * attribute on the corresponding element. The class(s) declared must be 506 * available in the common style sheets or the style sheets specified for 507 * the view 508 * </p> 509 * 510 * @return List<String> css style classes to appear on the 'class' attribute 511 */ 512 List<String> getCssClasses(); 513 514 /** 515 * Setter for the components style classes 516 * 517 * @param styleClasses 518 */ 519 void setCssClasses(List<String> styleClasses); 520 521 /** 522 * Convenience property for adding css class names to the end of the list of cssClasses that may already exist on 523 * this Component (this is to avoid explicitly having to set list merge in the bean definition) 524 * 525 * @return the additionalCssClasses 526 */ 527 List<String> getAdditionalCssClasses(); 528 529 /** 530 * Set the additionalCssClasses 531 * 532 * @param styleClasses 533 */ 534 void setAdditionalCssClasses(List<String> styleClasses); 535 536 /** 537 * Adds a single style to the list of styles on this component 538 * 539 * @param styleClass 540 */ 541 void addStyleClass(String styleClass); 542 543 /** 544 * Appends to the inline style set on a component 545 * 546 * @param itemStyle 547 */ 548 void appendToStyle(String itemStyle); 549 550 /** 551 * Number of places the component should take up horizontally in the 552 * container 553 * 554 * <p> 555 * All components belong to a {@code Container} and are placed using a 556 * {@code LayoutManager}. This property specifies how many places 557 * horizontally the component should take up within the container. This is 558 * only applicable for table based layout managers. Default is 1 559 * </p> 560 * 561 * TODO: this should not be on component interface since it only applies if 562 * the layout manager supports it, need some sort of layoutOptions map for 563 * field level options that depend on the manager 564 * 565 * @return int number of columns to span 566 */ 567 int getColSpan(); 568 569 /** 570 * Setter for the components column span 571 * 572 * @param colSpan 573 */ 574 void setColSpan(int colSpan); 575 576 /** 577 * Number of places the component should take up vertically in the container 578 * 579 * <p> 580 * All components belong to a {@code Container} and are placed using a 581 * {@code LayoutManager}. This property specifies how many places 582 * vertically the component should take up within the container. This is 583 * only applicable for table based layout managers. Default is 1 584 * </p> 585 * 586 * TODO: this should not be on component interface since it only applies if 587 * the layout manager supports it, need some sort of layoutOptions map for 588 * field level options that depend on the manager 589 * 590 * @return int number of rows to span 591 */ 592 int getRowSpan(); 593 594 /** 595 * Setter for the component row span 596 * 597 * @param rowSpan 598 */ 599 void setRowSpan(int rowSpan); 600 601 /** 602 * The cellCssClasses property defines the classes that will be placed on the corresponding td (or th) elements 603 * relating to this component when used in a table backed layout. This property has no effect on other layouts. 604 * 605 * @return the css classes to apply to the wrapping td (or th) element for this component 606 */ 607 public List<String> getCellCssClasses(); 608 609 /** 610 * Set the cellCssClasses property which defines the classes that will be placed on the corresponding td (or th) 611 * relating to this component when used in a table backed layout. This property has no effect on other layouts. 612 * 613 * @param cellCssClasses 614 */ 615 public void setCellCssClasses(List<String> cellCssClasses); 616 617 /** 618 * Add a cell css class to the cell classes list 619 * 620 * @param cssClass the name of the class to add 621 */ 622 public void addCellCssClass(String cssClass); 623 624 /** 625 * CSS style string to be applied to the cell containing the component (only applies within 626 * table based layouts) 627 * 628 * <p> 629 * e.g. 'align: right;' 630 * </p> 631 * 632 * @return String css style string 633 */ 634 public String getCellStyle(); 635 636 /** 637 * Setter for the cell style attribute 638 * 639 * @param cellStyle 640 */ 641 public void setCellStyle(String cellStyle); 642 643 /** 644 * Width setting for the cell containing the component (only applies within table based 645 * layouts) 646 * 647 * @return String width ('25%', '155px') 648 */ 649 public String getCellWidth(); 650 651 /** 652 * Setter for the containing cell width 653 * 654 * @param cellWidth 655 */ 656 public void setCellWidth(String cellWidth); 657 658 /** 659 * Context map for the component 660 * 661 * <p> 662 * Any el statements configured for the components properties (e.g. 663 * title="@{foo.property}") are evaluated using the el context map. This map 664 * will get populated with default objects like the model, view, and request 665 * from the {@code ViewHelperService}. Other components can push 666 * further objects into the context so that they are available for use with 667 * that component. For example, {@code Field} instances that are part 668 * of a collection line as receive the current line instance 669 * </p> 670 * 671 * <p> 672 * Context map also provides objects to methods that are invoked for 673 * {@code GeneratedField} instances 674 * </p> 675 * 676 * <p> 677 * The Map key gives the name of the variable that can be used within 678 * expressions, and the Map value gives the object instance for which 679 * expressions containing the variable should evaluate against 680 * </p> 681 * 682 * <p> 683 * NOTE: Calling getContext().putAll() will skip updating any configured property replacers for the 684 * component. Instead you should call #pushAllToContext 685 * </p> 686 * 687 * @return Map<String, Object> context 688 */ 689 Map<String, Object> getContext(); 690 691 /** 692 * Setter for the context Map 693 * 694 * @param context 695 */ 696 void setContext(Map<String, Object> context); 697 698 /** 699 * Places the given object into the context Map for the component with the 700 * given name 701 * 702 * <p> 703 * Note this also will push context to property replacers configured on the component. 704 * To place multiple objects in the context, you should use #pushAllToContext since that 705 * will call this method for each and update property replacers. Using {@link #getContext().putAll()} 706 * will bypass property replacers. 707 * </p> 708 * 709 * @param objectName - name the object should be exposed under in the context map 710 * @param object - object instance to place into context 711 */ 712 void pushObjectToContext(String objectName, Object object); 713 714 /** 715 * Places each entry of the given Map into the context for the component 716 * 717 * <p> 718 * Note this will call #pushObjectToContext for each entry which will update any configured property 719 * replacers as well. This should be used in place of getContext().putAll() 720 * </p> 721 * 722 * @param objects - Map<String, Object> objects to add to context, where the entry key will be the context key 723 * and the entry value will be the context value 724 */ 725 void pushAllToContext(Map<String, Object> objects); 726 727 /** 728 * gets a list of {@code PropertyReplacer} instances 729 * 730 * <p>They will be evaluated 731 * during the view lifecycle to conditionally set properties on the 732 * {@code Component} based on expression evaluations</p> 733 * 734 * @return List<PropertyReplacer> replacers to evaluate 735 */ 736 List<PropertyReplacer> getPropertyReplacers(); 737 738 /** 739 * Setter for the components property substitutions 740 * 741 * @param propertyReplacers 742 */ 743 void setPropertyReplacers(List<PropertyReplacer> propertyReplacers); 744 745 /** 746 * The options that are passed through to the Component renderer 747 * 748 * <p> 749 * The Map key is the option name, with the Map value as the option value. See 750 * documentation on the particular widget render for available options. 751 * </p> 752 * 753 * @return Map<String, String> options 754 */ 755 Map<String, String> getTemplateOptions(); 756 757 /** 758 * Setter for the template's options 759 * 760 * @param templateOptions 761 */ 762 void setTemplateOptions(Map<String, String> templateOptions); 763 764 /** 765 * Builds a string from the underlying <code>Map</code> of template options that will export that options as a 766 * JavaScript Map for use in js and jQuery plugins 767 * 768 * <p> 769 * See documentation on the particular component render for available options. 770 * </p> 771 * 772 * @return String options 773 */ 774 String getTemplateOptionsJSString(); 775 776 /** 777 * Setter for the template's options 778 * 779 * @param templateOptionsJSString 780 */ 781 void setTemplateOptionsJSString(String templateOptionsJSString); 782 783 /** 784 * Order of a component within a List of other components 785 * 786 * <p>Lower numbers are placed higher up in the list, while higher numbers are placed 787 * lower in the list</p> 788 * 789 * @return int ordering number 790 * @see org.springframework.core.Ordered#getOrder() 791 */ 792 int getOrder(); 793 794 /** 795 * Setter for the component's order 796 * 797 * @param order 798 */ 799 void setOrder(int order); 800 801 /** 802 * The Tooltip widget that renders a tooltip with additional information about the element on 803 * specified trigger event 804 * 805 * @return Tooltip 806 */ 807 Tooltip getToolTip(); 808 809 /** 810 * Setter for the component tooltip widget instance 811 * 812 * @param toolTip 813 */ 814 void setToolTip(Tooltip toolTip); 815 816 /** 817 * String containing JavaScript code for registering event handlers for this component 818 * (blur, focus, click, etc.) 819 * 820 * @return JS event handler script 821 */ 822 public String getEventHandlerScript(); 823 824 /** 825 * The name of the method that should be invoked for finalizing the component 826 * configuration (full method name, without parameters or return type) 827 * 828 * <p> 829 * Note the method can also be set with the finalizeMethodInvoker 830 * targetMethod property. If the method is on the configured 831 * {@code ViewHelperService}, only this property needs to be configured 832 * </p> 833 * 834 * <p> 835 * The model backing the view will be passed as the first argument method and then 836 * the {@code Component} instance as the second argument. If any additional method 837 * arguments are declared with the finalizeMethodAdditionalArguments, they will then 838 * be passed in the order declared in the list 839 * </p> 840 * 841 * <p> 842 * If the component is selfRendered, the finalize method can return a string which 843 * will be set as the component's renderOutput. The selfRendered indicator will also 844 * be set to true on the component. 845 * </p> 846 * 847 * @return String method name 848 */ 849 String getFinalizeMethodToCall(); 850 851 /** 852 * The List of Object instances that should be passed as arguments to the finalize method 853 * 854 * <p> 855 * These arguments are passed to the finalize method after the standard model and component 856 * arguments. They are passed in the order declared in the list 857 * </p> 858 * 859 * @return List<Object> additional method arguments 860 */ 861 List<Object> getFinalizeMethodAdditionalArguments(); 862 863 /** 864 * {@code MethodInvokerConfig} instance for the method that should be invoked 865 * for finalizing the component configuration 866 * 867 * <p> 868 * MethodInvoker can be configured to specify the class or object the method 869 * should be called on. For static method invocations, the targetClass 870 * property can be configured. For object invocations, that targetObject 871 * property can be configured 872 * </p> 873 * 874 * <p> 875 * If the component is selfRendered, the finalize method can return a string which 876 * will be set as the component's renderOutput. The selfRendered indicator will also 877 * be set to true on the component. 878 * </p> 879 * 880 * @return MethodInvokerConfig instance 881 */ 882 MethodInvokerConfig getFinalizeMethodInvoker(); 883 884 /** 885 * Indicates whether the component contains its own render output (through 886 * the renderOutput property) 887 * 888 * <p> 889 * If self rendered is true, the corresponding template for the component 890 * will not be invoked and the renderOutput String will be written to the 891 * response as is. 892 * </p> 893 * 894 * @return boolean true if component is self rendered, false if not (renders 895 * through template) 896 */ 897 boolean isSelfRendered(); 898 899 /** 900 * Setter for the self render indicator 901 * 902 * @param selfRendered 903 */ 904 void setSelfRendered(boolean selfRendered); 905 906 /** 907 * Rendering output for the component that will be sent as part of the 908 * response (can contain static text and HTML) 909 * 910 * @return String render output 911 */ 912 String getRenderedHtmlOutput(); 913 914 /** 915 * Setter for the component's render output 916 * 917 * @param renderOutput 918 */ 919 void setRenderedHtmlOutput(String renderOutput); 920 921 /** 922 * Disables the storage of the component in session (when the framework determines it needs to be due to a 923 * refresh condition) 924 * 925 * <p> 926 * When the framework determines there is a condition on the component that requires it to keep around between 927 * posts, it will store the component instance in session. This flag can be set to disable this behavior (which 928 * would require custom application logic to support behavior such as refresh) 929 * </p> 930 * 931 * @return boolean true if the component should not be stored in session, false if session storage is allowed 932 */ 933 boolean isDisableSessionPersistence(); 934 935 /** 936 * Setter for disabling storage of the component in session 937 * 938 * @param disableSessionPersistence 939 */ 940 void setDisableSessionPersistence(boolean disableSessionPersistence); 941 942 /** 943 * Indicates whether the component should be stored with the session view regardless of configuration 944 * 945 * <p> 946 * By default the framework nulls out any components that do not have a refresh condition or are needed for 947 * collection processing. This can be a problem if custom application code is written to refresh a component 948 * without setting the corresponding component flag. In this case this property can be set to true to force the 949 * framework to keep the component in session. Defaults to false 950 * </p> 951 * 952 * @return boolean true if the component should be stored in session, false if not 953 */ 954 boolean isForceSessionPersistence(); 955 956 /** 957 * Setter for the indicator to force persistence of the component in session 958 * 959 * @param persistInSession 960 */ 961 void setForceSessionPersistence(boolean persistInSession); 962 963 /** 964 * Security object that indicates what authorization (permissions) exist for the component 965 * 966 * @return ComponentSecurity instance 967 */ 968 ComponentSecurity getComponentSecurity(); 969 970 /** 971 * Setter for the components security object 972 * 973 * @param componentSecurity 974 */ 975 void setComponentSecurity(ComponentSecurity componentSecurity); 976 977 /** 978 * Spring EL expression, which when evaluates to true, makes this component visible 979 * 980 * @return the SpEl expression string 981 */ 982 String getProgressiveRender(); 983 984 /** 985 * Setter for progressiveRender Spring EL expression 986 * 987 * @param progressiveRender the progressiveRender to set 988 */ 989 void setProgressiveRender(String progressiveRender); 990 991 /** 992 * Spring EL expression, which when evaluates to true, causes this component to be refreshed 993 * 994 * @return the SpEl expression string 995 */ 996 String getConditionalRefresh(); 997 998 /** 999 * Setter for conditionalRefresh Spring EL expression 1000 * 1001 * @param conditionalRefresh the conditionalRefresh to set 1002 */ 1003 void setConditionalRefresh(String conditionalRefresh); 1004 1005 /** 1006 * List of control names (ids) extracted from {@link #getProgressiveRender()} 1007 * 1008 * @return the list of control names 1009 */ 1010 List<String> getProgressiveDisclosureControlNames(); 1011 1012 /** 1013 * A JavaScript expression constructed from {@link #getConditionalRefresh()} 1014 * 1015 * <p>The script can be executed on the client to determine if the original exp was satisfied before 1016 * interacting with the server.</p> 1017 * 1018 * @return the JS script 1019 */ 1020 String getProgressiveDisclosureConditionJs(); 1021 1022 /** 1023 * A JavaScript expression constructed from {@link #getProgressiveRender()} 1024 * 1025 * <p>The script can be executed on the client to determine if the original exp was satisfied before 1026 * interacting with the server.</p> 1027 * 1028 * @return the JS script 1029 */ 1030 String getConditionalRefreshConditionJs(); 1031 1032 /** 1033 * The list of control names (ids) extracted from {@link #getConditionalRefresh()} 1034 * 1035 * @return the list of control names 1036 */ 1037 List<String> getConditionalRefreshControlNames(); 1038 1039 /** 1040 * Indicates whether the component will be stored on the client, but hidden, after the first retrieval 1041 * 1042 * <p> 1043 * The component will not be rendered hidden after first retrieval if this flag is set to true. The component will 1044 * then be fetched via an ajax call when it should be rendered. 1045 * </p> 1046 * 1047 * @return the progressiveRenderViaAJAX 1048 */ 1049 boolean isProgressiveRenderViaAJAX(); 1050 1051 /** 1052 * Setter for the progressiveRenderViaAJAX flag 1053 * 1054 * @param progressiveRenderViaAJAX the progressiveRenderViaAJAX to set 1055 */ 1056 void setProgressiveRenderViaAJAX(boolean progressiveRenderViaAJAX); 1057 1058 /** 1059 * Determines whether the component will always be retrieved from the server and shown 1060 * 1061 * <p> 1062 * If true, when the progressiveRender condition is satisfied, the component 1063 * will always be retrieved from the server and shown(as opposed to being 1064 * stored on the client, but hidden, after the first retrieval as is the 1065 * case with the progressiveRenderViaAJAX option). <b>By default, this is 1066 * false, so components with progressive render capabilities will always be 1067 * already within the client html and toggled to be hidden or visible.</b> </p> 1068 * 1069 * @return the progressiveRenderAndRefresh 1070 */ 1071 boolean isProgressiveRenderAndRefresh(); 1072 1073 /** 1074 * Setter for the progressiveRenderAndRefresh flag 1075 * 1076 * @param progressiveRenderAndRefresh the progressiveRenderAndRefresh to set 1077 */ 1078 void setProgressiveRenderAndRefresh(boolean progressiveRenderAndRefresh); 1079 1080 /** 1081 * Specifies a property by name that when its value changes will automatically perform 1082 * a refresh on this component 1083 * 1084 * <p> 1085 * This can be a comma 1086 * separated list of multiple properties that require this component to be 1087 * refreshed when any of them change. <Br>DO NOT use with progressiveRender 1088 * unless it is know that progressiveRender condition will always be 1089 * satisfied before one of these fields can be changed. 1090 * </p> 1091 * 1092 * @return List property names that should trigger a refresh when their values change 1093 */ 1094 List<String> getRefreshWhenChangedPropertyNames(); 1095 1096 /** 1097 * Setter for the list of property names that trigger a refresh 1098 * 1099 * @param refreshWhenChangedPropertyNames 1100 */ 1101 void setRefreshWhenChangedPropertyNames(List<String> refreshWhenChangedPropertyNames); 1102 1103 /** 1104 * Returns a list of componentIds which will be also be refreshed when this component is refreshed 1105 * 1106 * <p> 1107 * This will be a comma separated list of componentIds that need to be refreshed when a refresh 1108 * condition has been set on this component. 1109 * </p> 1110 * 1111 * @return List<String> 1112 */ 1113 public List<String> getAdditionalComponentsToRefresh(); 1114 1115 /** 1116 * Setter for alsoRefreshComponents 1117 * 1118 * @param additionalComponentsToRefresh 1119 */ 1120 public void setAdditionalComponentsToRefresh(List<String> additionalComponentsToRefresh); 1121 1122 /** 1123 * Returns a string for representing the list of additional components to be refreshed as 1124 * a JavaScript value 1125 * 1126 * @return String representation of the list of componentIds for the components that need to be refreshed 1127 */ 1128 public String getAdditionalComponentsToRefreshJs(); 1129 1130 /** 1131 * Indicates the component can be refreshed by an action 1132 * 1133 * <p> 1134 * This is set by the framework for configured ajax action buttons, should not be set in 1135 * configuration 1136 * </p> 1137 * 1138 * @return boolean true if the component is refreshed by an action, false if not 1139 */ 1140 boolean isRefreshedByAction(); 1141 1142 /** 1143 * Setter for the refreshed by action indicator 1144 * 1145 * <p> 1146 * This is set by the framework for configured ajax action buttons, should not be set in 1147 * configuration 1148 * </p> 1149 * 1150 * @param refreshedByAction 1151 */ 1152 void setRefreshedByAction(boolean refreshedByAction); 1153 1154 /** 1155 * If true if this component is disclosed by an action in js, a placeholder will be put in this components place 1156 * if render is also false. 1157 * 1158 * @return true if this component is disclosed by an action 1159 */ 1160 public boolean isDisclosedByAction(); 1161 1162 /** 1163 * Set if this component is disclosed by some outside action 1164 * 1165 * @param disclosedByAction 1166 */ 1167 public void setDisclosedByAction(boolean disclosedByAction); 1168 1169 /** 1170 * Indicates whether data contained within the component should be reset (set to default) when the 1171 * component is refreshed 1172 * 1173 * @return boolean true if data should be refreshed, false if data should remain as is 1174 */ 1175 boolean isResetDataOnRefresh(); 1176 1177 /** 1178 * Setter for the reset data on refresh indicator 1179 * 1180 * @param resetDataOnRefresh 1181 */ 1182 void setResetDataOnRefresh(boolean resetDataOnRefresh); 1183 1184 /** 1185 * Time in seconds after which the component is automatically refreshed 1186 * 1187 * @return time in seconds 1188 */ 1189 int getRefreshTimer(); 1190 1191 /** 1192 * Setter for refreshTimer 1193 * 1194 * @param refreshTimer 1195 */ 1196 void setRefreshTimer(int refreshTimer); 1197 1198 /** 1199 * Add a data attribute to the dataAttributes map 1200 * 1201 * @param key 1202 * @param value 1203 */ 1204 void addDataAttribute(String key, String value); 1205 1206 Map<String, String> getDataAttributes(); 1207 1208 /** 1209 * The DataAttributes that will be written to the html and/or through script to be consumed by jQuery 1210 * 1211 * <p>The attributes that are complex objects (contain {}) they will be written through script. 1212 * The attributes that are simple (contain no objects) will be written directly to the html of the 1213 * component using standard data-.</p> 1214 * <p>Either way they can be access through .data() call in jQuery.</p> 1215 * 1216 * @param dataAttributes 1217 */ 1218 void setDataAttributes(Map<String, String> dataAttributes); 1219 1220 /** 1221 * The string that can be put into a the tag of a component to add data attributes inline 1222 * 1223 * <p> 1224 * This does not include the complex attributes which contain {}</p> 1225 * 1226 * @return html string for data attributes for the simple attributes 1227 */ 1228 String getSimpleDataAttributes(); 1229 1230 /** 1231 * Validates different requirements of component compiling a series of reports detailing information on errors 1232 * found in the component. Used by the RiceDictionaryValidator. 1233 * 1234 * @param tracer Record of component's location 1235 */ 1236 void completeValidation(ValidationTrace tracer); 1237 1238 /** 1239 * Raw html or string content to render before this component renders 1240 * 1241 * @return the preRenderContent string 1242 */ 1243 public String getPreRenderContent(); 1244 1245 /** 1246 * Set the preRenderContent 1247 * 1248 * @param preRenderContent 1249 */ 1250 public void setPreRenderContent(String preRenderContent); 1251 1252 /** 1253 * Raw html or string content to render after this component renders 1254 * 1255 * @return the postRenderContent string 1256 */ 1257 public String getPostRenderContent(); 1258 1259 /** 1260 * Set the postRenderContent 1261 * 1262 * @param postRenderContent 1263 */ 1264 public void setPostRenderContent(String postRenderContent); 1265 1266 /** 1267 * Clone the object 1268 * 1269 * @return the cloned object 1270 */ 1271 public <T extends Component> T clone(); 1272 }