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>
aliases
protected Map<String,Map<String,Serializable>>
controls
protected boolean
dynamic
protected FieldDefinition[]
fieldDefinitions
protected boolean
global
protected boolean
handlingLabels
Deprecated.since 5.7: usecontrols
insteadprotected Map<String,String>
helpLabels
protected Map<String,String>
labels
protected Map<String,String>
modes
protected String
name
protected Map<String,Map<String,Serializable>>
properties
protected Map<String,List<RenderingInfo>>
renderingInfos
protected WidgetSelectOption[]
selectOptions
protected WidgetReference[]
subWidgetReferences
protected WidgetDefinition[]
subWidgets
protected boolean
translated
protected String
type
protected String
typeCategory
protected 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 protected
WidgetDefinitionImpl()
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 WidgetDefinition
clone()
Returns a clone instance of this widget definition.boolean
equals(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.String
getHelpLabel(String mode)
Returns the help label to use in a given mode.Map<String,String>
getHelpLabels()
Returns help labels by mode.String
getLabel(String mode)
Returns the label to use in a given mode.Map<String,String>
getLabels()
Returns labels by mode.String
getMode(String layoutMode)
Returns the optional mode used to override the layout mode.Map<String,String>
getModes()
String
getName()
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)
String
getRequired(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.String
getType()
Returns the widget type used to render it.String
getTypeCategory()
Returns the type category to use when retrieving the corresponding widget type.Map<String,Map<String,Serializable>>
getWidgetModeProperties()
Returns properties by widget mode.boolean
isDynamic()
Returns true if this widget was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.boolean
isGlobal()
Returns true if the widget is defined globally (as opposed to being held by a layout definition).boolean
isHandlingLabels()
Returns true if the widget is handling his own labels display (usual label and help label).boolean
isTranslated()
Returns true if all labels are messages that need to be translated.void
setAliases(List<String> aliases)
void
setControls(Map<String,Map<String,Serializable>> controls)
Sets controls by mode on widget definition.void
setDynamic(boolean dynamic)
void
setFieldDefinitions(FieldDefinition[] fieldDefinitions)
void
setGlobal(boolean global)
Sets the global status on this definition, depending on how it's been retrievd by the service.void
setHandlingLabels(boolean handlingLabels)
void
setHelpLabels(Map<String,String> helpLabels)
void
setLabels(Map<String,String> labels)
void
setModes(Map<String,String> modes)
void
setName(String name)
void
setProperties(Map<String,Map<String,Serializable>> properties)
void
setRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)
void
setSelectOptions(WidgetSelectOption[] selectOptions)
void
setSubWidgetDefinitions(WidgetDefinition[] subWidgets)
void
setSubWidgetReferences(WidgetReference[] subWidgetReferences)
void
setTranslated(boolean translated)
void
setType(String type)
void
setTypeCategory(String typeCategory)
Sets the type category to use when retrieving the corresponding widget type.void
setWidgetModeProperties(Map<String,Map<String,Serializable>> widgetModeProperties)
String
toString()
-
-
-
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: usecontrols
instead
-
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:WidgetDefinition
Returns the list of fields managed by this widget.- Specified by:
getFieldDefinitions
in interfaceWidgetDefinition
-
setFieldDefinitions
public void setFieldDefinitions(FieldDefinition[] fieldDefinitions)
- Specified by:
setFieldDefinitions
in interfaceWidgetDefinition
-
getHelpLabel
public String getHelpLabel(String mode)
Description copied from interface:WidgetDefinition
Returns the help label to use in a given mode.- Specified by:
getHelpLabel
in interfaceWidgetDefinition
-
getHelpLabels
public Map<String,String> getHelpLabels()
Description copied from interface:WidgetDefinition
Returns help labels by mode.- Specified by:
getHelpLabels
in interfaceWidgetDefinition
-
setHelpLabels
public void setHelpLabels(Map<String,String> helpLabels)
- Specified by:
setHelpLabels
in interfaceWidgetDefinition
-
getLabel
public String getLabel(String mode)
Description copied from interface:WidgetDefinition
Returns the label to use in a given mode.- Specified by:
getLabel
in interfaceWidgetDefinition
-
getLabels
public Map<String,String> getLabels()
Description copied from interface:WidgetDefinition
Returns labels by mode.- Specified by:
getLabels
in interfaceWidgetDefinition
-
setLabels
public void setLabels(Map<String,String> labels)
- Specified by:
setLabels
in interfaceWidgetDefinition
-
getMode
public String getMode(String layoutMode)
Description copied from interface:WidgetDefinition
Returns the optional mode used to override the layout mode.Can be a string or an EL ValueExpression.
- Specified by:
getMode
in 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:
getModes
in interfaceWidgetDefinition
-
setModes
public void setModes(Map<String,String> modes)
- Specified by:
setModes
in interfaceWidgetDefinition
-
getName
public String getName()
Description copied from interface:WidgetDefinition
Returns the widget name used to identify it within a layout.- Specified by:
getName
in interfaceWidgetDefinition
-
setName
public void setName(String name)
- Specified by:
setName
in interfaceWidgetDefinition
-
getProperties
public Map<String,Serializable> getProperties(String layoutMode, String mode)
Description copied from interface:WidgetDefinition
Returns 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:
getProperties
in interfaceWidgetDefinition
-
getProperties
public Map<String,Map<String,Serializable>> getProperties()
Description copied from interface:WidgetDefinition
Returns properties by mode.- Specified by:
getProperties
in interfaceWidgetDefinition
-
setProperties
public void setProperties(Map<String,Map<String,Serializable>> properties)
- Specified by:
setProperties
in interfaceWidgetDefinition
-
getWidgetModeProperties
public Map<String,Map<String,Serializable>> getWidgetModeProperties()
Description copied from interface:WidgetDefinition
Returns properties by widget mode.- Specified by:
getWidgetModeProperties
in interfaceWidgetDefinition
-
setWidgetModeProperties
public void setWidgetModeProperties(Map<String,Map<String,Serializable>> widgetModeProperties)
- Specified by:
setWidgetModeProperties
in interfaceWidgetDefinition
-
getControls
public Map<String,Serializable> getControls(String layoutMode, String mode)
Description copied from interface:WidgetDefinition
Returns controls for given mode.- Specified by:
getControls
in interfaceWidgetDefinition
- See Also:
WidgetDefinition.getControls()
-
getControls
public Map<String,Map<String,Serializable>> getControls()
Description copied from interface:WidgetDefinition
Returns 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:
getControls
in interfaceWidgetDefinition
-
setControls
public void setControls(Map<String,Map<String,Serializable>> controls)
Description copied from interface:WidgetDefinition
Sets controls by mode on widget definition.- Specified by:
setControls
in interfaceWidgetDefinition
-
getRequired
public String getRequired(String layoutMode, String mode)
Description copied from interface:WidgetDefinition
Returns 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:
getRequired
in interfaceWidgetDefinition
-
getSubWidgetDefinitions
public WidgetDefinition[] getSubWidgetDefinitions()
Description copied from interface:WidgetDefinition
Returns sub widget definitions.- Specified by:
getSubWidgetDefinitions
in interfaceWidgetDefinition
-
setSubWidgetDefinitions
public void setSubWidgetDefinitions(WidgetDefinition[] subWidgets)
- Specified by:
setSubWidgetDefinitions
in interfaceWidgetDefinition
-
getSubWidgetReferences
public WidgetReference[] getSubWidgetReferences()
Description copied from interface:WidgetDefinition
Returns sub widget definitions references.- Specified by:
getSubWidgetReferences
in interfaceWidgetDefinition
-
setSubWidgetReferences
public void setSubWidgetReferences(WidgetReference[] subWidgetReferences)
- Specified by:
setSubWidgetReferences
in interfaceWidgetDefinition
-
getType
public String getType()
Description copied from interface:WidgetDefinition
Returns the widget type used to render it.- Specified by:
getType
in interfaceWidgetDefinition
-
setType
public void setType(String type)
- Specified by:
setType
in interfaceWidgetDefinition
-
getTypeCategory
public String getTypeCategory()
Description copied from interface:WidgetDefinition
Returns the type category to use when retrieving the corresponding widget type.- Specified by:
getTypeCategory
in interfaceWidgetDefinition
-
setTypeCategory
public void setTypeCategory(String typeCategory)
Description copied from interface:WidgetDefinition
Sets the type category to use when retrieving the corresponding widget type.- Specified by:
setTypeCategory
in interfaceWidgetDefinition
-
isTranslated
public boolean isTranslated()
Description copied from interface:WidgetDefinition
Returns true if all labels are messages that need to be translated.Defaults to true.
- Specified by:
isTranslated
in interfaceWidgetDefinition
-
setTranslated
public void setTranslated(boolean translated)
- Specified by:
setTranslated
in interfaceWidgetDefinition
- See Also:
WidgetDefinition.isTranslated()
-
isHandlingLabels
public boolean isHandlingLabels()
Description copied from interface:WidgetDefinition
Returns 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:
isHandlingLabels
in interfaceWidgetDefinition
-
setHandlingLabels
public void setHandlingLabels(boolean handlingLabels)
- Specified by:
setHandlingLabels
in 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:WidgetDefinition
Returns the select options for this widget.- Specified by:
getSelectOptions
in interfaceWidgetDefinition
-
setSelectOptions
public void setSelectOptions(WidgetSelectOption[] selectOptions)
- Specified by:
setSelectOptions
in interfaceWidgetDefinition
-
getRenderingInfos
public Map<String,List<RenderingInfo>> getRenderingInfos()
Description copied from interface:WidgetDefinition
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 interfaceWidgetDefinition
-
setRenderingInfos
public void setRenderingInfos(Map<String,List<RenderingInfo>> renderingInfos)
- Specified by:
setRenderingInfos
in 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:WidgetDefinition
Returns the list of rendering information for given mode.- Specified by:
getRenderingInfos
in interfaceWidgetDefinition
-
isDynamic
public boolean isDynamic()
Description copied from interface:WidgetDefinition
Returns true if this widget was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.- Specified by:
isDynamic
in interfaceWidgetDefinition
-
setDynamic
public void setDynamic(boolean dynamic)
-
isGlobal
public boolean isGlobal()
Description copied from interface:WidgetDefinition
Returns true if the widget is defined globally (as opposed to being held by a layout definition).- Specified by:
isGlobal
in interfaceWidgetDefinition
-
setGlobal
public void setGlobal(boolean global)
Description copied from interface:WidgetDefinition
Sets the global status on this definition, depending on how it's been retrievd by the service.- Specified by:
setGlobal
in interfaceWidgetDefinition
-
getAliases
public List<String> getAliases()
Description copied from interface:WidgetDefinition
Return alias names for this widget definition (useful for compatibility on old widget names).- Specified by:
getAliases
in interfaceWidgetDefinition
-
clone
public WidgetDefinition clone()
Description copied from interface:WidgetDefinition
Returns a clone instance of this widget definition.Useful for conversion of widget definition during export.
- Specified by:
clone
in interfaceWidgetDefinition
- Overrides:
clone
in classObject
-
-