Class ToggleButtonTag
- 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.PushButtonTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ToggleButtonTag
-
- All Implemented Interfaces:
ConditionalTag
,IconSupport
,org.apache.commons.jelly.Tag
- Direct Known Subclasses:
ButtonTag
public class ToggleButtonTag extends PushButtonTag
A specific tag handler class for creating toggle buttons.
Toggle buttons are very similar to command buttons except for the fact that they have an associated data value that is also stored in the generated
Form
's data bean: the information whether or not the button is selected (pressed). So components of this type can be used to implement a switch.Analogously to other tags derived from the
PushButtonTag
class tags of this type can have an icon and a display text. The following table lists all supported attributes (in addition to the default attributes allowed for all input components):Attribute Description Optional text
With this attribute the label's text can directly be set. yes textres
Defines the resource ID for the label's text. The real text is resolved using the current resource manager and the current locale. yes resgrp
Specifies the resource group of the label's text. If set, this resource group is used when resolving the label's text as defined by the textres
attribute. If undefined, the form builder's default resource group will be used.yes alignment
Defines the relative position of the label's icon to its text. This can be one of the literal names of the TextIconAlignment
class.yes mnemonic
Here a mnemonic for this label can be specified. If the user enters this key, the associated component will be focused (if supported by the platform). yes mnemonicres
This attribute defines the mnemonic as a resource, which makes sense for i18n applications. yes command
Allows to define a command string. Action events that are caused by this button will contain this string. yes - Version:
- $Id: ToggleButtonTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ToggleButtonTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<?>
createPushButton(ComponentManager manager, boolean create)
Creates the new toggle button component.String
getCommand()
Returns the command string of this button.void
setCommand(String command)
Setter method of the command attribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.PushButtonTag
createComponentHandler, getTextIconData, setAlignment, setIcon, setMnemonic, setMnemonicres, setResgrp, setText, setTextres, validateTag
-
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, processBeforeBody, 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
-
getCommand
public String getCommand()
Returns the command string of this button.- Returns:
- the command of this button
-
setCommand
public void setCommand(String command)
Setter method of the command attribute.- Parameters:
command
- the attribute value
-
createPushButton
protected ComponentHandler<?> createPushButton(ComponentManager manager, boolean create) throws FormBuilderException
Creates the new toggle button component.- Specified by:
createPushButton
in classPushButtonTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the handler for the newly created component
- Throws:
FormBuilderException
- if an error occurs
-
-