org.kuali.rice.krad.uif.lifecycle
Class ApplyModelComponentPhase

java.lang.Object
  extended by org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhaseBase
      extended by org.kuali.rice.krad.uif.lifecycle.ApplyModelComponentPhase
All Implemented Interfaces:
Runnable, LifecycleElementState, ViewLifecyclePhase

public class ApplyModelComponentPhase
extends ViewLifecyclePhaseBase

Lifecycle phase processing task for applying the model to a component.

During the apply model phase each component of the tree if invoked to setup any state based on the given model data

Part of the view lifecycle that applies the model data to the view. Should be called after the model has been populated before the view is rendered. The main things that occur during this phase are:

The update phase can be called multiple times for the view's lifecycle (typically only once per request)

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
ApplyModelComponentPhase()
           
 
Method Summary
 Map<String,Object> getCommonContext()
          Gets global objects for the context map and pushes them to the context for the component
 String getEndViewStatus()
          Gets the expected view status after phase execution.
 ViewLifecycle.LifecycleEvent getEventToNotify()
          Gets the event to notify on completion.
 String getStartViewStatus()
          Gets the expected view status prior to phase execution.
 String getViewPhase()
          Gets the view lifecycle phase constant that corresponds to this phase processing task.
protected  void initializePendingTasks(Queue<ViewLifecycleTask<?>> tasks)
          Applies the model data to a component of the View instance
protected  ViewLifecyclePhase initializeSuccessor(LifecycleElement nestedElement, String nestedPath, Component parent)
          Define all nested lifecycle components, and component prototypes, as successors.
protected  void prepare(LifecycleElement element, Object model, String path, List<String> refreshPaths, Component parent, ViewLifecyclePhaseBase nextPhase, Set<String> visitedIds)
          Create a new lifecycle phase processing task for applying the model to a element.
protected  void recycle()
          Resets this phase for recycling.
 boolean visit(LifecycleElement element)
          Visit a lifecycle element.
 
Methods inherited from class org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhaseBase
getCurrentTask, getDepth, getElement, getModel, getNestedPropertiesForRefreshPath, getParent, getParentPath, getPredecessor, getRefreshPaths, getViewPath, initializeAllLifecycleSuccessors, initializeRefreshPathSuccessors, initializeSuccessors, isComplete, isProcessed, notifyCompleted, prepare, processSuccessors, run, setViewPath, shouldSkipLifecycle, toString, trace, validateBeforeProcessing, verifyCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApplyModelComponentPhase

public ApplyModelComponentPhase()
Method Detail

recycle

protected void recycle()
Resets this phase for recycling.

Overrides:
recycle in class ViewLifecyclePhaseBase

prepare

protected void prepare(LifecycleElement element,
                       Object model,
                       String path,
                       List<String> refreshPaths,
                       Component parent,
                       ViewLifecyclePhaseBase nextPhase,
                       Set<String> visitedIds)
Create a new lifecycle phase processing task for applying the model to a element.

Parameters:
element - The element the model should be applied to
model - Top level object containing the data
path - The path to the element relative to the parent element
refreshPaths - list of paths to run lifecycle on when executing a refresh lifecycle
parent - The parent element
nextPhase - The phase to queue directly upon completion of this phase, if applicable
visitedIds - Tracks components ids that have been seen for adjusting duplicates

getViewPhase

public String getViewPhase()
Gets the view lifecycle phase constant that corresponds to this phase processing task.

Returns:
view lifecycle phase constant corresponding to this phase
See Also:
UifConstants.ViewPhases

getStartViewStatus

public String getStartViewStatus()
Gets the expected view status prior to phase execution.

Returns:
expected view status prior to phase execution

getEndViewStatus

public String getEndViewStatus()
Gets the expected view status after phase execution.

Returns:
expected view status after phase execution

getEventToNotify

public ViewLifecycle.LifecycleEvent getEventToNotify()
Gets the event to notify on completion.

Returns:
lifecycle event to notify on completion
See Also:
ViewLifecycle.LifecycleEvent

getCommonContext

public Map<String,Object> getCommonContext()
Gets global objects for the context map and pushes them to the context for the component

Returns:
The common context elements to use while applying model elements to the view.
See Also:
#prepare(LifecycleElement, Object, String, Component, ViewLifecyclePhaseBase, Set)

visit

public boolean visit(LifecycleElement element)
Visit a lifecycle element.

Parameters:
element - The lifecycle element (component or layout manager) to mark as visisted.
Returns:
True if the element has been visited before, false if this was the first visit.

initializePendingTasks

protected void initializePendingTasks(Queue<ViewLifecycleTask<?>> tasks)
Applies the model data to a component of the View instance

TODO: Revise - The component is invoked to to apply the model data. Here the component can generate any additional fields needed or alter the configured fields. After the component is invoked a hook for custom helper service processing is invoked. Finally the method is recursively called for all the component children

Initializes queue of pending tasks phases.

This method will be called before during processing to determine which tasks to perform at this phase.

Specified by:
initializePendingTasks in class ViewLifecyclePhaseBase
Parameters:
tasks - The queue of tasks to perform.

initializeSuccessor

protected ViewLifecyclePhase initializeSuccessor(LifecycleElement nestedElement,
                                                 String nestedPath,
                                                 Component parent)
Define all nested lifecycle components, and component prototypes, as successors. Initializes a successor of this phase for a given nested element.

Specified by:
initializeSuccessor in class ViewLifecyclePhaseBase
Parameters:
nestedElement - The lifecycle element.
nestedPath - The path, relative to the parent element.
parent - The parent component of the nested element.
Returns:
successor phase


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.