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
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
andminorTicks
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 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 aComponentHandler
for the managed slider component.int
getMajorTicks()
Returns the spacing for major ticks.int
getMax()
Returns the maximum value of the slider.int
getMin()
Returns the minimum value of the slider.int
getMinorTicks()
Returns the spacing for minor ticks.String
getOrientation()
Returns the slider's orientation as string value.Orientation
getSliderOrientation()
Returns theOrientation
value of the slider.boolean
isShowLabels()
Returns a flag whether labels for values should be painted by the slider.boolean
isShowTicks()
Returns a flag whether ticks should be painted by the slider.protected void
processBeforeBody()
Performs processing before evaluation of the tag body.void
setMajorTicks(int majorTicks)
Set method of themajorTicks
attribute.void
setMax(int max)
Set method of themax
attribute.void
setMin(int min)
Set method of themin
attribute.void
setMinorTicks(int minorTicks)
Set method of theminorTicks
attribute.void
setOrientation(String orientation)
Set method of theorientation
attribute.void
setShowLabels(boolean showLabels)
Set method of theshowLabels
attribute.void
setShowTicks(boolean showTicks)
Set method of theshowTicks
attribute.-
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 theorientation
attribute (it may not be a valid orientation value).- Returns:
- the orientation as string
-
setOrientation
public void setOrientation(String orientation)
Set method of theorientation
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 themin
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 themax
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 themajorTicks
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 theminorTicks
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 theshowTicks
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 theshowLabels
attribute.- Parameters:
showLabels
- the attribute's value
-
getSliderOrientation
public Orientation getSliderOrientation()
Returns theOrientation
value of the slider. The value of theorientation
attribute is transformed into anOrientation
instance by theprocessBeforeBody()
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 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 aComponentHandler
for the managed slider component.- Specified by:
createComponentHandler
in classInputComponentTag
- Parameters:
manager
- theComponentManager
create
- 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
-
-