Class ListBoxTag

  • All Implemented Interfaces:
    ConditionalTag, ListModelSupport, ScrollSizeSupport, org.apache.commons.jelly.Tag

    public class ListBoxTag
    extends InputComponentTag
    implements ListModelSupport, ScrollSizeSupport

    A specific input component tag that creates a list box component.

    A list box displays a list of options from which the user can select one or many, depending on the style of the list. The options to be displayed are obtained from a ListModel object, which is set either by a tag in this tag's body or by specifying the model's name in the modelRef attribute. The data type of a component handler that wraps a list box must be based on the data type of the list model (i.e. the return value of the model's getType() method): For single selection lists it is a single object of this type, for multi selection lists it is an array of this type.

    The following table lists all attributes that are supported by this tag (in addition to the default attributes that are allowed for all input component tags):

    Attribute Description Optional
    modelRef With this attribute the name of the list model can be supplied. It is then fetched from the current bean context. So a list model with this name must have been created before, either directly by the calling client or by another tag that has already been executed. If this attribute is not defined, a list model must be set by a nested tag. yes
    multi This boolean attribute determines whether the user can select only one or multiple of the options displayed by the list. Note that this attribute has impact of the data managed by the list's component handler (and thus on the corresponding form bean property). yes
    scrollWidth Here the preferred width of the scroll pane enclosing the list can be specified as a number with unit (e.g. "1.5cm"). If specified, the scroll pane will have exactly this preferred width. Otherwise, the width is determined by the preferred width of the list. yes
    scrollHeight Here the preferred height of the scroll pane enclosing the list can be specified as a number with unit (e.g. "10dlu"). If specified, the scroll pane will have exactly this preferred height. Otherwise, the height is determined by the preferred height of the list. yes

    Version:
    $Id: ListBoxTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ListBoxTag

        public ListBoxTag()
    • Method Detail

      • isMulti

        public boolean isMulti()
        Returns a flag whether the list box allows multi-selection.
        Returns:
        the multiple selection flag
      • setMulti

        public void setMulti​(boolean multi)
        Setter method of the multi attribute.
        Parameters:
        multi - the attribute value
      • getModelRef

        public String getModelRef()
        Returns the name of the model to use.
        Specified by:
        getModelRef in interface ListModelSupport
        Returns:
        the list model's name in the jelly context
      • setModelRef

        public void setModelRef​(String modelRef)
        Setter method of the modelRef attribute.
        Parameters:
        modelRef - the attribute value
      • setListModel

        public void setListModel​(ListModel model)
        Sets the list model for this combo box. This method is intended to be called by nested tags.
        Specified by:
        setListModel in interface ListModelSupport
        Parameters:
        model - the list model
      • getScrollWidth

        public String getScrollWidth()
        Returns the scroll width specification as a string.
        Returns:
        the scroll width specification
      • setScrollWidth

        public void setScrollWidth​(String scrollWidth)
        Set method of the scrollWidth attribute.
        Parameters:
        scrollWidth - the attribute's value
      • getScrollHeight

        public String getScrollHeight()
        Returns the scroll height specification as a string.
        Returns:
        the scroll height specification
      • setScrollHeight

        public void setScrollHeight​(String scrollHeight)
        Set method of the scrollHeight attribute.
        Parameters:
        scrollHeight - the attribute's value
      • getPreferredScrollWidth

        public NumberWithUnit getPreferredScrollWidth()
        Returns the preferred scroll width. This value is calculated from the string-based scroll width specification during tag processing. If no scroll width has been specified, this method returns NumberWithUnit.ZERO.
        Specified by:
        getPreferredScrollWidth in interface ScrollSizeSupport
        Returns:
        the preferred scroll width
      • getPreferredScrollHeight

        public NumberWithUnit getPreferredScrollHeight()
        Returns the preferred scroll height. This value is calculated from the string-based scroll height specification during tag processing. If no scroll height has been specified, this method returns NumberWithUnit.ZERO.
        Specified by:
        getPreferredScrollHeight in interface ScrollSizeSupport
        Returns:
        the preferred scroll height