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