Class LayoutManagerBase
- All Implemented Interfaces:
Serializable,Cloneable,Copyable,DictionaryBean,UifDictionaryBean,LayoutManager,LifecycleElement
- Direct Known Subclasses:
BoxLayoutManager,CollectionLayoutManagerBase,CssGridLayoutManagerBase,GridLayoutManagerBase,ListLayoutManager,SimpleLayoutManager
Provides general properties of all layout managers, such as the unique id, rendering template, and style settings
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Field Summary
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStyleClass(String styleClass) This method adds a single style class to the list of css style classes on this componentvoidappendToStyle(String styleRules) Appends to the inline style set on this layoutManagervoidcheckMutable(boolean legalDuringInitialization) Check for mutability on the element before modifying state.clone()OverrideObject.clone()to assign the public modifier.A string suffix that should get applied to the id for all child components of the given element.Context map for the lifecycle element.CSS style class(s) to be applied to the area (div) the layout manager generates for the itemsgetId()The unique id (within a given tree) for the element.Additional css classes that come before css classes listed in the cssClasses propertyMap of paths for this component that will be used to process a refresh (if necessary).List ofPropertyReplacerinstances that will be evaluated during the view lifecycle to conditional set properties on theLayoutManagerbased on expression evaluationsgetStyle()CSS style string to be applied to the area (div) the layout manager generates for the itemsBuilds the HTML class attribute string by combining the styleClasses list with a space delimiterDefault Impl Determines whatContainerclasses are supported by theLayoutManagerThe path to the JSP file that should be called to invoke the layout managerThe name for which the template can be invoked byGets a property for referring to this component from the view, relative to the view, as assigned by the current or most recent lifecycle.Indicates what lifecycle phase the layout manager instance is inbooleanisFinal()Indicates whether the component has been updated from the model and final updates made.booleanIndicates whether the component has been initialized.booleanIndicates whether the component has been updated from the model.booleanisMutable(boolean legalDuringInitialization) Determine if this lifecycle element is mutable.booleanisRender()Indicates whether the component should be rendered in the UIvoidReceive notification that a lifecycle phase, and all successor phases, have been completed on this component.voidperformApplyModel(Object model, LifecycleElement component) Called after the initialize phase to perform conditional logic based on the model datavoidperformFinalize(Object model, LifecycleElement component) The last phase before the view is renderedvoidperformInitialization(Object model) Initializes the componentvoidpushAllToContext(Map<String, Object> sourceContext) Places each entry of the given Map into the context for the componentvoidpushObjectToContext(String objectName, Object object) Places the given object into the context Map for the component with the given namevoidsetAdditionalCssClasses(List<String> additionalCssClasses) voidsetContainerIdSuffix(String containerIdSuffix) voidsetContext(Map<String, Object> context) voidsetCssClasses(List<String> cssClasses) Setter for the layout manager div style classvoidSetter for the unique id (within a given tree) for the componentvoidsetLibraryCssClasses(List<String> libraryCssClasses) Set the libraryCssClassesvoidsetPhasePathMapping(Map<String, String> phasePathMapping) voidsetPropertyReplacers(List<PropertyReplacer> propertyReplacers) Setter for the layout managers property substitutionsvoidsetRender(boolean render) Setter for the components render indicatorvoidSetter for the layout manager div stylevoidsetStyleClasses(String styleClasses) Sets the styleClasses list from the given string that has the classes delimited by space.voidsetTemplate(String template) Setter for the layout managers templatevoidsetTemplateName(String templateName) Setter for the name of the template (a name which can be used to invoke)voidsetViewPath(String viewPath) Setter forLifecycleElement.getViewPath().voidsetViewStatus(String status) Sets the view status.booleanReturn true if the lifecycle should be skipped for this component.Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressionsMethods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCodeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, getComponentCode, getNamespaceCodeMethods inherited from interface org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
-
Constructor Details
-
LayoutManagerBase
public LayoutManagerBase()
-
-
Method Details
-
checkMutable
public void checkMutable(boolean legalDuringInitialization) Description copied from interface:LifecycleElementCheck for mutability on the element before modifying state.- Specified by:
checkMutablein interfaceLifecycleElement- Parameters:
legalDuringInitialization- True if the operation is legal during view initialization, false if the operation is only allowed during the component lifecycle.- See Also:
-
isMutable
public boolean isMutable(boolean legalDuringInitialization) Description copied from interface:LifecycleElementDetermine if this lifecycle element is mutable.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.
- Specified by:
isMutablein interfaceLifecycleElement- Parameters:
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.- Returns:
- True if the component is mutable.
- See Also:
-
getViewStatus
Indicates what lifecycle phase the layout manager instance is inThe 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
- Specified by:
getViewStatusin interfaceLifecycleElement- Returns:
- view status
- See Also:
-
setViewStatus
Sets the view status.- Specified by:
setViewStatusin interfaceLifecycleElement- Parameters:
status- view status- See Also:
-
notifyCompleted
Receive notification that a lifecycle phase, and all successor phases, have been completed on this component.- Specified by:
notifyCompletedin interfaceLifecycleElement- Parameters:
phase- The completed view lifecycle phase
-
performInitialization
Initializes the componentWhere 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.
- Specified by:
performInitializationin interfaceLifecycleElement- Parameters:
model- - object instance containing the view data- See Also:
-
performApplyModel
Called after the initialize phase to perform conditional logic based on the model dataWhere components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data
- Specified by:
performApplyModelin interfaceLifecycleElement- Parameters:
model- - Top level object containing the data (could be the form or a top level business object, dto)component- parent lifecycle element
-
performFinalize
The last phase before the view is renderedHere final preparations can be made based on the updated view state.
- Specified by:
performFinalizein interfaceLifecycleElement- Parameters:
model- - top level object containing the datacomponent- - parent component
-
skipLifecycle
public boolean skipLifecycle()Return true if the lifecycle should be skipped for this component.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).
- Specified by:
skipLifecyclein interfaceLifecycleElement- Returns:
- true if lifecycle should be skipped for this component
-
getSupportedContainer
Default Impl Determines whatContainerclasses are supported by theLayoutManager- Specified by:
getSupportedContainerin interfaceLayoutManager- Returns:
- Classinvalid input: '<'? extends Container> container class supported
-
getId
The unique id (within a given tree) for the element.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.
- Specified by:
getIdin interfaceLifecycleElement- Returns:
- A unique ID for this lifecycle element.
-
setId
Setter for the unique id (within a given tree) for the component- Specified by:
setIdin interfaceLifecycleElement- Parameters:
id- - string to set as the component id
-
getContainerIdSuffix
A string suffix that should get applied to the id for all child components of the given element.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.
- Specified by:
getContainerIdSuffixin interfaceLifecycleElement- Returns:
- String id suffix for child components
- See Also:
-
setContainerIdSuffix
- Specified by:
setContainerIdSuffixin interfaceLifecycleElement- See Also:
-
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.- Specified by:
getViewPathin interfaceLifecycleElement- Returns:
- property path
-
setViewPath
Setter forLifecycleElement.getViewPath().- Specified by:
setViewPathin interfaceLifecycleElement- Parameters:
viewPath- The property path.
-
getPhasePathMapping
Map of paths for this component that will be used to process a refresh (if necessary).- Specified by:
getPhasePathMappingin interfaceLifecycleElement- Returns:
- map of refresh paths, key represents the lifecycle phase and the value is the path for the component at that phase
-
setPhasePathMapping
- Specified by:
setPhasePathMappingin interfaceLifecycleElement- See Also:
-
getTemplate
The path to the JSP file that should be called to invoke the layout managerThe 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'
- Specified by:
getTemplatein interfaceLayoutManager- Returns:
- String representing the template path
-
setTemplate
Setter for the layout managers template- Specified by:
setTemplatein interfaceLayoutManager- Parameters:
template-
-
getTemplateName
The name for which the template can be invoked byWhether 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'
- Specified by:
getTemplateNamein interfaceLayoutManager- Returns:
- template name
-
setTemplateName
Setter for the name of the template (a name which can be used to invoke)- Specified by:
setTemplateNamein interfaceLayoutManager- Parameters:
templateName-
-
getStyle
CSS style string to be applied to the area (div) the layout manager generates for the itemsNote the styleClass/style configured on the
Containerapplies to all the container content (header, body, footer), while the styleClass/style configured on theLayoutManageronly 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;'
- Specified by:
getStylein interfaceLayoutManager- Returns:
- String css style string
-
setStyle
Setter for the layout manager div style- Specified by:
setStylein interfaceLayoutManager- Parameters:
style-
-
getLibraryCssClasses
Additional css classes that come before css classes listed in the cssClasses propertyThese are used by the framework for styling with a library (for example, bootstrap), and should normally not be overridden.
- Specified by:
getLibraryCssClassesin interfaceLayoutManager- Returns:
- the library cssClasses
-
setLibraryCssClasses
Set the libraryCssClasses- Specified by:
setLibraryCssClassesin interfaceLayoutManager- Parameters:
libraryCssClasses-
-
getCssClasses
Description copied from interface:LayoutManagerCSS style class(s) to be applied to the area (div) the layout manager generates for the itemsNote the styleClass/style configured on the
Containerapplies to all the container content (header, body, footer), while the styleClass/style configured on theLayoutManageronly 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'
- Specified by:
getCssClassesin interfaceLayoutManager- Returns:
- List<String> css style classes to apply
- See Also:
-
setCssClasses
Description copied from interface:LayoutManagerSetter for the layout manager div style class- Specified by:
setCssClassesin interfaceLayoutManager- See Also:
-
getAdditionalCssClasses
- Specified by:
getAdditionalCssClassesin interfaceLayoutManager- See Also:
-
setAdditionalCssClasses
- Specified by:
setAdditionalCssClassesin interfaceLayoutManager- See Also:
-
getStyleClassesAsString
Builds the HTML class attribute string by combining the styleClasses list with a space delimiter- Returns:
- class attribute string
-
setStyleClasses
Sets the styleClasses list from the given string that has the classes delimited by space. This is a convenience for configuration. If a child bean needs to inherit the classes from the parent, it should configure as a list and use merge="true"- Parameters:
styleClasses-
-
addStyleClass
This method adds a single style class to the list of css style classes on this component- Specified by:
addStyleClassin interfaceLayoutManager
-
appendToStyle
Appends to the inline style set on this layoutManager- Specified by:
appendToStylein interfaceLayoutManager
-
getContext
Context map for the lifecycle element.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 instanceContext map also provides objects to methods that are invoked for
GeneratedFieldinstancesThe 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
- Specified by:
getContextin interfaceLifecycleElement- Returns:
- Mapinvalid input: '<'String, Object> context
-
setContext
- Specified by:
setContextin interfaceLifecycleElement- See Also:
-
pushObjectToContext
Places the given object into the context Map for the component with the given nameNote 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.- Specified by:
pushObjectToContextin interfaceLifecycleElement- Parameters:
objectName- - name the object should be exposed under in the context mapobject- - object instance to place into context
-
pushAllToContext
Places each entry of the given Map into the context for the componentNote 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()
- Specified by:
pushAllToContextin interfaceLifecycleElement- Parameters:
sourceContext- - Mapinvalid input: '<'String, Object> objects to add to context, where the entry key will be the context key and the entry value will be the context value
-
getPropertyReplacers
List ofPropertyReplacerinstances that will be evaluated during the view lifecycle to conditional set properties on theLayoutManagerbased on expression evaluations- Specified by:
getPropertyReplacersin interfaceLayoutManager- Returns:
- List<PropertyReplacer> replacers to evaluate
-
setPropertyReplacers
Setter for the layout managers property substitutions- Specified by:
setPropertyReplacersin interfaceLayoutManager
-
clone
Description copied from interface:CopyableOverrideObject.clone()to assign the public modifier.- Specified by:
clonein interfaceCopyable- Overrides:
clonein classDictionaryBeanBase- Returns:
Object.clone()- Throws:
CloneNotSupportedException- IfCloneableis not implemented. This should not be possible when using this interface.- See Also:
-
isInitialized
public boolean isInitialized()Indicates whether the component has been initialized.- Specified by:
isInitializedin interfaceLifecycleElement- Returns:
- True if the component has been initialized, false if not.
-
isModelApplied
public boolean isModelApplied()Indicates whether the component has been updated from the model.- Specified by:
isModelAppliedin interfaceLifecycleElement- Returns:
- True if the component has been updated, false if not.
-
isFinal
public boolean isFinal()Indicates whether the component has been updated from the model and final updates made.- Specified by:
isFinalin interfaceLifecycleElement- Returns:
- True if the component has been updated, false if not.
-
isRender
public boolean isRender()Indicates whether the component should be rendered in the UIIf set to false, the corresponding component template will not be invoked (therefore nothing will be rendered to the UI).
- Specified by:
isRenderin interfaceLifecycleElement- Returns:
- boolean true if the component should be rendered, false if it should not be
-
setRender
public void setRender(boolean render) Setter for the components render indicator- Specified by:
setRenderin interfaceLifecycleElement- Parameters:
render-
-