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:
  • Field Details

    • 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
    • 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 Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: Widget
      Returns the widget id, unique within the facelet context.
      Specified by:
      getId in interface Widget
    • getTagConfigId

      public String getTagConfigId()
      Description copied from interface: Widget
      Returns the unique identifier of this widget to be used in tag configuration.
      Specified by:
      getTagConfigId in interface Widget
      See Also:
    • setId

      public void setId(String id)
      Description copied from interface: Widget
      Sets the widget id, unique within the facelet context.
      Specified by:
      setId in interface Widget
    • getLayoutName

      public String getLayoutName()
      Description copied from interface: Widget
      Returns the layout name.
      Specified by:
      getLayoutName in interface Widget
    • getName

      public String getName()
      Description copied from interface: Widget
      Returns the widget name used to identify it within a layout.
      Specified by:
      getName in interface Widget
    • getMode

      public String getMode()
      Description copied from interface: Widget
      Returns the widget mode.

      This mode can be different from the layout mode.

      Specified by:
      getMode in interface Widget
    • getType

      public String getType()
      Description copied from interface: Widget
      Returns the widget type used to render it.
      Specified by:
      getType in interface Widget
    • getTypeCategory

      public String getTypeCategory()
      Description copied from interface: Widget
      Returns the widget type category.
      Specified by:
      getTypeCategory in interface Widget
    • setTypeCategory

      public void setTypeCategory(String typeCategory)
    • getLabel

      public String getLabel()
      Description copied from interface: Widget
      Returns the label to use in this mode.
      Specified by:
      getLabel in interface Widget
    • getHelpLabel

      public String getHelpLabel()
      Description copied from interface: Widget
      Return the help label to use in this mode.
      Specified by:
      getHelpLabel in interface Widget
    • isTranslated

      public boolean isTranslated()
      Description copied from interface: Widget
      Returns true if all labels are messages that need to be translated.

      Defaults to false.

      Specified by:
      isTranslated in interface Widget
    • isHandlingLabels

      public boolean isHandlingLabels()
      Description copied from interface: Widget
      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 interface Widget
    • getProperties

      public Map<String,Serializable> getProperties()
      Description copied from interface: Widget
      Get properties to use in this mode.

      The way that properties will be mapped to rendered components is managed by the widget type.

      Specified by:
      getProperties in interface Widget
    • getProperty

      public Serializable getProperty(String name)
      Description copied from interface: Widget
      Returns property with given name in this mode.
      Specified by:
      getProperty in interface Widget
      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: Widget
      Sets 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:
      setProperty in interface Widget
      Parameters:
      name - the property name.
      value - the property value or null if not found.
    • getControls

      public Map<String,Serializable> getControls()
      Description copied from interface: Widget
      Returns controls on this widget.
      Specified by:
      getControls in interface Widget
      See Also:
    • getControl

      public Serializable getControl(String name)
      Description copied from interface: Widget
      Returns control with given name.
      Specified by:
      getControl in interface Widget
      See Also:
    • setControl

      public void setControl(String name, Serializable value)
      Description copied from interface: Widget
      Sets control with given name and value.
      Specified by:
      setControl in interface Widget
      See Also:
    • setControls

      public void setControls(Map<String,Serializable> controls)
      Since:
      6.0
    • isRequired

      public boolean isRequired()
      Description copied from interface: Widget
      Returns 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:
      isRequired in interface Widget
    • getFieldDefinitions

      public FieldDefinition[] getFieldDefinitions()
      Description copied from interface: Widget
      Returns the list of fields managed by this widget.
      Specified by:
      getFieldDefinitions in interface Widget
    • getSubWidgets

      public Widget[] getSubWidgets()
      Description copied from interface: Widget
      Returns sub widgets.
      Specified by:
      getSubWidgets in interface Widget
    • getValueName

      public String getValueName()
      Description copied from interface: Widget
      Gets the value name used to compute tag attributes.
      Specified by:
      getValueName in interface Widget
    • setValueName

      public void setValueName(String valueName)
      Description copied from interface: Widget
      Sets the value name used to compute tag attributes.
      Specified by:
      setValueName in interface Widget
    • getLevel

      public int getLevel()
      Description copied from interface: Widget
      Returns 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.

      Specified by:
      getLevel in interface Widget
    • getSelectOptions

      public WidgetSelectOption[] getSelectOptions()
      Description copied from interface: Widget
      Returns the select options for this widget.
      Specified by:
      getSelectOptions in interface Widget
    • getRenderingInfos

      public List<RenderingInfo> getRenderingInfos()
      Description copied from interface: Widget
      Returns 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:
      getRenderingInfos in interface Widget
    • isDynamic

      public boolean isDynamic()
      Description copied from interface: Widget
      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 interface Widget
    • setDynamic

      public void setDynamic(boolean dynamic)
    • isGlobal

      public boolean isGlobal()
      Description copied from interface: Widget
      Returns true if the widget is defined globally (as opposed to being held by a layout definition).
      Specified by:
      isGlobal in interface Widget
    • setGlobal

      public void setGlobal(boolean global)
    • getDefinition

      public WidgetDefinition getDefinition()
      Description copied from interface: Widget
      Returns the definition from which this widget instance was generated.

      Useful in dev mode to show the corresponding configuration in the UI.

      Specified by:
      getDefinition in interface Widget
    • setDefinition

      public void setDefinition(WidgetDefinition definition)
    • toString

      public String toString()
      Overrides:
      toString in class Object