Class PushButtonTag
- 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
-
- All Implemented Interfaces:
ConditionalTag
,IconSupport
,org.apache.commons.jelly.Tag
- Direct Known Subclasses:
CheckboxTag
,RadioButtonTag
,StaticTextTag
,ToggleButtonTag
public abstract class PushButtonTag extends InputComponentTag implements IconSupport
An abstract base class for tag handler classes that implement push buttons like checkboxes or radio buttons.
Push buttons have multiple common attributes that are handled by this class, among them a text and an icon definition. These are implemented using the
class.TextIconData
This tag handler base class is the counterpart of
for full featured input components.TextIconTag
- Version:
- $Id: PushButtonTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PushButtonTag()
Creates a new instance ofPushButtonTag
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<?>
createComponentHandler(ComponentManager manager, boolean create)
Creates the component handler for the new input component.protected abstract ComponentHandler<?>
createPushButton(ComponentManager manager, boolean create)
Creates the push button component of the correct type.TextIconData
getTextIconData()
Returns the text icon data object associated with this tag.void
setAlignment(String al)
Setter method of the alignment attribute.void
setIcon(Object icon)
Setter method for the icon attribute.void
setMnemonic(String m)
Setter method of the mnemonic attribute.void
setMnemonicres(String resID)
Setter method of the mnemonicres attribute.void
setResgrp(String resgrp)
Setter method for the resgrp attribute.void
setText(String text)
Setter method for the text attribute.void
setTextres(String textres)
Setter method for the textres attribute.protected void
validateTag()
Validates the attributes of this tag.-
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
-
getTextIconData
public TextIconData getTextIconData()
Returns the text icon data object associated with this tag.- Returns:
- the text icon data object
-
setIcon
public void setIcon(Object icon)
Setter method for the icon attribute.- Specified by:
setIcon
in interfaceIconSupport
- Parameters:
icon
- the icon
-
setText
public void setText(String text)
Setter method for the text attribute.- Parameters:
text
- the text to set
-
setResgrp
public void setResgrp(String resgrp)
Setter method for the resgrp attribute. Defines the group for resolving the resource for the component's text.- Parameters:
resgrp
- the resource group
-
setTextres
public void setTextres(String textres)
Setter method for the textres attribute. Specifies the resource ID for resolving the component's text- Parameters:
textres
- the text resource ID
-
setAlignment
public void setAlignment(String al)
Setter method of the alignment attribute.- Parameters:
al
- the attribute value
-
setMnemonic
public void setMnemonic(String m)
Setter method of the mnemonic attribute.- Parameters:
m
- the attribute value
-
setMnemonicres
public void setMnemonicres(String resID)
Setter method of the mnemonicres attribute.- Parameters:
resID
- the attribute value
-
createComponentHandler
protected ComponentHandler<?> createComponentHandler(ComponentManager manager, boolean create) throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Creates the component handler for the new input component. Performs parameter checks and invokescreatePushButton()
that really creates the component.- Specified by:
createComponentHandler
in classInputComponentTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the new component handler
- Throws:
FormBuilderException
- if an error occursorg.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
validateTag
protected void validateTag() throws FormBuilderException, org.apache.commons.jelly.JellyTagException
Validates the attributes of this tag. This method is invoked before the push button is created. This implementation tests if either a text or an icon is provided. If both are undefined, an exception will be thrown.- Throws:
FormBuilderException
- if an error occursorg.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
createPushButton
protected abstract ComponentHandler<?> createPushButton(ComponentManager manager, boolean create) throws FormBuilderException
Creates the push button component of the correct type. This method must be implemented in a concrete sub class. It has to invoke the proper creation method on the passed inComponentManager
object. The base class ensures that this method is called at the right time and that all required parameters have been provided.- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the new component handler
- Throws:
FormBuilderException
- if an error occurs
-
-