Class LayoutDefinitionImpl
- java.lang.Object
-
- org.nuxeo.ecm.platform.forms.layout.api.impl.LayoutDefinitionImpl
-
- All Implemented Interfaces:
Serializable
,LayoutDefinition
public class LayoutDefinitionImpl extends Object implements LayoutDefinition
Default implementation for a layout definition.Useful to compute layouts independently from the layout service.
- Since:
- 5.4
- Author:
- Anahide Tchertchian
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
aliases
protected Integer
columns
protected boolean
dynamic
protected String
name
protected Map<String,Map<String,Serializable>>
properties
protected Map<String,List<RenderingInfo>>
renderingInfos
protected LayoutRowDefinition[]
rows
protected Map<String,String>
templates
protected String
type
protected String
typeCategory
protected Map<String,WidgetDefinition>
widgets
-
Constructor Summary
Constructors Modifier Constructor Description protected
LayoutDefinitionImpl()
LayoutDefinitionImpl(String name, String template, WidgetDefinition widgetDefinition)
LayoutDefinitionImpl(String name, Map<String,Map<String,Serializable>> properties, Map<String,String> templates, List<LayoutRowDefinition> rows, List<WidgetDefinition> widgetDefinitions)
LayoutDefinitionImpl(String name, Map<String,Map<String,Serializable>> properties, Map<String,String> templates, LayoutRowDefinition[] rows, Map<String,WidgetDefinition> widgets)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LayoutDefinition
clone()
Returns a clone instance of this layout definition.boolean
equals(Object obj)
List<String>
getAliases()
Return alias names for this layout definition (useful for compatibility on old layout names).int
getColumns()
Returns the maximum number of columns.String
getName()
Returns the layout name used to identify it within the layout service.Map<String,Map<String,Serializable>>
getProperties()
Returns a map of properties by mode.Map<String,Serializable>
getProperties(String layoutMode)
Returns a map of properties to use in a given mode.Map<String,List<RenderingInfo>>
getRenderingInfos()
Returns the map of rendering information per mode.List<RenderingInfo>
getRenderingInfos(String mode)
Returns the list of rendering information for given mode.LayoutRowDefinition[]
getRows()
Returns the list of widget names to use at a given row.String
getTemplate(String mode)
Returns template to use in a given mode.static String
getTemplate(Map<String,String> templates, String mode)
Map<String,String>
getTemplates()
Returns templates by modeString
getType()
Return the layout type, or null if not defined.String
getTypeCategory()
WidgetDefinition
getWidgetDefinition(String name)
Returns the widget definition with given name.Map<String,WidgetDefinition>
getWidgetDefinitions()
Returns the map of widgets defined inside this layout.boolean
isDynamic()
boolean
isEmpty()
Returns true if all widget references in this layout are emptyvoid
setAliases(List<String> aliases)
void
setDynamic(boolean dynamic)
void
setName(String name)
void
setProperties(Map<String,Map<String,Serializable>> properties)
void
setRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)
void
setRows(LayoutRowDefinition[] rows)
void
setTemplates(Map<String,String> templates)
void
setType(String type)
void
setTypeCategory(String typeCategory)
-
-
-
Field Detail
-
name
protected String name
-
type
protected String type
-
typeCategory
protected String typeCategory
-
properties
protected Map<String,Map<String,Serializable>> properties
-
rows
protected LayoutRowDefinition[] rows
-
widgets
protected Map<String,WidgetDefinition> widgets
-
renderingInfos
protected Map<String,List<RenderingInfo>> renderingInfos
-
columns
protected Integer columns
-
dynamic
protected boolean dynamic
-
-
Constructor Detail
-
LayoutDefinitionImpl
protected LayoutDefinitionImpl()
-
LayoutDefinitionImpl
public LayoutDefinitionImpl(String name, String template, WidgetDefinition widgetDefinition)
-
LayoutDefinitionImpl
public LayoutDefinitionImpl(String name, Map<String,Map<String,Serializable>> properties, Map<String,String> templates, List<LayoutRowDefinition> rows, List<WidgetDefinition> widgetDefinitions)
-
LayoutDefinitionImpl
public LayoutDefinitionImpl(String name, Map<String,Map<String,Serializable>> properties, Map<String,String> templates, LayoutRowDefinition[] rows, Map<String,WidgetDefinition> widgets)
-
-
Method Detail
-
getColumns
public int getColumns()
Description copied from interface:LayoutDefinition
Returns the maximum number of columns.- Specified by:
getColumns
in interfaceLayoutDefinition
-
getName
public String getName()
Description copied from interface:LayoutDefinition
Returns the layout name used to identify it within the layout service.- Specified by:
getName
in interfaceLayoutDefinition
-
setName
public void setName(String name)
- Specified by:
setName
in interfaceLayoutDefinition
-
getType
public String getType()
Description copied from interface:LayoutDefinition
Return the layout type, or null if not defined.Since 6.0, the layout type can hold templates and properties configuration, so that layout does not need to define them again.
- Specified by:
getType
in interfaceLayoutDefinition
- Since:
- 6.0
-
setType
public void setType(String type)
- Since:
- 6.0
-
getTypeCategory
public String getTypeCategory()
- Specified by:
getTypeCategory
in interfaceLayoutDefinition
- Since:
- 6.0
-
setTypeCategory
public void setTypeCategory(String typeCategory)
- Since:
- 6.0
-
getProperties
public Map<String,Serializable> getProperties(String layoutMode)
Description copied from interface:LayoutDefinition
Returns a map of properties to use in a given mode.- Specified by:
getProperties
in interfaceLayoutDefinition
-
getProperties
public Map<String,Map<String,Serializable>> getProperties()
Description copied from interface:LayoutDefinition
Returns a map of properties by mode.- Specified by:
getProperties
in interfaceLayoutDefinition
-
setProperties
public void setProperties(Map<String,Map<String,Serializable>> properties)
- Specified by:
setProperties
in interfaceLayoutDefinition
-
getRows
public LayoutRowDefinition[] getRows()
Description copied from interface:LayoutDefinition
Returns the list of widget names to use at a given row.For instance, this could describe a layout like: [['title'], ['description'], ['creationDate', '', 'modificationDate'], ['subject']].
- Specified by:
getRows
in interfaceLayoutDefinition
-
setRows
public void setRows(LayoutRowDefinition[] rows)
- Specified by:
setRows
in interfaceLayoutDefinition
-
getTemplate
public static String getTemplate(Map<String,String> templates, String mode)
- Since:
- 6.0
-
getTemplate
public String getTemplate(String mode)
Description copied from interface:LayoutDefinition
Returns template to use in a given mode.- Specified by:
getTemplate
in interfaceLayoutDefinition
-
getTemplates
public Map<String,String> getTemplates()
Description copied from interface:LayoutDefinition
Returns templates by mode- Specified by:
getTemplates
in interfaceLayoutDefinition
-
setTemplates
public void setTemplates(Map<String,String> templates)
- Specified by:
setTemplates
in interfaceLayoutDefinition
-
getWidgetDefinition
public WidgetDefinition getWidgetDefinition(String name)
Description copied from interface:LayoutDefinition
Returns the widget definition with given name.Returns null if a widget with this name is not found within the layout.
- Specified by:
getWidgetDefinition
in interfaceLayoutDefinition
-
getWidgetDefinitions
public Map<String,WidgetDefinition> getWidgetDefinitions()
Description copied from interface:LayoutDefinition
Returns the map of widgets defined inside this layout.- Specified by:
getWidgetDefinitions
in interfaceLayoutDefinition
-
getRenderingInfos
public Map<String,List<RenderingInfo>> getRenderingInfos()
Description copied from interface:LayoutDefinition
Returns the map of rendering information per mode.Useful for preview management where some configuration needs to be changed: what's changed can be set as rendering information here to be displayed.
- Specified by:
getRenderingInfos
in interfaceLayoutDefinition
-
setRenderingInfos
public void setRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)
- Specified by:
setRenderingInfos
in interfaceLayoutDefinition
-
getRenderingInfos
public List<RenderingInfo> getRenderingInfos(String mode)
Description copied from interface:LayoutDefinition
Returns the list of rendering information for given mode.- Specified by:
getRenderingInfos
in interfaceLayoutDefinition
-
isEmpty
public boolean isEmpty()
Description copied from interface:LayoutDefinition
Returns true if all widget references in this layout are empty- Specified by:
isEmpty
in interfaceLayoutDefinition
-
getAliases
public List<String> getAliases()
Description copied from interface:LayoutDefinition
Return alias names for this layout definition (useful for compatibility on old layout names).- Specified by:
getAliases
in interfaceLayoutDefinition
-
isDynamic
public boolean isDynamic()
- Specified by:
isDynamic
in interfaceLayoutDefinition
-
setDynamic
public void setDynamic(boolean dynamic)
-
clone
public LayoutDefinition clone()
Description copied from interface:LayoutDefinition
Returns a clone instance of this layout definition.Useful for conversion of layout definition during export.
- Specified by:
clone
in interfaceLayoutDefinition
- Overrides:
clone
in classObject
-
-