Class ComponentEnabler

  • All Implemented Interfaces:
    ElementEnabler

    public class ComponentEnabler
    extends Object
    implements ElementEnabler

    A specialized implementation of the ElementEnabler interface that can change the enabled state of components.

    An instance of this class is initialized with the name of the component it is associated with. The implementation of the setEnabledState() method obtains the ComponentHandler object for this component from the ComponentBuilderData instance and changes its enabled state.

    Version:
    $Id: ComponentEnabler.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ComponentEnabler

        public ComponentEnabler​(String compName)
        Creates a new instance of ComponentEnabler and initializes it with the name of the component whose state is to be changed by this enabler.
        Parameters:
        compName - the name of the component (must not be null)
        Throws:
        IllegalArgumentException - if no component name is specified
    • Method Detail

      • getComponentName

        public String getComponentName()
        Returns the name of the component whose state is changed by this enabler.
        Returns:
        the name of the component
      • setEnabledState

        public void setEnabledState​(ComponentBuilderData compData,
                                    boolean state)
                             throws FormBuilderException
        Performs the change of the enabled state. This implementation obtains the component this enabler is responsible for and changes its enabled state through the corresponding ComponentHandler. If no ComponentHandler can be found in the specified ComponentBuilderData object, a FormBuilderException is thrown.
        Specified by:
        setEnabledState in interface ElementEnabler
        Parameters:
        compData - the ComponentBuilderData instance
        state - the new enabled state
        Throws:
        FormBuilderException - if the ComponentHandler cannot be obtained