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
ElementEnablerinterface 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 theComponentHandlerobject for this component from theComponentBuilderDatainstance 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 ofComponentEnablerand 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 StringgetComponentName()Returns the name of the component whose state is changed by this enabler.voidsetEnabledState(ComponentBuilderData compData, boolean state)Performs the change of the enabled state.
-
-
-
Constructor Detail
-
ComponentEnabler
public ComponentEnabler(String compName)
Creates a new instance ofComponentEnablerand 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 noComponentHandlercan be found in the specifiedComponentBuilderDataobject, aFormBuilderExceptionis thrown.- Specified by:
setEnabledStatein interfaceElementEnabler- Parameters:
compData- theComponentBuilderDatainstancestate- the new enabled state- Throws:
FormBuilderException- if theComponentHandlercannot be obtained
-
-