Class SliderTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
-
- net.sf.jguiraffe.gui.builder.components.tags.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
Orientationenumeration 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 Orientationenumeration 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 majorTicksandminorTicksattributes.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 Summary
Constructors Constructor Description SliderTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<?>createComponentHandler(ComponentManager manager, boolean create)Creates aComponentHandlerfor the managed slider component.intgetMajorTicks()Returns the spacing for major ticks.intgetMax()Returns the maximum value of the slider.intgetMin()Returns the minimum value of the slider.intgetMinorTicks()Returns the spacing for minor ticks.StringgetOrientation()Returns the slider's orientation as string value.OrientationgetSliderOrientation()Returns theOrientationvalue of the slider.booleanisShowLabels()Returns a flag whether labels for values should be painted by the slider.booleanisShowTicks()Returns a flag whether ticks should be painted by the slider.protected voidprocessBeforeBody()Performs processing before evaluation of the tag body.voidsetMajorTicks(int majorTicks)Set method of themajorTicksattribute.voidsetMax(int max)Set method of themaxattribute.voidsetMin(int min)Set method of theminattribute.voidsetMinorTicks(int minorTicks)Set method of theminorTicksattribute.voidsetOrientation(String orientation)Set method of theorientationattribute.voidsetShowLabels(boolean showLabels)Set method of theshowLabelsattribute.voidsetShowTicks(boolean showTicks)Set method of theshowTicksattribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
addToGroups, checkName, createFieldHandler, getComponent, getComponentHandler, getComponentType, getDisplayName, getFieldValidator, getFormValidator, getGroups, getPropertyName, getReadTransformer, getTypeName, getWriteTransformer, handleGroups, insertField, isNoField, process, setComponentType, setDisplayName, setDisplayNamegrp, setDisplayNameres, setFieldValidator, setFormValidator, setGroups, setNoField, setPropertyName, setReadTransformer, setTypeName, setWriteTransformer
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
getBackColor, getBackgroundColor, getConstraints, getFont, getFontRef, getForeColor, getForegroundColor, getName, getToolTipData, insertComponent, setBackColor, setConstraints, setFont, setFontRef, setForeColor, setName, setTooltip, setTooltipres, setTooltipresgrp
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
canProcess, canProcess, convertToClass, convertToNumberWithUnit, convertToNumberWithUnit, doTag, findContainer, getBuilderData, getBuilderData, getIfName, getResourceText, getResourceText, getUnlessName, setIfName, setUnlessName
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
Method Detail
-
getOrientation
public String getOrientation()
Returns the slider's orientation as string value. This is the string that was set for theorientationattribute (it may not be a valid orientation value).- Returns:
- the orientation as string
-
setOrientation
public void setOrientation(String orientation)
Set method of theorientationattribute.- 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 theminattribute.- 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 themaxattribute.- 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 themajorTicksattribute.- 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 theminorTicksattribute.- 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 theshowTicksattribute.- 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 theshowLabelsattribute.- Parameters:
showLabels- the attribute's value
-
getSliderOrientation
public Orientation getSliderOrientation()
Returns theOrientationvalue of the slider. The value of theorientationattribute is transformed into anOrientationinstance by theprocessBeforeBody()method if possible. Otherwise, an exception is thrown.- Returns:
- the
Orientationvalue of the slider
-
processBeforeBody
protected void processBeforeBody() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionPerforms processing before evaluation of the tag body. This implementation checks whether the required attributes are set and does some additional validity checks.- Overrides:
processBeforeBodyin classInputComponentTag- Throws:
org.apache.commons.jelly.JellyTagException- if the tag is incorrectly usedFormBuilderException- if an error occurs
-
createComponentHandler
protected ComponentHandler<?> createComponentHandler(ComponentManager manager, boolean create) throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Creates aComponentHandlerfor the managed slider component.- Specified by:
createComponentHandlerin classInputComponentTag- Parameters:
manager- theComponentManagercreate- the create flag- Returns:
- the handler for the newly created component
- Throws:
FormBuilderException- if an error occursorg.apache.commons.jelly.JellyTagException- if the tag is used incorrectly
-
-