public interface LifecycleElement extends Serializable, Copyable
Modifier and Type | Method and Description |
---|---|
void |
checkMutable(boolean legalDuringInitialization)
Check for mutability on the element before modifying state.
|
String |
getContainerIdSuffix()
A string suffix that should get applied to the id for all child components of the given element.
|
Map<String,Object> |
getContext()
Context map for the lifecycle element.
|
String |
getId()
The unique id (within a given tree) for the element.
|
Map<String,String> |
getPhasePathMapping()
Map of paths for this component that will be used to process a refresh (if necessary).
|
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.
|
String |
getViewStatus()
Get the view lifecycle processing status for this component.
|
boolean |
isFinal()
Indicates whether the component has been updated from the model and final
updates made.
|
boolean |
isInitialized()
Indicates whether the component has been initialized.
|
boolean |
isModelApplied()
Indicates whether the component has been updated from the model.
|
boolean |
isMutable(boolean legalBeforeConfiguration)
Determine if this lifecycle element is mutable.
|
boolean |
isRender()
Indicates whether the component should be rendered in the UI
|
void |
notifyCompleted(ViewLifecyclePhase phase)
Receive notification that a lifecycle phase, and all successor phases, have been completed on
this component.
|
void |
performApplyModel(Object model,
LifecycleElement parent)
Deprecated.
Special processing within this method should be replaced by
ViewLifecycleTask and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue) . |
void |
performFinalize(Object model,
LifecycleElement parent)
Deprecated.
Special processing within this method should be replaced by
ViewLifecycleTask and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue) . |
void |
performInitialization(Object model)
Deprecated.
Special processing within this method should be replaced by
ViewLifecycleTask and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue) . |
void |
pushAllToContext(Map<String,Object> objects)
Places each entry of the given Map into the context for the component
|
void |
pushObjectToContext(String objectName,
Object object)
Places the given object into the context Map for the component with the given name
|
void |
setContainerIdSuffix(String containerIdSuffix) |
void |
setContext(Map<String,Object> context) |
void |
setId(String id)
Setter for the unique id (within a given tree) for the component
|
void |
setPhasePathMapping(Map<String,String> phasePathMapping) |
void |
setRender(boolean render)
Setter for the components render indicator
|
void |
setViewPath(String viewPath)
Setter for
getViewPath() . |
void |
setViewStatus(String viewStatus)
Sets the view status.
|
boolean |
skipLifecycle()
Return true if the lifecycle should be skipped for this component.
|
String getId()
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.
void setId(String id)
id
- - string to set as the component idString getContainerIdSuffix()
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.
SuffixIdFromContainerTask
void setContainerIdSuffix(String containerIdSuffix)
getContainerIdSuffix()
String getViewPath()
void setViewPath(String viewPath)
getViewPath()
.viewPath
- The property path.Map<String,String> getPhasePathMapping()
void setPhasePathMapping(Map<String,String> phasePathMapping)
getPhasePathMapping()
boolean isMutable(boolean legalBeforeConfiguration)
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.
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.void checkMutable(boolean legalDuringInitialization)
legalDuringInitialization
- True if the operation is legal during view initialization,
false if the operation is only allowed during the component lifecycle.IllegalStateException
- If the component is not mutable and the lifecycle is operating
in strict mode.ViewLifecycle.isStrict()
String getViewStatus()
UifConstants.ViewStatus
void setViewStatus(String viewStatus)
viewStatus
- view statusgetViewStatus()
boolean isRender()
If set to false, the corresponding component template will not be invoked (therefore nothing will be rendered to the UI).
void setRender(boolean render)
render
- boolean isInitialized()
boolean isModelApplied()
boolean isFinal()
void notifyCompleted(ViewLifecyclePhase phase)
phase
- The completed view lifecycle phaseMap<String,Object> getContext()
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
void setContext(Map<String,Object> context)
getContext()
void pushObjectToContext(String objectName, Object object)
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.
objectName
- - name the object should be exposed under in the context mapobject
- - object instance to place into contextvoid pushAllToContext(Map<String,Object> objects)
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()
objects
- - Map@Deprecated void performInitialization(Object model)
ViewLifecycleTask
and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue)
.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.
model
- - object instance containing the view dataComponentDefaultInitializeTask
@Deprecated void performApplyModel(Object model, LifecycleElement parent)
ViewLifecycleTask
and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue)
.Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data
model
- - Top level object containing the data (could be the form or a
top level business object, dto)parent
- parent lifecycle element@Deprecated void performFinalize(Object model, LifecycleElement parent)
ViewLifecycleTask
and initialized by
#initializePendingTasks(ViewLifecyclePhase, Queue)
.Here final preparations can be made based on the updated view state.
model
- - top level object containing the dataparent
- - parent componentboolean skipLifecycle()
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).
Copyright © 2005–2014 The Kuali Foundation. All rights reserved.