Class WidgetImpl
- java.lang.Object
-
- org.nuxeo.ecm.platform.forms.layout.api.impl.WidgetImpl
-
- All Implemented Interfaces:
Serializable,Widget
public class WidgetImpl extends Object implements Widget
Implementation for widgets.- Author:
- Anahide Tchertchian
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Serializable>controlsprotected WidgetDefinitiondefinitionprotected StringdefinitionIdprotected booleandynamicprotected FieldDefinition[]fieldsprotected booleanglobalprotected booleanhandlingLabelsDeprecated.since 5.7: usecontrolsinsteadprotected StringhelpLabelprotected Stringidprotected Stringlabelprotected StringlayoutNameprotected intlevelprotected Stringmodeprotected Stringnameprotected Map<String,Serializable>propertiesprotected List<RenderingInfo>renderingInfosprotected booleanrequiredprotected WidgetSelectOption[]selectOptionsprotected Widget[]subWidgetsprotected booleantranslatedprotected Stringtypeprotected StringtypeCategoryprotected StringvalueName
-
Constructor Summary
Constructors Modifier Constructor Description protectedWidgetImpl()WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, boolean handlingLabels, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId, List<RenderingInfo> renderingInfos)WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId)WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId, List<RenderingInfo> renderingInfos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SerializablegetControl(String name)Returns control with given name.Map<String,Serializable>getControls()Returns controls on this widget.WidgetDefinitiongetDefinition()Returns the definition from which this widget instance was generated.FieldDefinition[]getFieldDefinitions()Returns the list of fields managed by this widget.StringgetHelpLabel()Return the help label to use in this mode.StringgetId()Returns the widget id, unique within the facelet context.StringgetLabel()Returns the label to use in this mode.StringgetLayoutName()Returns the layout name.intgetLevel()Returns the widget level in the widget hierarchy.StringgetMode()Returns the widget mode.StringgetName()Returns the widget name used to identify it within a layout.Map<String,Serializable>getProperties()Get properties to use in this mode.SerializablegetProperty(String name)Returns property with given name in this mode.List<RenderingInfo>getRenderingInfos()Returns the list of rendering information.WidgetSelectOption[]getSelectOptions()Returns the select options for this widget.Widget[]getSubWidgets()Returns sub widgets.StringgetTagConfigId()Returns the unique identifier of this widget to be used in tag configuration.StringgetType()Returns the widget type used to render it.StringgetTypeCategory()Returns the widget type category.StringgetValueName()Gets the value name used to compute tag attributes.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).booleanisRequired()Returns true if the widget is required.booleanisTranslated()Returns true if all labels are messages that need to be translated.voidsetControl(String name, Serializable value)Sets control with given name and value.voidsetControls(Map<String,Serializable> controls)voidsetDefinition(WidgetDefinition definition)voidsetDynamic(boolean dynamic)voidsetGlobal(boolean global)voidsetId(String id)Sets the widget id, unique within the facelet context.voidsetProperty(String name, Serializable value)Sets property with given name on the layout.voidsetTypeCategory(String typeCategory)voidsetValueName(String valueName)Sets the value name used to compute tag attributes.StringtoString()
-
-
-
Field Detail
-
id
protected String id
-
layoutName
protected String layoutName
-
name
protected String name
-
mode
protected String mode
-
type
protected String type
-
typeCategory
protected String typeCategory
-
fields
protected FieldDefinition[] fields
-
helpLabel
protected String helpLabel
-
subWidgets
protected Widget[] subWidgets
-
properties
protected Map<String,Serializable> properties
-
controls
protected Map<String,Serializable> controls
-
required
protected boolean required
-
valueName
protected String valueName
-
label
protected String label
-
translated
protected boolean translated
-
handlingLabels
@Deprecated protected boolean handlingLabels
Deprecated.since 5.7: usecontrolsinstead
-
level
protected int level
-
selectOptions
protected WidgetSelectOption[] selectOptions
-
renderingInfos
protected List<RenderingInfo> renderingInfos
-
definitionId
protected String definitionId
-
dynamic
protected boolean dynamic
-
global
protected boolean global
-
definition
protected WidgetDefinition definition
-
-
Constructor Detail
-
WidgetImpl
protected WidgetImpl()
-
WidgetImpl
public WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId)
-
WidgetImpl
public WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId, List<RenderingInfo> renderingInfos)
- Since:
- 5.5
-
WidgetImpl
public WidgetImpl(String layoutName, String name, String mode, String type, String valueName, FieldDefinition[] fields, String label, String helpLabel, boolean translated, boolean handlingLabels, Map<String,Serializable> properties, boolean required, Widget[] subWidgets, int level, WidgetSelectOption[] selectOptions, String definitionId, List<RenderingInfo> renderingInfos)
- Since:
- 5.6
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:WidgetReturns the widget id, unique within the facelet context.
-
getTagConfigId
public String getTagConfigId()
Description copied from interface:WidgetReturns the unique identifier of this widget to be used in tag configuration.- Specified by:
getTagConfigIdin interfaceWidget- See Also:
Layout.getTagConfigId()
-
setId
public void setId(String id)
Description copied from interface:WidgetSets the widget id, unique within the facelet context.
-
getLayoutName
public String getLayoutName()
Description copied from interface:WidgetReturns the layout name.- Specified by:
getLayoutNamein interfaceWidget
-
getName
public String getName()
Description copied from interface:WidgetReturns the widget name used to identify it within a layout.
-
getMode
public String getMode()
Description copied from interface:WidgetReturns the widget mode.This mode can be different from the layout mode.
-
getType
public String getType()
Description copied from interface:WidgetReturns the widget type used to render it.
-
getTypeCategory
public String getTypeCategory()
Description copied from interface:WidgetReturns the widget type category.- Specified by:
getTypeCategoryin interfaceWidget
-
setTypeCategory
public void setTypeCategory(String typeCategory)
-
getLabel
public String getLabel()
Description copied from interface:WidgetReturns the label to use in this mode.
-
getHelpLabel
public String getHelpLabel()
Description copied from interface:WidgetReturn the help label to use in this mode.- Specified by:
getHelpLabelin interfaceWidget
-
isTranslated
public boolean isTranslated()
Description copied from interface:WidgetReturns true if all labels are messages that need to be translated.Defaults to false.
- Specified by:
isTranslatedin interfaceWidget
-
isHandlingLabels
public boolean isHandlingLabels()
Description copied from interface:WidgetReturns 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 interfaceWidget
-
getProperties
public Map<String,Serializable> getProperties()
Description copied from interface:WidgetGet 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 interfaceWidget
-
getProperty
public Serializable getProperty(String name)
Description copied from interface:WidgetReturns property with given name in this mode.- Specified by:
getPropertyin interfaceWidget- 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:WidgetSets property with given name on the layout. If there is already a property with this name on the widget, it will be overridden.- Specified by:
setPropertyin interfaceWidget- Parameters:
name- the property name.value- the property value or null if not found.
-
getControls
public Map<String,Serializable> getControls()
Description copied from interface:WidgetReturns controls on this widget.- Specified by:
getControlsin interfaceWidget- See Also:
WidgetDefinition.getControls()
-
getControl
public Serializable getControl(String name)
Description copied from interface:WidgetReturns control with given name.- Specified by:
getControlin interfaceWidget- See Also:
WidgetDefinition.getControls()
-
setControl
public void setControl(String name, Serializable value)
Description copied from interface:WidgetSets control with given name and value.- Specified by:
setControlin interfaceWidget- See Also:
WidgetDefinition.getControls()
-
setControls
public void setControls(Map<String,Serializable> controls)
- Since:
- 6.0
-
isRequired
public boolean isRequired()
Description copied from interface:WidgetReturns true if the widget is required.This is a short link for the "required" property, already evaluated from an EL expression (if needed). Defaults to false.
- Specified by:
isRequiredin interfaceWidget
-
getFieldDefinitions
public FieldDefinition[] getFieldDefinitions()
Description copied from interface:WidgetReturns the list of fields managed by this widget.- Specified by:
getFieldDefinitionsin interfaceWidget
-
getSubWidgets
public Widget[] getSubWidgets()
Description copied from interface:WidgetReturns sub widgets.- Specified by:
getSubWidgetsin interfaceWidget
-
getValueName
public String getValueName()
Description copied from interface:WidgetGets the value name used to compute tag attributes.- Specified by:
getValueNamein interfaceWidget
-
setValueName
public void setValueName(String valueName)
Description copied from interface:WidgetSets the value name used to compute tag attributes.- Specified by:
setValueNamein interfaceWidget
-
getLevel
public int getLevel()
Description copied from interface:WidgetReturns the widget level in the widget hierarchy.For instance a standard widget will have a level of 0, and its potential subwidgets will have a level of 1.
-
getSelectOptions
public WidgetSelectOption[] getSelectOptions()
Description copied from interface:WidgetReturns the select options for this widget.- Specified by:
getSelectOptionsin interfaceWidget
-
getRenderingInfos
public List<RenderingInfo> getRenderingInfos()
Description copied from interface:WidgetReturns the list of rendering information.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 interfaceWidget
-
isDynamic
public boolean isDynamic()
Description copied from interface:WidgetReturns true if this widget was generated from configuration on a service, and not generated on-the-fly using dynamic behaviors.
-
setDynamic
public void setDynamic(boolean dynamic)
-
isGlobal
public boolean isGlobal()
Description copied from interface:WidgetReturns true if the widget is defined globally (as opposed to being held by a layout definition).
-
setGlobal
public void setGlobal(boolean global)
-
getDefinition
public WidgetDefinition getDefinition()
Description copied from interface:WidgetReturns the definition from which this widget instance was generated.Useful in dev mode to show the corresponding configuration in the UI.
- Specified by:
getDefinitionin interfaceWidget
-
setDefinition
public void setDefinition(WidgetDefinition definition)
-
-