Class NullEnabler

  • All Implemented Interfaces:
    ElementEnabler

    public class NullEnabler
    extends Object
    implements ElementEnabler

    A trivial implementation of the ElementEnabler interface that does nothing.

    This class provides an empty dummy implementation of the setEnabledState() method. It can be used as an application of the null object pattern where an ElementEnabler is optional.

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

      • INSTANCE

        public static final NullEnabler INSTANCE
        A constant for a default instance of this class.
    • Constructor Detail

      • NullEnabler

        public NullEnabler()
    • Method Detail

      • setEnabledState

        public void setEnabledState​(ComponentBuilderData compData,
                                    boolean state)
                             throws FormBuilderException
        Changes the enabled state of the element this ElementEnabler is responsible for. This method is always called when the enabled state of elements has to be changed. The passed in ComponentBuilderData object can be used for accessing relevant elements; especially the BeanContext maintained by this object can be used for retrieving all objects available in the current builder context. The boolean argument determines whether the associated element should be enabled or disabled. If the state of the element cannot be changed - for whatever reason -, an implementation should throw a FormBuilderException. An empty dummy implementation of this interface method. It does literally nothing.
        Specified by:
        setEnabledState in interface ElementEnabler
        Parameters:
        compData - a reference to the current ComponentBuilderData object
        state - the new enabled state of the associated element: true if the element is to be enabled, false if it should be disabled
        Throws:
        FormBuilderException - if the state of the element cannot be changed