Class ChainElementEnabler

  • All Implemented Interfaces:
    ElementEnabler

    public class ChainElementEnabler
    extends Object
    implements ElementEnabler

    A specialized implementation of the ElementEnabler interface that maintains an arbitrary number of other ElementEnabler objects.

    An instance of the class is initialized with a collection of other ElementEnabler objects. Its implementation of the setEnabledState(ComponentBuilderData, boolean) method delegates to all of these enablers. This is a natural way of combining ElementEnablers or building groups of them. For instance, it is possible to create an ElementEnabler that manages a set of actions plus some components.

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

      • ChainElementEnabler

        public ChainElementEnabler​(Collection<ElementEnabler> children)
        Creates a new instance of ChainElementEnabler and initializes it with the given collection of child ElementEnabler objects. All child enablers must not be null.
        Parameters:
        children - a collection with the child ElementEnabler objects (must not be null)
        Throws:
        IllegalArgumentException - if the collection of child enablers is null or contains a null element
    • Method Detail

      • getChildEnablers

        public Collection<ElementEnabler> getChildEnablers()
        Returns a collection of the ElementEnabler objects maintained by this ChainElementEnabler.
        Returns:
        a collection of the child ElementEnabler objects
      • setEnabledState

        public void setEnabledState​(ComponentBuilderData compData,
                                    boolean state)
                             throws FormBuilderException
        Performs the change of the enabled state. This implementation calls the setElementState() method of all child ElementEnabler objects.
        Specified by:
        setEnabledState in interface ElementEnabler
        Parameters:
        compData - the ComponentBuilderData instance
        state - the new enabled state
        Throws:
        FormBuilderException - if the wrapped ElementEnabler throws an exception