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
ElementEnabler
interface that wraps anotherElementEnabler
and 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 thestate
argument 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 existingElementEnabler
in 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 ofInverseEnabler
and initializes it withElementEnabler
to be wrapped.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementEnabler
getWrappedEnabler()
Returns theElementEnabler
wrapped by this object.void
setEnabledState(ComponentBuilderData compData, boolean state)
Performs the change of the enabled state.
-
-
-
Constructor Detail
-
InverseEnabler
public InverseEnabler(ElementEnabler wrapped)
Creates a new instance ofInverseEnabler
and initializes it withElementEnabler
to be wrapped.- Parameters:
wrapped
- the wrappedElementEnabler
(must not be null)- Throws:
IllegalArgumentException
- if the wrappedElementEnabler
is null
-
-
Method Detail
-
getWrappedEnabler
public ElementEnabler getWrappedEnabler()
Returns theElementEnabler
wrapped 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 wrappedElementEnabler
with the invertedstate
argument.- Specified by:
setEnabledState
in interfaceElementEnabler
- Parameters:
compData
- theComponentBuilderData
instancestate
- the new enabled state- Throws:
FormBuilderException
- if the wrappedElementEnabler
throws an exception
-
-