com.sdm.quasar.client.core.states
Interface State

All Superinterfaces:
Disposable
All Known Subinterfaces:
BooleanState
All Known Implementing Classes:
AbstractBooleanState, AbstractState, ActionEnabledBooleanState, ButtonModelSelectedBooleanState, DocumentTextAcceptedBooleanState, JComponentEnabledBooleanState, ListModelSelectedBooleanState, MutableState, NOTBooleanState, ThresholdCounterBooleanState, TreeModelSelectedBooleanState, ValueAcceptedBooleanState, WrapperBooleanState

public interface State
extends Disposable

A basic state interface. A State has always current value (see getValue()). If the value changes, a State notifies all registeres StateListeners (see addStateListener(StateListener). The name of the State is for debug putposes only.

Note: State extends Disposable. If disposed, all added StateListeners are removed and no further notification will take place.

Version:
1.0
Author:
Thomas Wolf

Method Summary
 void addStateListener(StateListener listener)
          Registers the given StateListenerto listen to state changes of this State.
 java.lang.String getName()
          Return the name of this State.
 java.lang.Object getValue()
           
 void removeStateListener(StateListener listener)
          Unregisters the given StateListenerfrom this State.
 void setName(java.lang.String name)
          Set the name of the state.
 
Methods inherited from interface com.sdm.quasar.client.core.common.Disposable
dispose
 

Method Detail

getName

public java.lang.String getName()
Return the name of this State.

Returns:
the name of this State (never null)

setName

public void setName(java.lang.String name)
Set the name of the state.

Parameters:
name - the name of the state (must not be null)
Throws:
java.lang.IllegalArgumentException - if the name is null

getValue

public java.lang.Object getValue()
Returns:
the current state value.

addStateListener

public void addStateListener(StateListener listener)
Registers the given StateListenerto listen to state changes of this State.

Parameters:
listener - the StateListenerto add

removeStateListener

public void removeStateListener(StateListener listener)
Unregisters the given StateListenerfrom this State.

Parameters:
listener - the StateListenerto remove