Class ActionEnabler
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.enablers.ActionEnabler
-
- All Implemented Interfaces:
ElementEnabler
public class ActionEnabler extends Object implements ElementEnabler
A specialized implementation of the
ElementEnabler
interface that can change the enabled state of actions.An instance of this class is initialized with the name of the action it should manipulate. The implementation of the
setEnabledState()
method obtains the action with this name from theBeanContext
managed by the passed inComponentBuilderData
object. (This will cause the action to be searched in the currentActionStore
.) Then the action's enabled state is set accordingly.- Version:
- $Id: ActionEnabler.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ActionEnabler(String actName)
Creates a new instance ofActionEnabler
and initializes it with the name of the action to manipulate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getActionName()
Returns the name of the action that is affected by this enabler.void
setEnabledState(ComponentBuilderData compData, boolean state)
Performs the change of the enabled state.
-
-
-
Constructor Detail
-
ActionEnabler
public ActionEnabler(String actName)
Creates a new instance ofActionEnabler
and initializes it with the name of the action to manipulate.- Parameters:
actName
- the name of the action (must not be null- Throws:
IllegalArgumentException
- if no action name is provided
-
-
Method Detail
-
getActionName
public String getActionName()
Returns the name of the action that is affected by this enabler.- Returns:
- the name of the action to be manipulated
-
setEnabledState
public void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
Performs the change of the enabled state. Obtains theFormAction
specified by the name passed to the constructor. On this actionsetEnabled()
is invoked. If no action with this name can be found, an exception is thrown.- Specified by:
setEnabledState
in interfaceElementEnabler
- Parameters:
compData
- theComponentBuilderData
instancestate
- the new enabled state- Throws:
FormBuilderException
- if the action cannot be resolved
-
-