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

java.lang.Object
  extended bycom.sdm.quasar.client.core.states.AbstractState
      extended bycom.sdm.quasar.client.core.states.WrapperBooleanState
All Implemented Interfaces:
BooleanState, Disposable, State

public class WrapperBooleanState
extends AbstractState
implements BooleanState

A BooleanState, that wrappes an other BooleanState: This BooleanState refelcts the state of the wrapped BooleanState. However, the wrapped BooleanState may be changed (see setWrappedBooleanState(BooleanState)) while the adaption to other BooleanStates or BooleanStateAdapters stays now reflecting the state of the new set BooleanState.

The WrapperBooleanState reflects the state ConstantBooleanState.TRUE_STATE if the wrapped state is null.

Version:
1.$Revision$
Author:
Thomas Wolf, Martin Haft

Constructor Summary
WrapperBooleanState(BooleanState state)
          Creates a new WrapperBooleanState.
WrapperBooleanState(java.lang.String name, BooleanState state)
          Creates a new WrapperBooleanState.
 
Method Summary
 void dispose()
          Disposes the component.
protected  BooleanState getBooleanState()
           
 BooleanState getState()
          Returns the source BooleanState.
 java.lang.Object getValue()
           
 boolean isValueTrue()
          Returns true, if this State is enabled, false otherwise.
 void setWrappedBooleanState(BooleanState newWrappedBooleanState)
          Set a new wrapped state.
 
Methods inherited from class com.sdm.quasar.client.core.states.AbstractState
addStateListener, appendParametersToString, 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
 

Constructor Detail

WrapperBooleanState

public WrapperBooleanState(BooleanState state)
Creates a new WrapperBooleanState.


WrapperBooleanState

public WrapperBooleanState(java.lang.String name,
                           BooleanState state)
Creates a new WrapperBooleanState.

Parameters:
name -
Method Detail

dispose

public void dispose()
             throws DisposeException
Description copied from interface: Disposable
Disposes the component.

Important:
This method is called by an administrating component and must never be called directly.

The implementation should release any resources or objects allocated and any services registered. Furthermore, this method should be developed carefully to free a maximum of resources even when the system may have become unstable. In case of one or multiple errors, you should collect them in a DisposeException, continue with the execution, and throw it at the end of the method.

Note: The implementation must not return before the component is disposed. Any threads or asynchronous calls started must be completed before this method returns.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractState
Throws:
DisposeException
See Also:
AbstractState.dispose()

getState

public BooleanState getState()
Returns the source BooleanState.


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()

getBooleanState

protected BooleanState getBooleanState()

setWrappedBooleanState

public void setWrappedBooleanState(BooleanState newWrappedBooleanState)
Set a new wrapped state. The adaption of the WrapperBooleanState to other BooleanStates or BooleanStateAdapters is unaffected. But now the WrapperBooleanState reflects the state of the new set BooleanState

Parameters:
newWrappedBooleanState - the now wrapped state