See: Description
Interface | Description |
---|---|
MutableState |
The MutableState interface describes a mutable (more-or-less) binary
state.
|
State |
The State interface describes a (more-or-less) binary state.
Whenever the state changes from not initialized to true/false, from false to true or from true to false, all attached change listeners are notified. If a state changes from either true or false to uninitialized, its listeners are not notified. The source in the ChangeEvent can always be casted to State. |
StateAdapter |
The StateAdapter interface describes the observer of a State Object.
A StateAdapter monitors one (or none) state object, and notifies its target objects whenever the monitored state changes. A implementation class of the StateAdapter interfaces defines the semantics of what really happens if the monitored state changes, the StateAdapter interface describes only the protocol to setup/tear down the connections. |
StateExpression |
The StateExpression interface allows to combine states to an
arbitrary complex logical state expression.
|
Class | Description |
---|---|
AbstractState |
This class holds common code of mutable and immutable states.
|
AbstractStateAdapter |
This abstract implementation of StateAdapter handels all of the
bookkeeping work and delegates the "real" work (adapting of a state
change to a target object) to its subclasses.
|
SimpleState |
This class implements a MutableState and holds the necessary
state information inside the SimpleState object.
|
SimpleStateExpression |
This class implements a StateExpression, see the interface for a
description of what added value SimpleStateExpression provides.
|
The State/StateAdapter library eases the management and reaction of binary states.
It greatly reduces the code needed to keep the internal (logical)
state of an application with its visual representation, e.g.
concerning the enabling/disabeling of buttons depending on
the possible actions that can be taken.
The State/StateAdapter library is also great for expressing and acting on complex "if A then B" rules.
Example: "If the actual user is jzeller and a record with number range
01 is loaded, than the record modification button should be enabled".
The state of the State/StateAdapter library is modeled in the
interface, the observing
of a state is described in the State
interface.
StateAdapter
The binary value of a state can be derived by a particular State
implemention from widgets (e.g. the
watches the
number of entries of a JList).SwingListModelFillState
Also the adaption of a state via a particular StateAdapter can change widgets (e.g. the
adapts 0/1 of its state to enabling/disabling of Swing widgets).
SwingEnabledAdapter
A major goal of the State/StateAdapter library is the reduction of the
LOC (lines of code) that are coded in callback methods and the shift
from callback code to declarative code.
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.