com.sdm.quasar.client.core.states
Class AbstractBooleanState

java.lang.Object
  extended bycom.sdm.quasar.client.core.states.AbstractState
      extended bycom.sdm.quasar.client.core.states.AbstractBooleanState
All Implemented Interfaces:
BooleanState, Disposable, State
Direct Known Subclasses:
AbstractCombinedBooleanState, AcceptorBooleanState, ActionEnabledBooleanState, ButtonModelSelectedBooleanState, ConstantBooleanState, DocumentTextAcceptedBooleanState, JComponentEnabledBooleanState, ListModelSelectedBooleanState, MutableBooleanState, TreeModelSelectedBooleanState

public abstract class AbstractBooleanState
extends AbstractState
implements BooleanState

An abstract BooleanState implementation, that manages the enabled state as boolean, that subclasses can directly set.

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
AbstractBooleanState()
          Creates a new AbstractBooleanState.
AbstractBooleanState(boolean initialValue)
          Creates a new AbstractBooleanState.
AbstractBooleanState(java.lang.String name)
          Creates a new AbstractBooleanState.
AbstractBooleanState(java.lang.String name, boolean initialValue)
          Creates a new AbstractBooleanState.
 
Method Summary
 java.lang.Object getValue()
           
 boolean isValueTrue()
          Returns true, if this State is enabled, false otherwise.
protected  void setValue(boolean enabled)
          Sets the enabled state of this BooleanState.
protected  boolean setValueWithoutNotification(boolean enabled)
          Sets the enabled state of this BooleanState.
 
Methods inherited from class com.sdm.quasar.client.core.states.AbstractState
addStateListener, appendParametersToString, dispose, fireStateChanged, getName, removeStateListener, setName, stateValueToString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sdm.quasar.client.core.states.State
addStateListener, getName, removeStateListener, setName
 
Methods inherited from interface com.sdm.quasar.client.core.common.Disposable
dispose
 

Constructor Detail

AbstractBooleanState

public AbstractBooleanState()
Creates a new AbstractBooleanState.


AbstractBooleanState

public AbstractBooleanState(boolean initialValue)
Creates a new AbstractBooleanState.

Parameters:
initialValue - the initial value of this AbstractBooleanState

AbstractBooleanState

public AbstractBooleanState(java.lang.String name)
Creates a new AbstractBooleanState.

Parameters:
name - the name of this AbstractBooleanState (not null)

AbstractBooleanState

public AbstractBooleanState(java.lang.String name,
                            boolean initialValue)
Creates a new AbstractBooleanState.

Parameters:
name - the name of this AbstractBooleanState (not null)
initialValue - the initial value of this AbstractBooleanState
Method Detail

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface State
Returns:
the current state value.
See Also:
State.getValue()

isValueTrue

public boolean isValueTrue()
Description copied from interface: BooleanState
Returns true, if this State is enabled, false otherwise.

Specified by:
isValueTrue in interface BooleanState
Returns:
true, if this State is enabled, false otherwise.
See Also:
BooleanState.isValueTrue()

setValue

protected void setValue(boolean enabled)
Sets the enabled state of this BooleanState. If the enablement changes in respect to this call, all registered listeners will get notified.

Parameters:
enabled - the enabled state.

setValueWithoutNotification

protected boolean setValueWithoutNotification(boolean enabled)
Sets the enabled state of this BooleanState.

Note: No listeners will informed about state changes. This method is for special purposes only (e.g. controlling synchronized blockes); normal users should call setValue(boolean).

Parameters:
enabled - the enabled state.
Returns:
true, if the enablement changed and notification should be made; false otherwise.