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
ActionData
interface.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 Accelerator
object can be specified. This object is searched in the current bean context. The attributesacceleratorDef
andacceleratorRef
are mutual exclusive.yes Because this tag handler class also implements the
IconSupport
interface 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 ofActionDataTag
and initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkAttributes()
A helper method for checking whether all attributes are correctly defined.Accelerator
getAccelerator()
Returns theAccelerator
associated with the represented action.String
getAcceleratorDef()
Returns the accelerator definition.String
getAcceleratorRef()
Returns the name of a variable to be used as accelerator.protected ActionBuilder
getActionBuilder()
Returns a reference to the currentActionBuilder
instance.protected ActionManager
getActionManager()
Convenience method for obtaining a reference to the currentActionManager
.Object
getIcon()
Returns the icon for this action.int
getMnemonicKey()
Returns the mnemonic for this action.String
getName()
Returns the name of this component.String
getText()
Returns this action's text.String
getToolTip()
Returns the text for this action's tool tip.protected void
processBeforeBody()
Performs processing before the body of this tag gets executed.void
setAccelerator(Accelerator accelerator)
Allows setting anAccelerator
for the represented action.void
setAcceleratorDef(String acceleratorDef)
Set method of the acceleratorDef attribute.void
setAcceleratorRef(String acceleratorRef)
Set method of the acceleratorRef attribute.void
setIcon(Object icon)
Sets the icon for this action.void
setMnemonic(String s)
Setter method for the mnemonic attribute.void
setMnemonicres(String s)
Setter method for the mnemonicres attribute.void
setName(String name)
Sets the name of this component.void
setResgrp(String s)
Setter method for the resgrp attribute.void
setText(String t)
Setter method of the text attribute.void
setTextres(String r)
Setter method for the textres attribute.void
setTooltip(String s)
Setter method for the tooltip attribute.void
setTooltipres(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:
setIcon
in interfaceIconSupport
- Parameters:
icon
- the icon
-
getIcon
public Object getIcon()
Returns the icon for this action.- Specified by:
getIcon
in interfaceActionData
- Returns:
- the icon
-
getMnemonicKey
public int getMnemonicKey()
Returns the mnemonic for this action.- Specified by:
getMnemonicKey
in interfaceActionData
- Returns:
- the mnemonic
-
getText
public String getText()
Returns this action's text.- Specified by:
getText
in interfaceActionData
- Returns:
- the text
-
getToolTip
public String getToolTip()
Returns the text for this action's tool tip.- Specified by:
getToolTip
in interfaceActionData
- Returns:
- the tool tip
-
getName
public String getName()
Returns the name of this component.- Specified by:
getName
in 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 correspondingAccelerator
instance.- 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 theAccelerator
associated with the represented action.- Specified by:
getAccelerator
in interfaceActionData
- Returns:
- the
Accelerator
-
setAccelerator
public void setAccelerator(Accelerator accelerator)
Allows setting anAccelerator
for the represented action. This method may be called by tags in the body of this tag.- Parameters:
accelerator
- theAccelerator
for this action
-
checkAttributes
protected void checkAttributes() throws org.apache.commons.jelly.JellyTagException
A 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, FormBuilderException
Performs 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:
processBeforeBody
in 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 currentActionBuilder
instance. 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
-
-