public abstract class AbstractStateAdapter extends Object implements StateAdapter, ChangeListener
| Constructor and Description | 
|---|
AbstractStateAdapter()
Creates a new adapter, that monitors no state and has an
 empty string as its name. 
 | 
AbstractStateAdapter(State pState)
Creates a new adapter, that monitors the handed state and has an
 empty string as its name. 
 | 
AbstractStateAdapter(State pState,
                    String pName)
Creates a new adapter, that monitors the handed state and uses
 the handed string as its name. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
add(Object pTarget)
Add a target object to our adapter. 
 | 
void | 
add(Object pTarget,
   boolean pInvert)
Add a target object to our adapter. 
 | 
void | 
addInvert(Object pTarget)
Add a target object with inverted state change logic to our adapter. 
 | 
protected abstract void | 
adjustInitialState(Object pTarget,
                  boolean pEnabled)
Implement this method in a subclass to set the initial state
 of a target object. 
 | 
protected String | 
getConsistencyCategory()
This implementation returns the full class name to be used
 as a key in the  
CONSISTENCY_MAP. | 
String | 
getName()
Return the name of the state adapter. 
 | 
protected abstract void | 
processStateChange(Object pTarget,
                  boolean pEnabled)
Implement this method in a subclass to set the state of a target
 object after our monitored state changes. 
 | 
void | 
remove(Object pComponent)
Removes the handed object of our adapter. 
 | 
void | 
setName(String pName)
Set the name of the state adapter. 
 | 
void | 
setState(State pState)
Sets (or resets if pState=null) the state this adapter acts on. 
 | 
void | 
stateChanged(ChangeEvent pEvent)
Internal method to monitor our state, don't call this. 
 | 
public AbstractStateAdapter()
public AbstractStateAdapter(State pState)
pState - the state we adopt to, may be nullpublic AbstractStateAdapter(State pState, String pName)
pState - the state we adopt to, may be nullpName - our nameIllegalArgumentException - if pName is nullpublic String getName()
StateAdaptergetName in interface StateAdapterpublic void setName(String pName)
StateAdaptersetName in interface StateAdapterpName - the name of the state (must not be null)public void setState(State pState)
StateAdaptersetState in interface StateAdapterpState - null or the state we act uponpublic void add(Object pTarget)
StateAdapteradd in interface StateAdapterpTarget - target we should act on when our state changespublic void addInvert(Object pTarget)
StateAdapteraddInvert in interface StateAdapterpTarget - target we should act on when our state changespublic void add(Object pTarget, boolean pInvert)
StateAdapteradd in interface StateAdapterpTarget - target we should act on when our state changespInvert - flag if we should invert the state changeprotected String getConsistencyCategory()
CONSISTENCY_MAP.
 Override to match if your implementation affects the same
 property of a target as another implementation.CONSISTENCY_MAPpublic void remove(Object pComponent)
StateAdapterremove in interface StateAdapterpComponent - target we should removepublic void stateChanged(ChangeEvent pEvent)
stateChanged in interface ChangeListenerpEvent - not usedprotected abstract void adjustInitialState(Object pTarget, boolean pEnabled)
pTarget - target object, never nullpEnabled - true if the target object should get "enabled"protected abstract void processStateChange(Object pTarget, boolean pEnabled)
pTarget - target object, never nullpEnabled - true if the target object should get "enabled"Copyright © 2017 Jürgen Zeller (privat). All rights reserved.