Class SliderTag

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

    public class SliderTag
    extends InputComponentTag

    A specialized input component tag that defines a slider component.

    A slider is an input component that allows the user to enter a numeric value in a specified range by simply dragging a thumb to the desired position. The slider can have horizontal or vertical orientation. Allowed values are defined by the Orientation enumeration class. In addition to the slider's range the space of minor and major ticks can be specified. Further it can be configured whether labels and ticks should be painted. The following table lists all attributes supported by this tag (of course, all of the standard attributes are also allowed):

    Attribute Description Optional
    min Defines the minimum value of this slider. No
    max Defines the maximum value of this slider. No
    orientation Using this attribute the slider's orientation can be specified. Possible values are defined by the Orientation enumeration class (case does not matter). The default is HORIZONTAL. Yes
    majorTicks This attribute specifies the spacing of major ticks (in values). This is a big step when moving the slider. Yes
    minorTicks This attribute specifies the spacing of minor ticks (in values). It is analogous to majorTicks, but defines a small step for the slider. Yes
    showTicks A boolean value which controls whether ticks should be painted. If set to true, the slider draws a chart that corresponds to the spacing defined by the majorTicks and minorTicks attributes. Yes
    showLabels A boolean value which controls whether the slider should draw labels. The labels are shown at representative positions that correspond to the spacing of the ticks. (Note that labels may not be supported by all UI platforms.) Yes

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

      • SliderTag

        public SliderTag()
    • Method Detail

      • getOrientation

        public String getOrientation()
        Returns the slider's orientation as string value. This is the string that was set for the orientation attribute (it may not be a valid orientation value).
        Returns:
        the orientation as string
      • setOrientation

        public void setOrientation​(String orientation)
        Set method of the orientation attribute.
        Parameters:
        orientation - the attribute's value
      • getMin

        public int getMin()
        Returns the minimum value of the slider.
        Returns:
        the minimum value
      • setMin

        public void setMin​(int min)
        Set method of the min attribute.
        Parameters:
        min - the attribute's value
      • getMax

        public int getMax()
        Returns the maximum value of the slider.
        Returns:
        the maximum value
      • setMax

        public void setMax​(int max)
        Set method of the max attribute.
        Parameters:
        max - the attribute's value
      • getMajorTicks

        public int getMajorTicks()
        Returns the spacing for major ticks.
        Returns:
        the major ticks spacing
      • setMajorTicks

        public void setMajorTicks​(int majorTicks)
        Set method of the majorTicks attribute.
        Parameters:
        majorTicks - the attribute's value
      • getMinorTicks

        public int getMinorTicks()
        Returns the spacing for minor ticks.
        Returns:
        the minor ticks spacing
      • setMinorTicks

        public void setMinorTicks​(int minorTicks)
        Set method of the minorTicks attribute.
        Parameters:
        minorTicks - the attribute's value
      • isShowTicks

        public boolean isShowTicks()
        Returns a flag whether ticks should be painted by the slider.
        Returns:
        a flag whether ticks should be painted
      • setShowTicks

        public void setShowTicks​(boolean showTicks)
        Set method of the showTicks attribute.
        Parameters:
        showTicks - the attribute's value
      • isShowLabels

        public boolean isShowLabels()
        Returns a flag whether labels for values should be painted by the slider.
        Returns:
        a flag whether labels should be painted
      • setShowLabels

        public void setShowLabels​(boolean showLabels)
        Set method of the showLabels attribute.
        Parameters:
        showLabels - the attribute's value
      • getSliderOrientation

        public Orientation getSliderOrientation()
        Returns the Orientation value of the slider. The value of the orientation attribute is transformed into an Orientation instance by the processBeforeBody() method if possible. Otherwise, an exception is thrown.
        Returns:
        the Orientation value of the slider
      • processBeforeBody

        protected void processBeforeBody()
                                  throws org.apache.commons.jelly.JellyTagException,
                                         FormBuilderException
        Performs processing before evaluation of the tag body. This implementation checks whether the required attributes are set and does some additional validity checks.
        Overrides:
        processBeforeBody in class InputComponentTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
        FormBuilderException - if an error occurs
      • createComponentHandler

        protected ComponentHandler<?> createComponentHandler​(ComponentManager manager,
                                                             boolean create)
                                                      throws FormBuilderException,
                                                             org.apache.commons.jelly.JellyTagException
        Creates a ComponentHandler for the managed slider component.
        Specified by:
        createComponentHandler in class InputComponentTag
        Parameters:
        manager - the ComponentManager
        create - the create flag
        Returns:
        the handler for the newly created component
        Throws:
        FormBuilderException - if an error occurs
        org.apache.commons.jelly.JellyTagException - if the tag is used incorrectly