public abstract class LayoutManagerBase extends UifDictionaryBeanBase implements LayoutManager
Provides general properties of all layout managers, such as the unique id, rendering template, and style settings
componentCode, namespaceCode
Constructor and Description |
---|
LayoutManagerBase() |
Modifier and Type | Method and Description |
---|---|
void |
addStyleClass(String styleClass)
This method adds a single style class to the list of css style classes on this component
|
void |
appendToStyle(String styleRules)
Appends to the inline style set on this layoutManager
|
void |
checkMutable(boolean legalDuringInitialization)
Check for mutability on the element before modifying state.
|
LayoutManagerBase |
clone()
Override
Object.clone() to assign the public modifier. |
List<String> |
getAdditionalCssClasses() |
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.
|
List<String> |
getCssClasses()
CSS style class(s) to be applied to the area (div) the layout manager
generates for the items
|
String |
getId()
The unique id (within a given tree) for the element.
|
List<String> |
getLibraryCssClasses()
Additional css classes that come before css classes listed in the cssClasses property
|
Map<String,String> |
getPhasePathMapping()
Map of paths for this component that will be used to process a refresh (if necessary).
|
List<PropertyReplacer> |
getPropertyReplacers()
List of
PropertyReplacer instances that will be
evaluated during the view lifecycle to conditional set properties on the
LayoutManager based on expression evaluations |
String |
getStyle()
CSS style string to be applied to the area (div) the layout manager
generates for the items
|
String |
getStyleClassesAsString()
Builds the HTML class attribute string by combining the styleClasses list
with a space delimiter
|
Class<? extends Container> |
getSupportedContainer()
Default Impl
Determines what
Container classes are supported by the
LayoutManager |
String |
getTemplate()
The path to the JSP file that should be called to invoke the layout
manager
|
String |
getTemplateName()
The name for which the template can be invoked by
|
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()
Indicates what lifecycle phase the layout manager instance is in
|
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 legalDuringInitialization)
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 component)
Called after the initialize phase to perform conditional logic based on the model data
|
void |
performFinalize(Object model,
LifecycleElement component)
The last phase before the view is rendered
|
void |
performInitialization(Object model)
Initializes the component
|
void |
pushAllToContext(Map<String,Object> sourceContext)
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 |
setAdditionalCssClasses(List<String> additionalCssClasses) |
void |
setContainerIdSuffix(String containerIdSuffix) |
void |
setContext(Map<String,Object> context) |
void |
setCssClasses(List<String> cssClasses)
Setter for the layout manager div style class
|
void |
setId(String id)
Setter for the unique id (within a given tree) for the component
|
void |
setLibraryCssClasses(List<String> libraryCssClasses)
Set the libraryCssClasses
|
void |
setPhasePathMapping(Map<String,String> phasePathMapping) |
void |
setPropertyReplacers(List<PropertyReplacer> propertyReplacers)
Setter for the layout managers property substitutions
|
void |
setRender(boolean render)
Setter for the components render indicator
|
void |
setStyle(String style)
Setter for the layout manager div style
|
void |
setStyleClasses(String styleClasses)
Sets the styleClasses list from the given string that has the classes
delimited by space.
|
void |
setTemplate(String template)
Setter for the layout managers template
|
void |
setTemplateName(String templateName)
Setter for the name of the template (a name which can be used to invoke)
|
void |
setViewPath(String viewPath)
Setter for
LifecycleElement.getViewPath() . |
void |
setViewStatus(String status)
Sets the view status.
|
boolean |
skipLifecycle()
Return true if the lifecycle should be skipped for this component.
|
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCode
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
dataDictionaryPostProcessing, getComponentCode, getNamespaceCode
public LayoutManagerBase()
public void checkMutable(boolean legalDuringInitialization)
LifecycleElement
checkMutable
in interface LifecycleElement
legalDuringInitialization
- True if the operation is legal during view initialization,
false if the operation is only allowed during the component lifecycle.LifecycleElement.checkMutable(boolean)
public boolean isMutable(boolean legalDuringInitialization)
LifecycleElement
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.
isMutable
in interface LifecycleElement
legalDuringInitialization
- 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.LifecycleElement.isMutable(boolean)
public String getViewStatus()
The view lifecycle begins with the CREATED status. In this status a new instance of the view has been retrieved from the dictionary, but no further processing has been done. After the initialize phase has been run the status changes to INITIALIZED. After the model has been applied and the view is ready for render the status changes to FINAL
getViewStatus
in interface LifecycleElement
UifConstants.ViewStatus
public void setViewStatus(String status)
setViewStatus
in interface LifecycleElement
status
- view statusLifecycleElement.getViewStatus()
public void notifyCompleted(ViewLifecyclePhase phase)
notifyCompleted
in interface LifecycleElement
phase
- The completed view lifecycle phasepublic void performInitialization(Object model)
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.
performInitialization
in interface LifecycleElement
model
- - object instance containing the view dataComponentDefaultInitializeTask
public void performApplyModel(Object model, LifecycleElement component)
Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data
performApplyModel
in interface LifecycleElement
model
- - Top level object containing the data (could be the form or a
top level business object, dto)component
- parent lifecycle elementpublic void performFinalize(Object model, LifecycleElement component)
Here final preparations can be made based on the updated view state.
performFinalize
in interface LifecycleElement
model
- - top level object containing the datacomponent
- - parent componentpublic boolean 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).
skipLifecycle
in interface LifecycleElement
public Class<? extends Container> getSupportedContainer()
Container
classes are supported by the
LayoutManager
getSupportedContainer
in interface LayoutManager
public 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.
getId
in interface LifecycleElement
public void setId(String id)
setId
in interface LifecycleElement
id
- - string to set as the component idpublic String 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.
getContainerIdSuffix
in interface LifecycleElement
SuffixIdFromContainerTask
public void setContainerIdSuffix(String containerIdSuffix)
setContainerIdSuffix
in interface LifecycleElement
LifecycleElement.getContainerIdSuffix()
public String getViewPath()
getViewPath
in interface LifecycleElement
public void setViewPath(String viewPath)
LifecycleElement.getViewPath()
.setViewPath
in interface LifecycleElement
viewPath
- The property path.public Map<String,String> getPhasePathMapping()
getPhasePathMapping
in interface LifecycleElement
public void setPhasePathMapping(Map<String,String> phasePathMapping)
setPhasePathMapping
in interface LifecycleElement
LifecycleElement.getPhasePathMapping()
public String getTemplate()
The path should be relative to the web root. All layout manager templates receive the list of items of be placed, the configured layout manager, and the container to which the layout manager applies
e.g. '/krad/WEB-INF/jsp/tiles/boxLayout.jsp'
getTemplate
in interface LayoutManager
public void setTemplate(String template)
setTemplate
in interface LayoutManager
public String getTemplateName()
Whether the template name is needed depends on the underlying rendering engine being used. In the example of Freemarker, the template points to the actual source file, which then loads a macro. From then on the macro is simply invoked to execute the template
e.g. 'uif_grid'
getTemplateName
in interface LayoutManager
public void setTemplateName(String templateName)
setTemplateName
in interface LayoutManager
public String getStyle()
Note the styleClass/style configured on the Container
applies to all the container content (header, body, footer), while the
styleClass/style configured on the LayoutManager
only
applies to the div surrounding the items placed by the manager (the
container's body)
Any style override or additions can be specified with this attribute. This is used by the renderer to set the style attribute on the corresponding element.
e.g. 'color: #000000;text-decoration: underline;'
getStyle
in interface LayoutManager
public void setStyle(String style)
setStyle
in interface LayoutManager
public List<String> getLibraryCssClasses()
These are used by the framework for styling with a library (for example, bootstrap), and should normally not be overridden.
getLibraryCssClasses
in interface LayoutManager
public void setLibraryCssClasses(List<String> libraryCssClasses)
setLibraryCssClasses
in interface LayoutManager
libraryCssClasses
- public List<String> getCssClasses()
LayoutManager
Note the styleClass/style configured on the Container
applies to all the container content (header, body, footer), while the
styleClass/style configured on the LayoutManager
only
applies to the div surrounding the items placed by the manager (the
container's body)
Declares additional style classes for the div. Multiple classes are specified with a space delimiter. This is used by the renderer to set the class attribute on the corresponding element. The class(s) declared must be available in the common style sheets or the style sheets specified for the view
e.g. 'header left'
getCssClasses
in interface LayoutManager
LayoutManager.getCssClasses()
public void setCssClasses(List<String> cssClasses)
LayoutManager
setCssClasses
in interface LayoutManager
LayoutManager.setCssClasses(java.util.List)
public List<String> getAdditionalCssClasses()
getAdditionalCssClasses
in interface LayoutManager
LayoutManager.getAdditionalCssClasses()
public void setAdditionalCssClasses(List<String> additionalCssClasses)
setAdditionalCssClasses
in interface LayoutManager
LayoutManager.setAdditionalCssClasses(java.util.List)
public String getStyleClassesAsString()
public void setStyleClasses(String styleClasses)
styleClasses
- public void addStyleClass(String styleClass)
addStyleClass
in interface LayoutManager
public void appendToStyle(String styleRules)
appendToStyle
in interface LayoutManager
public Map<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
getContext
in interface LifecycleElement
public void setContext(Map<String,Object> context)
setContext
in interface LifecycleElement
LifecycleElement.getContext()
public 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.
pushObjectToContext
in interface LifecycleElement
objectName
- - name the object should be exposed under in the context mapobject
- - object instance to place into contextpublic void pushAllToContext(Map<String,Object> sourceContext)
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()
pushAllToContext
in interface LifecycleElement
sourceContext
- - Mappublic List<PropertyReplacer> getPropertyReplacers()
PropertyReplacer
instances that will be
evaluated during the view lifecycle to conditional set properties on the
LayoutManager
based on expression evaluationsgetPropertyReplacers
in interface LayoutManager
public void setPropertyReplacers(List<PropertyReplacer> propertyReplacers)
setPropertyReplacers
in interface LayoutManager
public LayoutManagerBase clone() throws CloneNotSupportedException
Copyable
Object.clone()
to assign the public modifier.clone
in interface Copyable
clone
in class DictionaryBeanBase
Object.clone()
CloneNotSupportedException
- If Cloneable
is not implemented. This should not
be possible when using this interface.Copyable.clone()
public boolean isInitialized()
isInitialized
in interface LifecycleElement
public boolean isModelApplied()
isModelApplied
in interface LifecycleElement
public boolean isFinal()
isFinal
in interface LifecycleElement
public boolean isRender()
If set to false, the corresponding component template will not be invoked (therefore nothing will be rendered to the UI).
isRender
in interface LifecycleElement
public void setRender(boolean render)
setRender
in interface LifecycleElement
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.