Class 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 the BeanContext managed by the passed in ComponentBuilderData object. (This will cause the action to be searched in the current ActionStore.) 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 Detail

      • ActionEnabler

        public ActionEnabler​(String actName)
        Creates a new instance of ActionEnabler 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 the FormAction specified by the name passed to the constructor. On this action setEnabled() is invoked. If no action with this name can be found, an exception is thrown.
        Specified by:
        setEnabledState in interface ElementEnabler
        Parameters:
        compData - the ComponentBuilderData instance
        state - the new enabled state
        Throws:
        FormBuilderException - if the action cannot be resolved