Class ComponentEnabler
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.enablers.ComponentEnabler
-
- All Implemented Interfaces:
ElementEnabler
public class ComponentEnabler extends Object implements ElementEnabler
A specialized implementation of the
ElementEnabler
interface that can change the enabled state of components.An instance of this class is initialized with the name of the component it is associated with. The implementation of the
setEnabledState()
method obtains theComponentHandler
object for this component from theComponentBuilderData
instance and changes its enabled state.- Version:
- $Id: ComponentEnabler.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ComponentEnabler(String compName)
Creates a new instance ofComponentEnabler
and initializes it with the name of the component whose state is to be changed by this enabler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getComponentName()
Returns the name of the component whose state is changed by this enabler.void
setEnabledState(ComponentBuilderData compData, boolean state)
Performs the change of the enabled state.
-
-
-
Constructor Detail
-
ComponentEnabler
public ComponentEnabler(String compName)
Creates a new instance ofComponentEnabler
and initializes it with the name of the component whose state is to be changed by this enabler.- Parameters:
compName
- the name of the component (must not be null)- Throws:
IllegalArgumentException
- if no component name is specified
-
-
Method Detail
-
getComponentName
public String getComponentName()
Returns the name of the component whose state is changed by this enabler.- Returns:
- the name of the component
-
setEnabledState
public void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
Performs the change of the enabled state. This implementation obtains the component this enabler is responsible for and changes its enabled state through the correspondingComponentHandler
. If noComponentHandler
can be found in the specifiedComponentBuilderData
object, aFormBuilderException
is thrown.- Specified by:
setEnabledState
in interfaceElementEnabler
- Parameters:
compData
- theComponentBuilderData
instancestate
- the new enabled state- Throws:
FormBuilderException
- if theComponentHandler
cannot be obtained
-
-