Interface ElementEnabler
-
- All Known Implementing Classes:
ActionEnabler
,ActionGroupEnabler
,ChainElementEnabler
,ComponentEnabler
,InverseEnabler
,NullEnabler
public interface ElementEnabler
Definition of an interface to be implemented by components that can change the enabled state of specific elements.
In a UI application it is frequently the case that some elements (e.g. UI components, actions, or windows) become enabled or disabled based on certain criteria defined by the application. For instance, when the user selects a menu item that starts a long running action in a background task, typically this menu item should be disabled so that the user cannot start a second process before the first one terminates. On the other hand, maybe a menu item for canceling the background process becomes active during its life time.
With this interface such status changes can be implemented in a generic way. There will be specific implementations for dealing with different UI elements that can be disabled and enabled. The interface itself is pretty lean. It defines only a single generic method for changing the enabled state of an element.
- Version:
- $Id: ElementEnabler.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
setEnabledState(ComponentBuilderData compData, boolean state)
Changes the enabled state of the element thisElementEnabler
is responsible for.
-
-
-
Method Detail
-
setEnabledState
void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
Changes the enabled state of the element thisElementEnabler
is responsible for. This method is always called when the enabled state of elements has to be changed. The passed inComponentBuilderData
object can be used for accessing relevant elements; especially theBeanContext
maintained by this object can be used for retrieving all objects available in the current builder context. The boolean argument determines whether the associated element should be enabled or disabled. If the state of the element cannot be changed - for whatever reason -, an implementation should throw aFormBuilderException
.- Parameters:
compData
- a reference to the currentComponentBuilderData
objectstate
- the new enabled state of the associated element: true if the element is to be enabled, false if it should be disabled- Throws:
FormBuilderException
- if the state of the element cannot be changed
-
-