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

java.lang.Object
  extended bycom.sdm.quasar.client.core.states.AbstractBooleanStateAdapter
All Implemented Interfaces:
BooleanStateAdapter, Disposable
Direct Known Subclasses:
AbstractSwingBooleanStateAdapter

public abstract class AbstractBooleanStateAdapter
extends java.lang.Object
implements BooleanStateAdapter

An abstract BooleanStateAdapter implementation, which supports more than one target object to adapt.

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
AbstractBooleanStateAdapter()
          Creates a new AbstractBooleanStateAdapter.
AbstractBooleanStateAdapter(BooleanState state)
          Creates a new AbstractBooleanStateAdapter.
AbstractBooleanStateAdapter(java.lang.String name)
          Creates a new AbstractBooleanStateAdapter.
AbstractBooleanStateAdapter(java.lang.String name, BooleanState state)
          Creates a new AbstractBooleanStateAdapter.
 
Method Summary
protected  void addTarget(java.lang.Object target)
          Adds a target object to the adapter with normal state change logic.
protected  void addTarget(java.lang.Object target, boolean invert)
          Adds a target object to the adapter.
protected  void addTargetInverse(java.lang.Object target)
          Adds a target object to the adapter with inverse state change logic.
 void dispose()
          Disposes the component.
 BooleanState getBooleanState()
           
 java.lang.String getName()
          Return the name of the BooleanStateAdapter.
protected  void removeTarget(java.lang.Object target)
          Removes a previously added taregt object from this adapter.
protected  void setAdaptedValue(boolean value)
          Adapts the state value given.
protected abstract  void setAdaptedValue(java.lang.Object target, boolean value)
          Sets the adapted value for the given target object (that was added before to this adapter).
 void setBooleanState(BooleanState state)
          Sets (or resets if state==null) the state this adapter acts on.
 void setName(java.lang.String name)
          Set the name of the BooleanStateAdapter.
 void updateAdaptedValue()
          Forces an update of the current state value to the adapted objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBooleanStateAdapter

public AbstractBooleanStateAdapter()
Creates a new AbstractBooleanStateAdapter.


AbstractBooleanStateAdapter

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

Parameters:
name - the name to set

AbstractBooleanStateAdapter

public AbstractBooleanStateAdapter(BooleanState state)
Creates a new AbstractBooleanStateAdapter.

Parameters:
state - the state to set

AbstractBooleanStateAdapter

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

Parameters:
name - the name to set
state - the state to set
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
Throws:
DisposeException - if there was one or more errors while disposing the component.
See Also:
Disposable.dispose()

getName

public java.lang.String getName()
Description copied from interface: BooleanStateAdapter
Return the name of the BooleanStateAdapter.

Specified by:
getName in interface BooleanStateAdapter
Returns:
the name of the BooleanStateAdapter (never null)
See Also:
BooleanStateAdapter.getName()

setName

public void setName(java.lang.String name)
Description copied from interface: BooleanStateAdapter
Set the name of the BooleanStateAdapter.

Specified by:
setName in interface BooleanStateAdapter
Parameters:
name - the name of the BooleanStateAdapter (not null)
See Also:
BooleanStateAdapter.setName(java.lang.String)

getBooleanState

public BooleanState getBooleanState()
Specified by:
getBooleanState in interface BooleanStateAdapter
Returns:
the State to adapt, or null, if currently no state is adapted.
See Also:
BooleanStateAdapter.getBooleanState()

setBooleanState

public void setBooleanState(BooleanState state)
Description copied from interface: BooleanStateAdapter
Sets (or resets if state==null) the state this adapter acts on.

Specified by:
setBooleanState in interface BooleanStateAdapter
Parameters:
state - the state we act upon or null
See Also:
BooleanStateAdapter.setBooleanState(com.sdm.quasar.client.core.states.BooleanState)

setAdaptedValue

protected void setAdaptedValue(boolean value)
Adapts the state value given.

Parameters:
value - the BooleanState's value to adapt.

setAdaptedValue

protected abstract void setAdaptedValue(java.lang.Object target,
                                        boolean value)
Sets the adapted value for the given target object (that was added before to this adapter).

Parameters:
target - the target to adapt the value to
value - the value to adapt

updateAdaptedValue

public void updateAdaptedValue()
Forces an update of the current state value to the adapted objects.


addTarget

protected void addTarget(java.lang.Object target)
Adds a target object to the adapter with normal state change logic. What happens to the target is depending on the concrete implementation.

Parameters:
target - the target we should act on when state changes
Throws:
java.lang.IllegalArgumentException - if the target is null or if the target was already added before

addTargetInverse

protected void addTargetInverse(java.lang.Object target)
Adds a target object to the adapter with inverse state change logic. What happens to the target is depending on the concrete implementation.

Parameters:
target - the target we should act on when state changes
Throws:
java.lang.IllegalArgumentException - if the target is null or if the target was already added before

addTarget

protected void addTarget(java.lang.Object target,
                         boolean invert)
Adds a target object to the adapter. What happens to the target is depending on the concrete implementation.

Parameters:
target - the target we should act on when state changes
invert - if true, the state value will be inverted before adapting
Throws:
java.lang.IllegalArgumentException - if the target is null or if the target was already added before

removeTarget

protected void removeTarget(java.lang.Object target)
Removes a previously added taregt object from this adapter.

Parameters:
target - the target object to remove.