public class StateManager
extends java.lang.Object
implements java.beans.PropertyChangeListener
Constructor and Description |
---|
StateManager() |
Modifier and Type | Method and Description |
---|---|
void |
addState(State state)
Add a state.
|
State |
getActiveState()
Get the active state.
|
protected State |
getFirstEnabledState(AbstractState ignore)
Get the first state which is enabled.
|
java.util.List<State> |
getStates()
Get the list of known states.
|
boolean |
isIgnoringChanges()
Is this state manager ignoring changes?
|
(package private) boolean |
mayActivate(AbstractState state)
May a state be activated?
|
(package private) boolean |
mayEnable(AbstractState state,
boolean enable)
May the state be enabled or disabled?
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method gets called when a bound property is changed.
|
(package private) void |
setActiveState(State state)
Set the currently active state.
|
void |
setIgnoringChanges(boolean ignoringChanges)
Set whether this state manager is ignoring changes.
|
void setActiveState(@Nullable State state)
state
- state to set active@NotNull public java.util.List<State> getStates()
@Nullable public State getActiveState()
null
)boolean mayActivate(@NotNull AbstractState state)
state
- state to checktrue
if the state is known and enabledboolean mayEnable(AbstractState state, boolean enable)
state
- the stateenable
- enable statetrue
if enable is true or this is not the only enabled stateprotected State getFirstEnabledState(AbstractState ignore)
ignore
- state to be ignored during searchpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.public boolean isIgnoringChanges()
setIgnoringChanges(boolean)
public void setIgnoringChanges(boolean ignoringChanges)
ignoringChanges
- true
the state manager is not propagating state changesfalse
the state manager propagates state changes (normal mode)