Class AbstractActionDataTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.action.tags.AbstractActionDataTag
-
- All Implemented Interfaces:
ActionData,ConditionalTag,IconSupport,org.apache.commons.jelly.Tag
- Direct Known Subclasses:
ActionControlTag,ActionDataTag,ActionTag
public abstract class AbstractActionDataTag extends FormBaseTag implements ActionData, IconSupport
An abstract base class for tag handler classes that need to deal with action objects and their properties.
This base class provides all functionality for managing an action's properties. These properties can be set using various setter methods. They are accessed through the implemented
ActionDatainterface.The following table lists all supported attributes:
Attribute Description Optional text Directly defines the text of this action. yes textres Defines the action's text from a text resource. yes resgrp Allows specifying a resource group. This group will be used when resolving the resources for the text, the mnemonic, and the tool tip (unless for the tool tip a separate group is defined). yes mnemonic Directly sets the mnemonic key. yes mnemonicres Allows to specify a resource ID from which the mnemonic will be obtained. yes tooltip Directly sets the tooltip for this action. yes tooltipres Allows specifying a resource ID for this action's tool tip. yes acceleratorDef Sets the accelerator for this action. This attribute expects a string representation of an accelerator that can be parsed by the Accelerator.parse(String)method.yes acceleratorRef With this attribute a reference to an Acceleratorobject can be specified. This object is searched in the current bean context. The attributesacceleratorDefandacceleratorRefare mutual exclusive.yes Because this tag handler class also implements the
IconSupportinterface an<icon>tag can occur in the body.- Version:
- $Id: AbstractActionDataTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description AbstractActionDataTag()Creates a new instance ofActionDataTagand initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckAttributes()A helper method for checking whether all attributes are correctly defined.AcceleratorgetAccelerator()Returns theAcceleratorassociated with the represented action.StringgetAcceleratorDef()Returns the accelerator definition.StringgetAcceleratorRef()Returns the name of a variable to be used as accelerator.protected ActionBuildergetActionBuilder()Returns a reference to the currentActionBuilderinstance.protected ActionManagergetActionManager()Convenience method for obtaining a reference to the currentActionManager.ObjectgetIcon()Returns the icon for this action.intgetMnemonicKey()Returns the mnemonic for this action.StringgetName()Returns the name of this component.StringgetText()Returns this action's text.StringgetToolTip()Returns the text for this action's tool tip.protected voidprocessBeforeBody()Performs processing before the body of this tag gets executed.voidsetAccelerator(Accelerator accelerator)Allows setting anAcceleratorfor the represented action.voidsetAcceleratorDef(String acceleratorDef)Set method of the acceleratorDef attribute.voidsetAcceleratorRef(String acceleratorRef)Set method of the acceleratorRef attribute.voidsetIcon(Object icon)Sets the icon for this action.voidsetMnemonic(String s)Setter method for the mnemonic attribute.voidsetMnemonicres(String s)Setter method for the mnemonicres attribute.voidsetName(String name)Sets the name of this component.voidsetResgrp(String s)Setter method for the resgrp attribute.voidsetText(String t)Setter method of the text attribute.voidsetTextres(String r)Setter method for the textres attribute.voidsetTooltip(String s)Setter method for the tooltip attribute.voidsetTooltipres(String s)Setter method for the tooltipres attribute.-
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, process, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jguiraffe.gui.builder.action.ActionData
getTask
-
-
-
-
Method Detail
-
setText
public void setText(String t)
Setter method of the text attribute.- Parameters:
t- the attribute value
-
setTextres
public void setTextres(String r)
Setter method for the textres attribute.- Parameters:
r- the attribute value
-
setResgrp
public void setResgrp(String s)
Setter method for the resgrp attribute.- Parameters:
s- the attribute value
-
setMnemonic
public void setMnemonic(String s)
Setter method for the mnemonic attribute.- Parameters:
s- the attribute value
-
setMnemonicres
public void setMnemonicres(String s)
Setter method for the mnemonicres attribute.- Parameters:
s- the attribute value
-
setTooltip
public void setTooltip(String s)
Setter method for the tooltip attribute.- Parameters:
s- the attribute value
-
setTooltipres
public void setTooltipres(String s)
Setter method for the tooltipres attribute.- Parameters:
s- the attribute value
-
setIcon
public void setIcon(Object icon)
Sets the icon for this action.- Specified by:
setIconin interfaceIconSupport- Parameters:
icon- the icon
-
getIcon
public Object getIcon()
Returns the icon for this action.- Specified by:
getIconin interfaceActionData- Returns:
- the icon
-
getMnemonicKey
public int getMnemonicKey()
Returns the mnemonic for this action.- Specified by:
getMnemonicKeyin interfaceActionData- Returns:
- the mnemonic
-
getText
public String getText()
Returns this action's text.- Specified by:
getTextin interfaceActionData- Returns:
- the text
-
getToolTip
public String getToolTip()
Returns the text for this action's tool tip.- Specified by:
getToolTipin interfaceActionData- Returns:
- the tool tip
-
getName
public String getName()
Returns the name of this component.- Specified by:
getNamein interfaceActionData- Returns:
- the name
-
setName
public void setName(String name)
Sets the name of this component. The concrete meaning of this name is determined by derived classes.- Parameters:
name- the name
-
getAcceleratorDef
public String getAcceleratorDef()
Returns the accelerator definition.- Returns:
- the accelerator definition
-
setAcceleratorDef
public void setAcceleratorDef(String acceleratorDef)
Set method of the acceleratorDef attribute. Here the string representation of an accelerator can be set. It will be used for obtaining a correspondingAcceleratorinstance.- Parameters:
acceleratorDef- the accelerator definition as string- See Also:
Accelerator.parse(String)
-
getAcceleratorRef
public String getAcceleratorRef()
Returns the name of a variable to be used as accelerator.- Returns:
- the name of an accelerator variable
-
setAcceleratorRef
public void setAcceleratorRef(String acceleratorRef)
Set method of the acceleratorRef attribute. Here the name of a variable can be specified that should be used as accelerator. The tag will look up this variable in the current bean context.- Parameters:
acceleratorRef- the accelerator reference
-
getAccelerator
public Accelerator getAccelerator()
Returns theAcceleratorassociated with the represented action.- Specified by:
getAcceleratorin interfaceActionData- Returns:
- the
Accelerator
-
setAccelerator
public void setAccelerator(Accelerator accelerator)
Allows setting anAcceleratorfor the represented action. This method may be called by tags in the body of this tag.- Parameters:
accelerator- theAcceleratorfor this action
-
checkAttributes
protected void checkAttributes() throws org.apache.commons.jelly.JellyTagExceptionA helper method for checking whether all attributes are correctly defined. This implementation tests whether at least a text or an icon was provided for the action. Note that this method is not automatically called; sub classes must invoke it if necessary.- Throws:
org.apache.commons.jelly.JellyTagException- if attributes are invalid or required attributes are missing
-
processBeforeBody
protected void processBeforeBody() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionPerforms processing before the body of this tag gets executed. This implementation checks the accelerator specification. If one is defined, it is fetched and passed to thesetAccelerator()method.- Overrides:
processBeforeBodyin classFormBaseTag- Throws:
org.apache.commons.jelly.JellyTagException- if the tag is incorrectly usedFormBuilderException- if an error occurs
-
getActionBuilder
protected ActionBuilder getActionBuilder()
Returns a reference to the currentActionBuilderinstance. This instance is expected to be placed in the Jelly context.- Returns:
- the current action builder
-
getActionManager
protected ActionManager getActionManager()
Convenience method for obtaining a reference to the currentActionManager.- Returns:
- the current action manager
-
-