Class WidgetDefinitionImpl
- java.lang.Object
-
- org.nuxeo.ecm.platform.forms.layout.api.impl.WidgetDefinitionImpl
-
- All Implemented Interfaces:
Serializable,WidgetDefinition
public class WidgetDefinitionImpl extends Object implements WidgetDefinition
Default implementation for a widget definition.Useful to compute widgets 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>aliasesprotected Map<String,Map<String,Serializable>>controlsprotected booleandynamicprotected FieldDefinition[]fieldDefinitionsprotected booleanglobalprotected booleanhandlingLabelsDeprecated.since 5.7: usecontrolsinsteadprotected Map<String,String>helpLabelsprotected Map<String,String>labelsprotected Map<String,String>modesprotected Stringnameprotected Map<String,Map<String,Serializable>>propertiesprotected Map<String,List<RenderingInfo>>renderingInfosprotected WidgetSelectOption[]selectOptionsprotected WidgetReference[]subWidgetReferencesprotected WidgetDefinition[]subWidgetsprotected booleantranslatedprotected Stringtypeprotected StringtypeCategoryprotected Map<String,Map<String,Serializable>>widgetModeProperties-
Fields inherited from interface org.nuxeo.ecm.platform.forms.layout.api.WidgetDefinition
RENDERED_PROPERTY_NAME, REQUIRED_PROPERTY_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWidgetDefinitionImpl()WidgetDefinitionImpl(String name, String type, String label, String helpLabel, boolean translated, Map<String,String> modes, List<FieldDefinition> fieldDefinitions, Map<String,Serializable> properties, List<WidgetDefinition> subWidgets)WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, List<FieldDefinition> fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, List<WidgetDefinition> subWidgets)WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, FieldDefinition[] fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, WidgetDefinition[] subWidgets)WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, FieldDefinition[] fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, WidgetDefinition[] subWidgets, WidgetSelectOption[] selectOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WidgetDefinitionclone()Returns a clone instance of this widget definition.booleanequals(Object obj)List<String>getAliases()Return alias names for this widget definition (useful for compatibility on old widget names).Map<String,Map<String,Serializable>>getControls()Returns controls by mode.Map<String,Serializable>getControls(String layoutMode, String mode)Returns controls for given mode.FieldDefinition[]getFieldDefinitions()Returns the list of fields managed by this widget.StringgetHelpLabel(String mode)Returns the help label to use in a given mode.Map<String,String>getHelpLabels()Returns help labels by mode.StringgetLabel(String mode)Returns the label to use in a given mode.Map<String,String>getLabels()Returns labels by mode.StringgetMode(String layoutMode)Returns the optional mode used to override the layout mode.Map<String,String>getModes()StringgetName()Returns the widget name used to identify it within a layout.Map<String,Map<String,Serializable>>getProperties()Returns properties by mode.Map<String,Serializable>getProperties(String layoutMode, String mode)Returns a map of properties to use in a given mode.static Map<String,Serializable>getProperties(Map<String,Map<String,Serializable>> properties, String 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.static List<RenderingInfo>getRenderingInfos(Map<String,List<RenderingInfo>> infos, String mode)StringgetRequired(String layoutMode, String mode)Returns an EL expression evaluating to true if the widget is required in given mode.WidgetSelectOption[]getSelectOptions()Returns the select options for this widget.WidgetDefinition[]getSubWidgetDefinitions()Returns sub widget definitions.WidgetReference[]getSubWidgetReferences()Returns sub widget definitions references.StringgetType()Returns the widget type used to render it.StringgetTypeCategory()Returns the type category to use when retrieving the corresponding widget type.Map<String,Map<String,Serializable>>getWidgetModeProperties()Returns properties by widget mode.booleanisDynamic()Returns true if this widget was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.booleanisGlobal()Returns true if the widget is defined globally (as opposed to being held by a layout definition).booleanisHandlingLabels()Returns true if the widget is handling his own labels display (usual label and help label).booleanisTranslated()Returns true if all labels are messages that need to be translated.voidsetAliases(List<String> aliases)voidsetControls(Map<String,Map<String,Serializable>> controls)Sets controls by mode on widget definition.voidsetDynamic(boolean dynamic)voidsetFieldDefinitions(FieldDefinition[] fieldDefinitions)voidsetGlobal(boolean global)Sets the global status on this definition, depending on how it's been retrievd by the service.voidsetHandlingLabels(boolean handlingLabels)voidsetHelpLabels(Map<String,String> helpLabels)voidsetLabels(Map<String,String> labels)voidsetModes(Map<String,String> modes)voidsetName(String name)voidsetProperties(Map<String,Map<String,Serializable>> properties)voidsetRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)voidsetSelectOptions(WidgetSelectOption[] selectOptions)voidsetSubWidgetDefinitions(WidgetDefinition[] subWidgets)voidsetSubWidgetReferences(WidgetReference[] subWidgetReferences)voidsetTranslated(boolean translated)voidsetType(String type)voidsetTypeCategory(String typeCategory)Sets the type category to use when retrieving the corresponding widget type.voidsetWidgetModeProperties(Map<String,Map<String,Serializable>> widgetModeProperties)StringtoString()
-
-
-
Field Detail
-
name
protected String name
-
type
protected String type
-
typeCategory
protected String typeCategory
-
translated
protected boolean translated
-
handlingLabels
@Deprecated protected boolean handlingLabels
Deprecated.since 5.7: usecontrolsinstead
-
fieldDefinitions
protected FieldDefinition[] fieldDefinitions
-
properties
protected Map<String,Map<String,Serializable>> properties
-
widgetModeProperties
protected Map<String,Map<String,Serializable>> widgetModeProperties
-
controls
protected Map<String,Map<String,Serializable>> controls
-
subWidgets
protected WidgetDefinition[] subWidgets
-
subWidgetReferences
protected WidgetReference[] subWidgetReferences
-
selectOptions
protected WidgetSelectOption[] selectOptions
-
renderingInfos
protected Map<String,List<RenderingInfo>> renderingInfos
-
dynamic
protected boolean dynamic
-
global
protected boolean global
-
-
Constructor Detail
-
WidgetDefinitionImpl
protected WidgetDefinitionImpl()
-
WidgetDefinitionImpl
public WidgetDefinitionImpl(String name, String type, String label, String helpLabel, boolean translated, Map<String,String> modes, List<FieldDefinition> fieldDefinitions, Map<String,Serializable> properties, List<WidgetDefinition> subWidgets)
-
WidgetDefinitionImpl
public WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, List<FieldDefinition> fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, List<WidgetDefinition> subWidgets)
-
WidgetDefinitionImpl
public WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, FieldDefinition[] fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, WidgetDefinition[] subWidgets)
-
WidgetDefinitionImpl
public WidgetDefinitionImpl(String name, String type, Map<String,String> labels, Map<String,String> helpLabels, boolean translated, Map<String,String> modes, FieldDefinition[] fieldDefinitions, Map<String,Map<String,Serializable>> properties, Map<String,Map<String,Serializable>> widgetModeProperties, WidgetDefinition[] subWidgets, WidgetSelectOption[] selectOptions)
- Since:
- 5.4.2
-
-
Method Detail
-
getFieldDefinitions
public FieldDefinition[] getFieldDefinitions()
Description copied from interface:WidgetDefinitionReturns the list of fields managed by this widget.- Specified by:
getFieldDefinitionsin interfaceWidgetDefinition
-
setFieldDefinitions
public void setFieldDefinitions(FieldDefinition[] fieldDefinitions)
- Specified by:
setFieldDefinitionsin interfaceWidgetDefinition
-
getHelpLabel
public String getHelpLabel(String mode)
Description copied from interface:WidgetDefinitionReturns the help label to use in a given mode.- Specified by:
getHelpLabelin interfaceWidgetDefinition
-
getHelpLabels
public Map<String,String> getHelpLabels()
Description copied from interface:WidgetDefinitionReturns help labels by mode.- Specified by:
getHelpLabelsin interfaceWidgetDefinition
-
setHelpLabels
public void setHelpLabels(Map<String,String> helpLabels)
- Specified by:
setHelpLabelsin interfaceWidgetDefinition
-
getLabel
public String getLabel(String mode)
Description copied from interface:WidgetDefinitionReturns the label to use in a given mode.- Specified by:
getLabelin interfaceWidgetDefinition
-
getLabels
public Map<String,String> getLabels()
Description copied from interface:WidgetDefinitionReturns labels by mode.- Specified by:
getLabelsin interfaceWidgetDefinition
-
setLabels
public void setLabels(Map<String,String> labels)
- Specified by:
setLabelsin interfaceWidgetDefinition
-
getMode
public String getMode(String layoutMode)
Description copied from interface:WidgetDefinitionReturns the optional mode used to override the layout mode.Can be a string or an EL ValueExpression.
- Specified by:
getModein interfaceWidgetDefinition- Parameters:
layoutMode- the layout (or parent widget) mode- Returns:
- the overriding widget mode or null if none is defined.
-
getModes
public Map<String,String> getModes()
- Specified by:
getModesin interfaceWidgetDefinition
-
setModes
public void setModes(Map<String,String> modes)
- Specified by:
setModesin interfaceWidgetDefinition
-
getName
public String getName()
Description copied from interface:WidgetDefinitionReturns the widget name used to identify it within a layout.- Specified by:
getNamein interfaceWidgetDefinition
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceWidgetDefinition
-
getProperties
public Map<String,Serializable> getProperties(String layoutMode, String mode)
Description copied from interface:WidgetDefinitionReturns a map of properties to use in a given mode.A property value can be a string or an EL ValueExpression.
The way that properties will be mapped to rendered components is managed by the widget type.
- Specified by:
getPropertiesin interfaceWidgetDefinition
-
getProperties
public Map<String,Map<String,Serializable>> getProperties()
Description copied from interface:WidgetDefinitionReturns properties by mode.- Specified by:
getPropertiesin interfaceWidgetDefinition
-
setProperties
public void setProperties(Map<String,Map<String,Serializable>> properties)
- Specified by:
setPropertiesin interfaceWidgetDefinition
-
getWidgetModeProperties
public Map<String,Map<String,Serializable>> getWidgetModeProperties()
Description copied from interface:WidgetDefinitionReturns properties by widget mode.- Specified by:
getWidgetModePropertiesin interfaceWidgetDefinition
-
setWidgetModeProperties
public void setWidgetModeProperties(Map<String,Map<String,Serializable>> widgetModeProperties)
- Specified by:
setWidgetModePropertiesin interfaceWidgetDefinition
-
getControls
public Map<String,Serializable> getControls(String layoutMode, String mode)
Description copied from interface:WidgetDefinitionReturns controls for given mode.- Specified by:
getControlsin interfaceWidgetDefinition- See Also:
WidgetDefinition.getControls()
-
getControls
public Map<String,Map<String,Serializable>> getControls()
Description copied from interface:WidgetDefinitionReturns controls by mode.Controls are property-like markers on widget instances, expect these are not forwarded to the underlying rendering object (like the JSF component attributes).
This makes it possible to keep "flags" on widgets that can be checked by parent widget or layout, for instance "addForm" or "handlingLabels" markers.
- Specified by:
getControlsin interfaceWidgetDefinition
-
setControls
public void setControls(Map<String,Map<String,Serializable>> controls)
Description copied from interface:WidgetDefinitionSets controls by mode on widget definition.- Specified by:
setControlsin interfaceWidgetDefinition
-
getRequired
public String getRequired(String layoutMode, String mode)
Description copied from interface:WidgetDefinitionReturns an EL expression evaluating to true if the widget is required in given mode.This value is computed from the property "required" in given mode. and can be a string or an EL ValueExpression. Defaults to "false".
- Specified by:
getRequiredin interfaceWidgetDefinition
-
getSubWidgetDefinitions
public WidgetDefinition[] getSubWidgetDefinitions()
Description copied from interface:WidgetDefinitionReturns sub widget definitions.- Specified by:
getSubWidgetDefinitionsin interfaceWidgetDefinition
-
setSubWidgetDefinitions
public void setSubWidgetDefinitions(WidgetDefinition[] subWidgets)
- Specified by:
setSubWidgetDefinitionsin interfaceWidgetDefinition
-
getSubWidgetReferences
public WidgetReference[] getSubWidgetReferences()
Description copied from interface:WidgetDefinitionReturns sub widget definitions references.- Specified by:
getSubWidgetReferencesin interfaceWidgetDefinition
-
setSubWidgetReferences
public void setSubWidgetReferences(WidgetReference[] subWidgetReferences)
- Specified by:
setSubWidgetReferencesin interfaceWidgetDefinition
-
getType
public String getType()
Description copied from interface:WidgetDefinitionReturns the widget type used to render it.- Specified by:
getTypein interfaceWidgetDefinition
-
setType
public void setType(String type)
- Specified by:
setTypein interfaceWidgetDefinition
-
getTypeCategory
public String getTypeCategory()
Description copied from interface:WidgetDefinitionReturns the type category to use when retrieving the corresponding widget type.- Specified by:
getTypeCategoryin interfaceWidgetDefinition
-
setTypeCategory
public void setTypeCategory(String typeCategory)
Description copied from interface:WidgetDefinitionSets the type category to use when retrieving the corresponding widget type.- Specified by:
setTypeCategoryin interfaceWidgetDefinition
-
isTranslated
public boolean isTranslated()
Description copied from interface:WidgetDefinitionReturns true if all labels are messages that need to be translated.Defaults to true.
- Specified by:
isTranslatedin interfaceWidgetDefinition
-
setTranslated
public void setTranslated(boolean translated)
- Specified by:
setTranslatedin interfaceWidgetDefinition- See Also:
WidgetDefinition.isTranslated()
-
isHandlingLabels
public boolean isHandlingLabels()
Description copied from interface:WidgetDefinitionReturns true if the widget is handling his own labels display (usual label and help label). This can be checked by the layout template to render the widget using both label and widget usual places.Defaults to false.
- Specified by:
isHandlingLabelsin interfaceWidgetDefinition
-
setHandlingLabels
public void setHandlingLabels(boolean handlingLabels)
- Specified by:
setHandlingLabelsin interfaceWidgetDefinition- See Also:
WidgetDefinition.isHandlingLabels()
-
getProperties
public static Map<String,Serializable> getProperties(Map<String,Map<String,Serializable>> properties, String mode)
-
getSelectOptions
public WidgetSelectOption[] getSelectOptions()
Description copied from interface:WidgetDefinitionReturns the select options for this widget.- Specified by:
getSelectOptionsin interfaceWidgetDefinition
-
setSelectOptions
public void setSelectOptions(WidgetSelectOption[] selectOptions)
- Specified by:
setSelectOptionsin interfaceWidgetDefinition
-
getRenderingInfos
public Map<String,List<RenderingInfo>> getRenderingInfos()
Description copied from interface:WidgetDefinitionReturns 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:
getRenderingInfosin interfaceWidgetDefinition
-
setRenderingInfos
public void setRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)
- Specified by:
setRenderingInfosin interfaceWidgetDefinition
-
getRenderingInfos
public static List<RenderingInfo> getRenderingInfos(Map<String,List<RenderingInfo>> infos, String mode)
-
getRenderingInfos
public List<RenderingInfo> getRenderingInfos(String mode)
Description copied from interface:WidgetDefinitionReturns the list of rendering information for given mode.- Specified by:
getRenderingInfosin interfaceWidgetDefinition
-
isDynamic
public boolean isDynamic()
Description copied from interface:WidgetDefinitionReturns true if this widget was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.- Specified by:
isDynamicin interfaceWidgetDefinition
-
setDynamic
public void setDynamic(boolean dynamic)
-
isGlobal
public boolean isGlobal()
Description copied from interface:WidgetDefinitionReturns true if the widget is defined globally (as opposed to being held by a layout definition).- Specified by:
isGlobalin interfaceWidgetDefinition
-
setGlobal
public void setGlobal(boolean global)
Description copied from interface:WidgetDefinitionSets the global status on this definition, depending on how it's been retrievd by the service.- Specified by:
setGlobalin interfaceWidgetDefinition
-
getAliases
public List<String> getAliases()
Description copied from interface:WidgetDefinitionReturn alias names for this widget definition (useful for compatibility on old widget names).- Specified by:
getAliasesin interfaceWidgetDefinition
-
clone
public WidgetDefinition clone()
Description copied from interface:WidgetDefinitionReturns a clone instance of this widget definition.Useful for conversion of widget definition during export.
- Specified by:
clonein interfaceWidgetDefinition- Overrides:
clonein classObject
-
-