Class LayoutImpl
- java.lang.Object
-
- org.nuxeo.ecm.platform.forms.layout.api.impl.LayoutImpl
-
- All Implemented Interfaces:
Serializable,Layout
public class LayoutImpl extends Object implements Layout
Implementation for layouts.- Author:
- Anahide Tchertchian
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intcolumnsprotected LayoutDefinitiondefinitionprotected StringdefinitionIdprotected StringdevTemplateprotected booleandynamicprotected Stringidprotected Stringmodeprotected Stringnameprotected Map<String,Serializable>propertiesprotected LayoutRow[]rowsprotected Stringtemplateprotected Stringtypeprotected StringtypeCategoryprotected StringvalueNameprotected Map<String,Widget>widgetMap
-
Constructor Summary
Constructors Modifier Constructor Description protectedLayoutImpl()LayoutImpl(String name, String mode, String template, List<LayoutRow> rows, int columns, Map<String,Serializable> properties, String definitionId)LayoutImpl(String name, String mode, String template, Map<String,Widget> widgets, Map<String,Serializable> properties, String definitionId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeWidgetMap()intgetColumns()Returns the maximum number of columns.LayoutDefinitiongetDefinition()Returns the definition from which this layout instance was generated.StringgetDevTemplate()Returns the template to use for dev mode.StringgetId()Returns the layout id, unique within the facelet context.StringgetMode()Returns the layout mode.StringgetName()Returns the layout name used to identify it within the layout service.Map<String,Serializable>getProperties()Get properties to use in this mode.SerializablegetProperty(String name)Returns property with given name in this mode.LayoutRow[]getRows()Returns the table of widgets.StringgetTagConfigId()Returns the unique identifier of this widget to be used in tag configuration.StringgetTemplate()Returns the template used to render widgets.StringgetType()Returns the layout type.StringgetTypeCategory()Returns the layout type category.StringgetValueName()Gets the value name used to compute widget attributes.WidgetgetWidget(String name)Returns widget with given name.Map<String,Widget>getWidgetMap()Returns a widget map, with widget name as key.booleanisDynamic()Return true if this layout was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.voidsetDefinition(LayoutDefinition definition)voidsetDevTemplate(String devTemplate)voidsetDynamic(boolean dynamic)voidsetId(String id)Sets the layout id, unique within the facelet context.voidsetProperty(String name, Serializable value)Sets property with given name on the layout.voidsetType(String type)voidsetTypeCategory(String typeCategory)voidsetValueName(String valueName)Sets the value name used to compute widget bindings.StringtoString()
-
-
-
Field Detail
-
id
protected String id
-
name
protected String name
-
type
protected String type
-
typeCategory
protected String typeCategory
-
mode
protected String mode
-
template
protected String template
-
devTemplate
protected String devTemplate
-
rows
protected LayoutRow[] rows
-
columns
protected int columns
-
properties
protected Map<String,Serializable> properties
-
definitionId
protected String definitionId
-
valueName
protected String valueName
-
dynamic
protected boolean dynamic
-
definition
protected LayoutDefinition definition
-
-
Method Detail
-
computeWidgetMap
protected void computeWidgetMap()
-
getId
public String getId()
Description copied from interface:LayoutReturns the layout id, unique within the facelet context.
-
getTagConfigId
public String getTagConfigId()
Description copied from interface:LayoutReturns the unique identifier of this widget to be used in tag configuration.In JSF, layouts are rendered dynamically and re-use the tag configuration of the tag rendering them when adding handlers to the facelet hierarchy. Since this tag identifier is used to perform some kind of caching on the JSF layer, it needs to change when the layout definition changes, so that JSF components are not mistaken for another one.
This identifier is unique to a given layout definition and always returns the same result given the same layout definition.
- Specified by:
getTagConfigIdin interfaceLayout
-
setId
public void setId(String id)
Description copied from interface:LayoutSets the layout id, unique within the facelet context.
-
getName
public String getName()
Description copied from interface:LayoutReturns the layout name used to identify it within the layout service.
-
getTemplate
public String getTemplate()
Description copied from interface:LayoutReturns the template used to render widgets.- Specified by:
getTemplatein interfaceLayout
-
getRows
public LayoutRow[] getRows()
Description copied from interface:LayoutReturns the table of widgets.This list is computed from the
LayoutDefinitionrows.Widgets that are not found are ignored.
-
getColumns
public int getColumns()
Description copied from interface:LayoutReturns the maximum number of columns.- Specified by:
getColumnsin interfaceLayout
-
getWidget
public Widget getWidget(String name)
Description copied from interface:LayoutReturns widget with given name.Only widgets of the first level are retrieved.
-
getWidgetMap
public Map<String,Widget> getWidgetMap()
Description copied from interface:LayoutReturns a widget map, with widget name as key.Only widgets of the first level are retrieved.
- Specified by:
getWidgetMapin interfaceLayout
-
getProperties
public Map<String,Serializable> getProperties()
Description copied from interface:LayoutGet properties to use in this mode.The way that properties will be mapped to rendered components is managed by the widget type.
- Specified by:
getPropertiesin interfaceLayout
-
getProperty
public Serializable getProperty(String name)
Description copied from interface:LayoutReturns property with given name in this mode.- Specified by:
getPropertyin interfaceLayout- Parameters:
name- the property name.- Returns:
- the property value or null if not found.
-
setProperty
public void setProperty(String name, Serializable value)
Description copied from interface:LayoutSets property with given name on the layout. If there is already a property with this name on the layout, it will be overridden.- Specified by:
setPropertyin interfaceLayout- Parameters:
name- the property name.value- the property value or null if not found.
-
getValueName
public String getValueName()
Description copied from interface:LayoutGets the value name used to compute widget attributes.- Specified by:
getValueNamein interfaceLayout
-
setValueName
public void setValueName(String valueName)
Description copied from interface:LayoutSets the value name used to compute widget bindings.- Specified by:
setValueNamein interfaceLayout
-
setType
public void setType(String type)
- Since:
- 6.0
-
getTypeCategory
public String getTypeCategory()
Description copied from interface:LayoutReturns the layout type category.- Specified by:
getTypeCategoryin interfaceLayout- Since:
- 6.0
-
setTypeCategory
public void setTypeCategory(String typeCategory)
- Since:
- 6.0
-
isDynamic
public boolean isDynamic()
Description copied from interface:LayoutReturn true if this layout was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.
-
setDynamic
public void setDynamic(boolean dynamic)
-
getDevTemplate
public String getDevTemplate()
Description copied from interface:LayoutReturns the template to use for dev mode.Is retrieved from layout definition templates, or from layout type templates, using the
BuiltinModes.DEV.- Specified by:
getDevTemplatein interfaceLayout
-
setDevTemplate
public void setDevTemplate(String devTemplate)
-
getDefinition
public LayoutDefinition getDefinition()
Description copied from interface:LayoutReturns the definition from which this layout instance was generated.Useful in dev mode to show the corresponding configuration in the UI.
- Specified by:
getDefinitionin interfaceLayout
-
setDefinition
public void setDefinition(LayoutDefinition definition)
-
-