Class ViewLifecyclePhaseBase
- All Implemented Interfaces:
Runnable,LifecycleElementState,ViewLifecyclePhase
- Direct Known Subclasses:
ApplyModelComponentPhase,FinalizeComponentPhase,InitializeComponentPhase,PreProcessElementPhase,RenderComponentPhase
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the task currently running.intgetDepth()Gets the depth of the element in the lifecycle tree.final LifecycleElementGets the element this lifecycle phase is responsible for processing.Determines the list of child properties for the current phase component that are in the refresh paths and should be processed next.final ComponentRetrieves the component that is a parent to the element being processed in the view three.Gets the path relative the predecessor phase's component.Gets the lifecycle phase that directly precedes this phase.During a component refresh, returns the list of view paths the lifecycle phase will be processed on.Gets the path relative to the view.booleanDetermines of there are any pending successors of this phase.protected voidinitializeAllLifecycleSuccessors(Queue<ViewLifecyclePhase> successors) Initializes all lifecycle phase successors.protected voidinitializeRefreshPathSuccessors(Queue<ViewLifecyclePhase> successors) Initializes only the lifecycle successors referenced by paths withingetRefreshPaths().protected ViewLifecyclePhaseinitializeSuccessor(LifecycleElement nestedElement, String nestedPath, Component nestedParent) Initializes a successor of this phase for a given nested element.protected voidinitializeSuccessors(Queue<ViewLifecyclePhase> successors) Initializes queue of successor phases.final booleanDetermines if this lifecycle phase and all successor phases, have completed processing.final booleanDetermines if this lifecycle phase has completed processing.final voidNotifies predecessors that this task has completed.voidPrepares a phase for use after being recycled (state cleared).protected voidprocessSuccessors(Queue<ViewLifecyclePhase> successors) Adds phases added as successors to the processor, or if there are no pending successors invokes the complete notification step.voidrecycle()Resets this phase for recycling.voidremovePendingSuccessor(String parentPath) Remove a pending successor by path.final voidrun()Executes the lifecycle phase.voidsetNextPhase(ViewLifecyclePhase nextPhase) Sets the next phase, to queue for processing after this phase is completed.voidsetPredecessor(ViewLifecyclePhase phase) Sets the predecessor, for notification during processing.voidsetRefreshPaths(List<String> refreshPaths) Sets the refresh paths for this phase.voidsetSkipLifecycleTasks(List<ViewLifecycleTask<?>> skipLifecycleTasks) Sets the tasks to process at this phase when the lifecycle is skipped.voidsetTasks(List<ViewLifecycleTask<?>> tasks) Sets the tasks to process at this phase.voidsetViewPath(String viewPath) protected booleanIndicates whether the lifecycle should be skipped for the current component.toString()protected voidLogs a trace message related to processing this lifecycle, when tracing is active and debugging is enabled.protected voidValidates this phase and thread state before processing and logs activity.protected voidMay be overridden in order to check for illegal state based on more concrete assumptions than can be made here.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.uif.lifecycle.LifecycleElementState
getViewPhaseMethods inherited from interface org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhase
getEndViewStatus, getEventToNotify, getStartViewStatus
-
Constructor Details
-
ViewLifecyclePhaseBase
public ViewLifecyclePhaseBase()
-
-
Method Details
-
recycle
public void recycle()Resets this phase for recycling.- Specified by:
recyclein interfaceViewLifecyclePhase
-
prepare
public void prepare(LifecycleElement element, Component parent, String parentPath, List<String> refreshPaths) Prepares a phase for use after being recycled (state cleared).- Specified by:
preparein interfaceViewLifecyclePhase- Parameters:
element- lifecycle element to prepareparent- parent componentparentPath- path of the element related to its parent (in other words the property of the parent that holds this element)refreshPaths- during a component refresh request, the list of view paths that should be processed by the phase (this includes a subset of the entire view tree)
-
run
public final void run()Executes the lifecycle phase.Performs state validation and updates component view status.
-
shouldSkipLifecycle
protected boolean shouldSkipLifecycle()Indicates whether the lifecycle should be skipped for the current component.Elements are always processed in the pre process phase, or in the case of the element or one of its childs being refreshed. If these conditions are false, the element method
LifecycleElement.skipLifecycle()is invoked to determine if the lifecycle can be skipped.- Returns:
- boolean true if the lifecycle should be skipped, false if not
- See Also:
-
validateBeforeProcessing
protected void validateBeforeProcessing()Validates this phase and thread state before processing and logs activity.- See Also:
-
processSuccessors
Adds phases added as successors to the processor, or if there are no pending successors invokes the complete notification step.- Parameters:
successors- phases to process
-
setNextPhase
Sets the next phase, to queue for processing after this phase is completed.- Specified by:
setNextPhasein interfaceViewLifecyclePhase- Parameters:
nextPhase- next phase
-
setTasks
Sets the tasks to process at this phase.- Parameters:
tasks- list of tasks
-
setSkipLifecycleTasks
Sets the tasks to process at this phase when the lifecycle is skipped.- Parameters:
skipLifecycleTasks- list of tasks
-
initializeSuccessors
Initializes queue of successor phases.This method will be called while processing this phase after all tasks have been performed, to determine phases to queue for successor processing. This phase will not be considered complete until all successors queued by this method, and all subsequent successor phases, have completed processing.
- Parameters:
successors- The queue of successor phases
-
setRefreshPaths
Sets the refresh paths for this phase.- Specified by:
setRefreshPathsin interfaceViewLifecyclePhase- Parameters:
refreshPaths- list of refresh paths.
-
getRefreshPaths
Description copied from interface:ViewLifecyclePhaseDuring a component refresh, returns the list of view paths the lifecycle phase will be processed on.- Specified by:
getRefreshPathsin interfaceViewLifecyclePhase- Returns:
- list of view paths
-
initializeRefreshPathSuccessors
Initializes only the lifecycle successors referenced by paths withingetRefreshPaths().- Parameters:
successors- the successor queue
-
getNestedPropertiesForRefreshPath
Determines the list of child properties for the current phase component that are in the refresh paths and should be processed next.- Returns:
- list of property names relative to the component the phase is currently processing
-
initializeAllLifecycleSuccessors
Initializes all lifecycle phase successors.- Parameters:
successors- The successor queue.
-
verifyCompleted
protected void verifyCompleted()May be overridden in order to check for illegal state based on more concrete assumptions than can be made here.- Throws:
IllegalStateException- If the conditions for completing the lifecycle phase have not been met
-
initializeSuccessor
protected ViewLifecyclePhase initializeSuccessor(LifecycleElement nestedElement, String nestedPath, Component nestedParent) Initializes a successor of this phase for a given nested element.- Parameters:
nestedElement- The lifecycle elementnestedPath- The path, relative to the parent elementnestedParent- The parent component of the nested element refresh)- Returns:
- successor phase
-
notifyCompleted
public final void notifyCompleted()Notifies predecessors that this task has completed.- Specified by:
notifyCompletedin interfaceViewLifecyclePhase
-
getElement
Gets the element this lifecycle phase is responsible for processing.- Specified by:
getElementin interfaceLifecycleElementState- Returns:
- element this lifecycle phase is responsible for processing
-
getParent
Retrieves the component that is a parent to the element being processed in the view three.- Specified by:
getParentin interfaceViewLifecyclePhase- Returns:
- parent component
-
getParentPath
Gets the path relative the predecessor phase's component.- Specified by:
getParentPathin interfaceLifecycleElementState- Returns:
- path relative the predecessor phase's component
-
getViewPath
Gets the path relative to the view.- Specified by:
getViewPathin interfaceLifecycleElementState- Returns:
- path relative the the view
-
setViewPath
- Parameters:
viewPath- the viewPath to set
-
getDepth
public int getDepth()Gets the depth of the element in the lifecycle tree.- Specified by:
getDepthin interfaceLifecycleElementState- Returns:
- The depth of the element in the lifecycle tree.
-
isProcessed
public final boolean isProcessed()Determines if this lifecycle phase has completed processing.This method will return true when this phase's tasks have been processed, but does not necessarily indicate that successor phases have been completed. Use
ViewLifecyclePhase.isComplete()to determine if the lifecycle has been fully completed for this phase.- Specified by:
isProcessedin interfaceViewLifecyclePhase- Returns:
- true if this phase has been processed, false if not
-
isComplete
public final boolean isComplete()Determines if this lifecycle phase and all successor phases, have completed processing.- Specified by:
isCompletein interfaceViewLifecyclePhase- Returns:
- true if this phase and all successor phases have been processed, false if not
- See Also:
-
getPredecessor
Gets the lifecycle phase that directly precedes this phase.- Specified by:
getPredecessorin interfaceViewLifecyclePhase- Returns:
- lifecycle phase that directly precedes this phase
-
setPredecessor
Sets the predecessor, for notification during processing.- Specified by:
setPredecessorin interfaceViewLifecyclePhase- Parameters:
phase- predecessor phase
-
getCurrentTask
Gets the task currently running.- Specified by:
getCurrentTaskin interfaceViewLifecyclePhase- Returns:
- the task currently running, null if this phase is not active.
-
hasPendingSuccessors
public boolean hasPendingSuccessors()Determines of there are any pending successors of this phase.- Specified by:
hasPendingSuccessorsin interfaceViewLifecyclePhase- Returns:
- True if there are pending successors, false if no successors are pending.
-
removePendingSuccessor
Remove a pending successor by path.- Specified by:
removePendingSuccessorin interfaceViewLifecyclePhase- Parameters:
parentPath- path
-
toString
-
trace
Logs a trace message related to processing this lifecycle, when tracing is active and debugging is enabled.- Parameters:
step- The step in processing the phase that has been reached.- See Also:
-