Class InverseEnabler
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.enablers.InverseEnabler
-
- All Implemented Interfaces:
ElementEnabler
public class InverseEnabler extends Object implements ElementEnabler
A specialized implementation of the
ElementEnablerinterface that wraps anotherElementEnablerand inverses thesetEnabledState()implementation of this wrapped enabler.An instance of this class is initialized with a reference to another
ElementEnabler. ThesetEnabledState(ComponentBuilderData, boolean)implementation delegates to this enabler, but thestateargument is inverted. This means if this enabler is told to enable elements, it tells the wrapped enabler to disable its element and vice versa. This is useful for instance for using an existingElementEnablerin a context where the exactly opposite behavior is required.- Version:
- $Id: InverseEnabler.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description InverseEnabler(ElementEnabler wrapped)Creates a new instance ofInverseEnablerand initializes it withElementEnablerto be wrapped.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementEnablergetWrappedEnabler()Returns theElementEnablerwrapped by this object.voidsetEnabledState(ComponentBuilderData compData, boolean state)Performs the change of the enabled state.
-
-
-
Constructor Detail
-
InverseEnabler
public InverseEnabler(ElementEnabler wrapped)
Creates a new instance ofInverseEnablerand initializes it withElementEnablerto be wrapped.- Parameters:
wrapped- the wrappedElementEnabler(must not be null)- Throws:
IllegalArgumentException- if the wrappedElementEnableris null
-
-
Method Detail
-
getWrappedEnabler
public ElementEnabler getWrappedEnabler()
Returns theElementEnablerwrapped by this object.- Returns:
- the wrapped
ElementEnabler
-
setEnabledState
public void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
Performs the change of the enabled state. This implementation calls the wrappedElementEnablerwith the invertedstateargument.- Specified by:
setEnabledStatein interfaceElementEnabler- Parameters:
compData- theComponentBuilderDatainstancestate- the new enabled state- Throws:
FormBuilderException- if the wrappedElementEnablerthrows an exception
-
-