Interface LifecycleElement

All Superinterfaces:
Cloneable, Copyable, Serializable
All Known Subinterfaces:
CollectionGroup, CollectionLayoutManager, Component, Container, ContentElement, Control, DataBinding, DataField, Field, GridLayoutManager, Group, InputField, LayoutManager, PageGroup, SelectControl, StackedLayoutManager, TableLayoutManager, TextControl, Widget
All Known Implementing Classes:
Accordion, AccordionGroup, Action, ActionField, ApplicationHeader, BlockUI, BoxLayoutManager, BreadcrumbItem, Breadcrumbs, CheckboxControl, CheckboxGroupControl, CollectionGroupBase, CollectionLayoutManagerBase, ComponentBase, ContainerBase, Content, ContentElementBase, ControlBase, CssGridLabelColumnLayoutManager, CssGridLayoutManager, CssGridLayoutManagerBase, DataFieldBase, DataTable, DatePicker, DialogGroup, Disclosure, Div, DocumentView, FieldBase, FieldGroup, FileControl, FormView, GenericField, GridLayoutManagerBase, GroupBase, GroupControl, GroupLinkField, Growls, Header, HeadLink, Help, HiddenControl, Icon, Iframe, IframeView, Image, ImageField, InputFieldBase, Inquiry, InquiryView, Label, LayoutManagerBase, LightBox, LightTable, Link, LinkField, LinkGroup, ListLayoutManager, LocationSuggest, LookupInputField, LookupView, MaintenanceDocumentView, Message, MessageField, MessageView, MetaTag, MockView, MultiFileUploadCollection, MultiValueControlBase, NavigationBar, NextPager, NumberedPager, OptionListControl, PageGroupBase, Pager, PasswordControl, ProgressBar, ProgressBarField, QuickFinder, RadioGroupControl, RemoteFieldsHolder, RichTable, RoleLinkField, Scrollpane, SelectControlBase, SidebarNavigationGroup, SimpleLayoutManager, Space, SpaceField, Spinner, SpinnerControl, StackedLayoutManagerBase, StepProgressBar, Suggest, SyntaxHighlighter, TabGroup, TableLayoutManagerBase, TabNavigationGroup, Tabs, TextAreaControl, TextControlBase, ToggleMenu, Tooltip, TransactionalDocumentView, Tree, TreeGroup, UserControl, UserLinkField, View, ViewHeader, WidgetBase

public interface LifecycleElement extends Serializable, Copyable
Interface to be implemented by objects that participates in the view lifecycle.
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Details

    • getId

      String getId()
      The unique id (within a given tree) for the element.

      The id is used to identify an element instance within the tree, and will be used by renderers to set the HTML element id. This gives a way to find various elements for scripting. If the id is not given, a default will be generated by the framework.

      Returns:
      A unique ID for this lifecycle element.
    • setId

      void setId(String id)
      Setter for the unique id (within a given tree) for the component
      Parameters:
      id - - string to set as the component id
    • getContainerIdSuffix

      String getContainerIdSuffix()
      A string suffix that should get applied to the id for all child components of the given element.

      This is mainly used within the framework to keep ids unique. For instance, for components generated for collection lines, all the components within those should get a line suffix. The framework will set this property to be '_line0', '_line1', etc. Then when the apply model phase is run on the child components their ids will be updated with this suffix.

      Returns:
      String id suffix for child components
      See Also:
    • setContainerIdSuffix

      void setContainerIdSuffix(String containerIdSuffix)
      See Also:
    • getViewPath

      String getViewPath()
      Gets a property for referring to this component from the view, relative to the view, as assigned by the current or most recent lifecycle.
      Returns:
      property path
    • setViewPath

      void setViewPath(String viewPath)
      Setter for getViewPath().
      Parameters:
      viewPath - The property path.
    • getPhasePathMapping

      Map<String,String> getPhasePathMapping()
      Map of paths for this component that will be used to process a refresh (if necessary).
      Returns:
      map of refresh paths, key represents the lifecycle phase and the value is the path for the component at that phase
    • setPhasePathMapping

      void setPhasePathMapping(Map<String,String> phasePathMapping)
      See Also:
    • isMutable

      boolean isMutable(boolean legalBeforeConfiguration)
      Determine if this lifecycle element is mutable.

      Most lifecycle element are immutable, and all are immutable expect during initialization and the during the view lifecycle. Those that have been copied within the view lifecycle, however, may be modified during the same lifecycle.

      Parameters:
      legalBeforeConfiguration - true if the current operation may be called before the lifecycle element has been cached, for example while being initialized as part of a Spring context.
      Returns:
      True if the component is mutable.
    • checkMutable

      void checkMutable(boolean legalDuringInitialization)
      Check for mutability on the element before modifying state.
      Parameters:
      legalDuringInitialization - True if the operation is legal during view initialization, false if the operation is only allowed during the component lifecycle.
      Throws:
      IllegalStateException - If the component is not mutable and the lifecycle is operating in strict mode.
      See Also:
    • getViewStatus

      String getViewStatus()
      Get the view lifecycle processing status for this component.
      Returns:
      The view lifecycle processing status for this component.
      See Also:
    • setViewStatus

      void setViewStatus(String viewStatus)
      Sets the view status.
      Parameters:
      viewStatus - view status
      See Also:
    • isRender

      boolean isRender()
      Indicates whether the component should be rendered in the UI

      If set to false, the corresponding component template will not be invoked (therefore nothing will be rendered to the UI).

      Returns:
      boolean true if the component should be rendered, false if it should not be
    • setRender

      void setRender(boolean render)
      Setter for the components render indicator
      Parameters:
      render -
    • isInitialized

      boolean isInitialized()
      Indicates whether the component has been initialized.
      Returns:
      True if the component has been initialized, false if not.
    • isModelApplied

      boolean isModelApplied()
      Indicates whether the component has been updated from the model.
      Returns:
      True if the component has been updated, false if not.
    • isFinal

      boolean isFinal()
      Indicates whether the component has been updated from the model and final updates made.
      Returns:
      True if the component has been updated, false if not.
    • notifyCompleted

      void notifyCompleted(ViewLifecyclePhase phase)
      Receive notification that a lifecycle phase, and all successor phases, have been completed on this component.
      Parameters:
      phase - The completed view lifecycle phase
    • getContext

      Map<String,Object> getContext()
      Context map for the lifecycle element.

      Any el statements configured for the components properties (e.g. title="@{foo.property}") are evaluated using the el context map. This map will get populated with default objects like the model, view, and request from the ViewHelperService. Other components can push further objects into the context so that they are available for use with that component. For example, field instances that are part of a collection line as receive the current line instance

      Context map also provides objects to methods that are invoked for GeneratedField instances

      The Map key gives the name of the variable that can be used within expressions, and the Map value gives the object instance for which expressions containing the variable should evaluate against

      NOTE: Calling getContext().putAll() will skip updating any configured property replacers for the component. Instead you should call #pushAllToContextDeep

      Returns:
      Mapinvalid input: '<'String, Object> context
    • setContext

      void setContext(Map<String,Object> context)
      See Also:
    • pushObjectToContext

      void pushObjectToContext(String objectName, Object object)
      Places the given object into the context Map for the component with the given name

      Note this also will push context to property replacers configured on the component. To place multiple objects in the context, you should use #pushAllToContextDeep since that will call this method for each and update property replacers. Using Component.getContext().putAll() will bypass property replacers.

      Parameters:
      objectName - - name the object should be exposed under in the context map
      object - - object instance to place into context
    • pushAllToContext

      void pushAllToContext(Map<String,Object> objects)
      Places each entry of the given Map into the context for the component

      Note this will call #pushObjectToContextDeep for each entry which will update any configured property replacers as well. This should be used in place of getContext().putAll()

      Parameters:
      objects - - Mapinvalid input: '<'String, Object> objects to add to context, where the entry key will be the context key and the entry value will be the context value
    • performInitialization

      @Deprecated void performInitialization(Object model)
      Deprecated.
      Special processing within this method should be replaced by ViewLifecycleTask and initialized by
      invalid reference
      #initializePendingTasks(ViewLifecyclePhase, Queue)
      .
      Initializes the component

      Where components can set defaults and setup other necessary state. The initialize method should only be called once per component lifecycle and is invoked within the initialize phase of the view lifecylce.

      Parameters:
      model - - object instance containing the view data
      See Also:
    • performApplyModel

      @Deprecated void performApplyModel(Object model, LifecycleElement parent)
      Deprecated.
      Special processing within this method should be replaced by ViewLifecycleTask and initialized by
      invalid reference
      #initializePendingTasks(ViewLifecyclePhase, Queue)
      .
      Called after the initialize phase to perform conditional logic based on the model data

      Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data

      Parameters:
      model - - Top level object containing the data (could be the form or a top level business object, dto)
      parent - parent lifecycle element
    • performFinalize

      @Deprecated void performFinalize(Object model, LifecycleElement parent)
      Deprecated.
      Special processing within this method should be replaced by ViewLifecycleTask and initialized by
      invalid reference
      #initializePendingTasks(ViewLifecyclePhase, Queue)
      .
      The last phase before the view is rendered

      Here final preparations can be made based on the updated view state.

      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • skipLifecycle

      boolean skipLifecycle()
      Return true if the lifecycle should be skipped for this component.

      Skipping the lifecycle means do not invoke the performInitialize, performApplyModel, and performFinalize methods of this component and its children. This means that content built by those lifecycle tasks will not be processed or applied. Skipping the lifecycle on a component helps initial load/setup performance by only performing the full lifecycle when the component is requested on subsequent requests (ajax retrievals).

      Returns:
      true if lifecycle should be skipped for this component