public class InverseEnabler extends Object implements ElementEnabler
A specialized implementation of the ElementEnabler interface that
wraps another ElementEnabler and inverses the setEnabledState() implementation of this wrapped enabler.
An instance of this class is initialized with a reference to another ElementEnabler. The setEnabledState(ComponentBuilderData, boolean)
implementation delegates to this enabler, but the state 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 existing ElementEnabler in a context where the
exactly opposite behavior is required.
| Constructor and Description |
|---|
InverseEnabler(ElementEnabler wrapped)
Creates a new instance of
InverseEnabler and initializes it with
ElementEnabler to be wrapped. |
| Modifier and Type | Method and Description |
|---|---|
ElementEnabler |
getWrappedEnabler()
Returns the
ElementEnabler wrapped by this object. |
void |
setEnabledState(ComponentBuilderData compData,
boolean state)
Performs the change of the enabled state.
|
public InverseEnabler(ElementEnabler wrapped)
InverseEnabler and initializes it with
ElementEnabler to be wrapped.wrapped - the wrapped ElementEnabler (must not be
null)IllegalArgumentException - if the wrapped ElementEnabler is
nullpublic ElementEnabler getWrappedEnabler()
ElementEnabler wrapped by this object.ElementEnablerpublic void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
ElementEnabler with the inverted state argument.setEnabledState in interface ElementEnablercompData - the ComponentBuilderData instancestate - the new enabled stateFormBuilderException - if the wrapped ElementEnabler throws
an exceptionCopyright © 2016 The JGUIraffe Team. All rights reserved.