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.
Modifier and Type | Method and Description |
---|---|
void |
setEnabledState(ComponentBuilderData compData,
boolean state)
Changes the enabled state of the element this
ElementEnabler is
responsible for. |
void setEnabledState(ComponentBuilderData compData, boolean state) throws FormBuilderException
ElementEnabler
is
responsible for. This method is always called when the enabled state of
elements has to be changed. The passed in ComponentBuilderData
object can be used for accessing relevant elements; especially the
BeanContext
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 a FormBuilderException
.compData
- a reference to the current ComponentBuilderData
objectstate
- the new enabled state of the associated element: true
if the element is to be enabled, false if it should be
disabledFormBuilderException
- if the state of the element cannot be
changedCopyright © 2016 The JGUIraffe Team. All rights reserved.