Class ChainElementEnabler
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.enablers.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 otherElementEnabler
objects.An instance of the class is initialized with a collection of other
ElementEnabler
objects. Its implementation of thesetEnabledState(ComponentBuilderData, boolean)
method delegates to all of these enablers. This is a natural way of combiningElementEnabler
s or building groups of them. For instance, it is possible to create anElementEnabler
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 Summary
Constructors Constructor Description ChainElementEnabler(Collection<ElementEnabler> children)
Creates a new instance ofChainElementEnabler
and initializes it with the given collection of childElementEnabler
objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ElementEnabler>
getChildEnablers()
Returns a collection of theElementEnabler
objects maintained by thisChainElementEnabler
.void
setEnabledState(ComponentBuilderData compData, boolean state)
Performs the change of the enabled state.
-
-
-
Constructor Detail
-
ChainElementEnabler
public ChainElementEnabler(Collection<ElementEnabler> children)
Creates a new instance ofChainElementEnabler
and initializes it with the given collection of childElementEnabler
objects. All child enablers must not be null.- Parameters:
children
- a collection with the childElementEnabler
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 theElementEnabler
objects maintained by thisChainElementEnabler
.- 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 thesetElementState()
method of all childElementEnabler
objects.- Specified by:
setEnabledState
in interfaceElementEnabler
- Parameters:
compData
- theComponentBuilderData
instancestate
- the new enabled state- Throws:
FormBuilderException
- if the wrappedElementEnabler
throws an exception
-
-