Class XSelect

    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
    • Constructor Detail

      • XSelect

        public XSelect()
    • Method Detail

      • isShowDefaultOption

        protected boolean isShowDefaultOption​(XItemRenderData renderData)
      • isShouldRenderUnit

        public boolean isShouldRenderUnit​(XItemRenderData renderData)
        Description copied from interface: IXItemBasic
        Whether the XPropertyEnum.unit should be rendered. Note that the unit is rendered only when the item contains the property XPropertyEnum.unit and its value is not empty. However, some elements may sometimes not support a unit. For example, XSelect only support a unit when the it is rendered as a combo box, but not when rendered as a list of checkboxes. In these cases, you can override this method with an appropriate implementation. The default implementation simply returns true.
        Specified by:
        isShouldRenderUnit in interface IXItemBasic
        Parameters:
        renderData - The current render data with the properties and options of the item.
        Returns:
        true when the XPropertyEnum.unit should be rendered, or false otherwise.
      • isShouldRenderForAttributeOnLabel

        public boolean isShouldRenderForAttributeOnLabel​(XItemRenderData renderData)
        Description copied from interface: IXItemBasic
        Whether the for should be added to the label of this element, if this element does have a label. The W3C spec requires that the for points to a non-hidden form control element (e.g. an input or textarea). Defaults to true.
        Specified by:
        isShouldRenderForAttributeOnLabel in interface IXItemBasic
        Parameters:
        renderData - The current render data with the properties and options of the item.
        Returns:
        Whether to include the for in the label.
      • getIcon

        public String getIcon()
        Specified by:
        getIcon in interface IXItemBasic
        Returns:
        The CSS class for the icon of this form item, such as for example ico-fc-XCheckbox.
      • getPrefix

        public String getPrefix()
        Description copied from interface: IXItemBasic
        Finds the prefix for form items of this type, such as cb for checkboxes or tf for input fields. This prefix is used, for example, in the designer to generate a default name for newly added form items (tf-1, cb-2).
        Specified by:
        getPrefix in interface IXItemBasic
        Returns:
        The prefix for form items of this type.
      • isSubmitsValues

        public boolean isSubmitsValues()
        Description copied from interface: IXItemBasic
        Checks whether form items of this type can send values to the server when the form is submitted. Form items that do not submit values are, for example, not validated and no values are ever stored in the database. Form items such as pictures or charts do no submit values, while classical form elements such as input fields and checkboxes are a prime example of form items that do submit values.
        Specified by:
        isSubmitsValues in interface IXItemBasic
        Returns:
        Whether form element of this type can send values to the server when the form is submitted.
      • renderItem

        public void renderItem​(com.hp.gagawa.java.elements.Div container,
                               XItemRenderData renderData,
                               XItemRenderCtx renderCtx,
                               IXFormRenderContext formRenderCtx)
        Description copied from interface: IXItemBasic
        Creates the HTML for this form item that is included in the final rendered form. You should append one or more HTML elements to the container that is passed to this method.
        Specified by:
        renderItem in interface IXItemBasic
        Parameters:
        container - The container that will contain this form item in the final form. You should append children to this container.
        renderData - The current render data with the properties and options of the item.
        renderCtx - The current render context giving you access to the global configuration.
        formRenderCtx - The form render context giving you access to the global form configuration.
        See Also:
        IXItemBasic.renderItemPreview(Div, XItemRenderData, XItemRenderCtx, IXFormRenderContext)
      • getAllowedDataSourceParameterCount

        public Map<String,​List<org.apache.commons.lang3.Range<Integer>>> getAllowedDataSourceParameterCount()
        Description copied from interface: IXDataSourceOptions
        Use this method to indicate how many parameters each data source type must have in order to be selectable. For example, the default XSelect form element lets the user select CSV, DB and PLUGIN data sources with no parameters:
         @Override
         public Map<String, List<Range<Integer>>> getAllowedDataSourceParameterCount() {
           final Map<String, List<Range<Integer>>> ranges = new HashMap<>();
           ranges.put(EDatasource.CSV.name(), Arrays.asList(Range.is(0)));
           ranges.put(EDatasource.DB.name(), Arrays.asList(Range.is(0)));
           ranges.put(EDatasource.PLUGIN.name(), Arrays.asList(Range.is(0)));
           return ranges;
         }
         
        Specified by:
        getAllowedDataSourceParameterCount in interface IXDataSourceOptions
        Returns:
        A map between each data source type as the key and a list of allowed parameter counts (inclusive range) as the value. When null is returned, the defaults (which may change) are used. When a key for a data source type is missing or is mapped to null, no data sources of that type are selectable.