public abstract class ViewLifecyclePhaseBase extends Object implements ViewLifecyclePhase
Constructor and Description |
---|
ViewLifecyclePhaseBase() |
Modifier and Type | Method and Description |
---|---|
ViewLifecycleTask<?> |
getCurrentTask()
Gets the task currently running.
|
int |
getDepth()
Gets the depth of the element in the lifecycle tree.
|
LifecycleElement |
getElement()
Gets the element this lifecycle phase is responsible for processing.
|
protected List<String> |
getNestedPropertiesForRefreshPath()
Determines the list of child properties for the current phase component that are in the refresh
paths and should be processed next.
|
Component |
getParent()
Retrieves the component that is a parent to the element being processed in the
view three.
|
String |
getParentPath()
Gets the path relative the predecessor phase's component.
|
ViewLifecyclePhase |
getPredecessor()
Gets the lifecycle phase that directly precedes this phase.
|
List<String> |
getRefreshPaths()
During a component refresh, returns the list of view paths the lifecycle phase will be processed on.
|
String |
getViewPath()
Gets the path relative to the view.
|
boolean |
hasPendingSuccessors()
Determines of there are any pending successors of this phase.
|
protected void |
initializeAllLifecycleSuccessors(Queue<ViewLifecyclePhase> successors)
Initializes all lifecycle phase successors.
|
protected void |
initializeRefreshPathSuccessors(Queue<ViewLifecyclePhase> successors)
Initializes only the lifecycle successors referenced by paths within
getRefreshPaths() . |
protected ViewLifecyclePhase |
initializeSuccessor(LifecycleElement nestedElement,
String nestedPath,
Component nestedParent)
Initializes a successor of this phase for a given nested element.
|
protected void |
initializeSuccessors(Queue<ViewLifecyclePhase> successors)
Initializes queue of successor phases.
|
boolean |
isComplete()
Determines if this lifecycle phase and all successor phases, have completed processing.
|
boolean |
isProcessed()
Determines if this lifecycle phase has completed processing.
|
void |
notifyCompleted()
Notifies predecessors that this task has completed.
|
void |
prepare(LifecycleElement element,
Component parent,
String parentPath,
List<String> refreshPaths)
Prepares a phase for use after being recycled (state cleared).
|
protected void |
processSuccessors(Queue<ViewLifecyclePhase> successors)
Adds phases added as successors to the processor, or if there are no pending successors invokes
the complete notification step.
|
void |
recycle()
Resets this phase for recycling.
|
void |
removePendingSuccessor(String parentPath)
Remove a pending successor by path.
|
void |
run()
Executes the lifecycle phase.
|
void |
setNextPhase(ViewLifecyclePhase nextPhase)
Sets the next phase, to queue for processing after this phase is completed.
|
void |
setPredecessor(ViewLifecyclePhase phase)
Sets the predecessor, for notification during processing.
|
void |
setRefreshPaths(List<String> refreshPaths)
Sets the refresh paths for this phase.
|
void |
setSkipLifecycleTasks(List<ViewLifecycleTask<?>> skipLifecycleTasks)
Sets the tasks to process at this phase when the lifecycle is skipped.
|
void |
setTasks(List<ViewLifecycleTask<?>> tasks)
Sets the tasks to process at this phase.
|
void |
setViewPath(String viewPath) |
protected boolean |
shouldSkipLifecycle()
Indicates whether the lifecycle should be skipped for the current component.
|
String |
toString() |
protected void |
trace(String step)
Logs a trace message related to processing this lifecycle, when tracing is active and
debugging is enabled.
|
protected void |
validateBeforeProcessing()
Validates this phase and thread state before processing and logs activity.
|
protected void |
verifyCompleted()
May be overridden in order to check for illegal state based on more concrete assumptions than
can be made here.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndViewStatus, getEventToNotify, getStartViewStatus
getViewPhase
public ViewLifecyclePhaseBase()
public void recycle()
recycle
in interface ViewLifecyclePhase
public void prepare(LifecycleElement element, Component parent, String parentPath, List<String> refreshPaths)
prepare
in interface ViewLifecyclePhase
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)public final void run()
Performs state validation and updates component view status.
run
in interface Runnable
Runnable.run()
protected boolean shouldSkipLifecycle()
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.
LifecycleElement.skipLifecycle()
protected void validateBeforeProcessing()
run()
protected void processSuccessors(Queue<ViewLifecyclePhase> successors)
successors
- phases to processpublic void setNextPhase(ViewLifecyclePhase nextPhase)
setNextPhase
in interface ViewLifecyclePhase
nextPhase
- next phasepublic void setTasks(List<ViewLifecycleTask<?>> tasks)
tasks
- list of taskspublic void setSkipLifecycleTasks(List<ViewLifecycleTask<?>> skipLifecycleTasks)
skipLifecycleTasks
- list of tasksprotected void initializeSuccessors(Queue<ViewLifecyclePhase> successors)
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.
successors
- The queue of successor phasespublic void setRefreshPaths(List<String> refreshPaths)
setRefreshPaths
in interface ViewLifecyclePhase
refreshPaths
- list of refresh paths.public List<String> getRefreshPaths()
ViewLifecyclePhase
getRefreshPaths
in interface ViewLifecyclePhase
protected void initializeRefreshPathSuccessors(Queue<ViewLifecyclePhase> successors)
getRefreshPaths()
.successors
- the successor queueprotected List<String> getNestedPropertiesForRefreshPath()
protected void initializeAllLifecycleSuccessors(Queue<ViewLifecyclePhase> successors)
successors
- The successor queue.protected void verifyCompleted()
IllegalStateException
- If the conditions for completing the lifecycle phase have not been metprotected ViewLifecyclePhase initializeSuccessor(LifecycleElement nestedElement, String nestedPath, Component nestedParent)
nestedElement
- The lifecycle elementnestedPath
- The path, relative to the parent elementnestedParent
- The parent component of the nested element
refresh)public final void notifyCompleted()
notifyCompleted
in interface ViewLifecyclePhase
public final LifecycleElement getElement()
getElement
in interface LifecycleElementState
public final Component getParent()
getParent
in interface ViewLifecyclePhase
public String getParentPath()
getParentPath
in interface LifecycleElementState
public String getViewPath()
getViewPath
in interface LifecycleElementState
public void setViewPath(String viewPath)
viewPath
- the viewPath to setpublic int getDepth()
getDepth
in interface LifecycleElementState
public final boolean isProcessed()
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.
isProcessed
in interface ViewLifecyclePhase
public final boolean isComplete()
isComplete
in interface ViewLifecyclePhase
LifecycleElement.notifyCompleted(ViewLifecyclePhase)
public ViewLifecyclePhase getPredecessor()
getPredecessor
in interface ViewLifecyclePhase
public void setPredecessor(ViewLifecyclePhase phase)
setPredecessor
in interface ViewLifecyclePhase
phase
- predecessor phasepublic ViewLifecycleTask<?> getCurrentTask()
getCurrentTask
in interface ViewLifecyclePhase
public boolean hasPendingSuccessors()
hasPendingSuccessors
in interface ViewLifecyclePhase
public void removePendingSuccessor(String parentPath)
removePendingSuccessor
in interface ViewLifecyclePhase
parentPath
- pathprotected void trace(String step)
step
- The step in processing the phase that has been reached.ViewLifecycle.isTrace()
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.