Class com.bdnm.mvc.ValueAdaptor
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bdnm.mvc.ValueAdaptor

java.lang.Object
   |
   +----java.util.Observable
           |
           +----com.bdnm.mvc.ValueModel
                   |
                   +----com.bdnm.mvc.ValueAdaptor

public class ValueAdaptor
extends ValueModel
implements Observer

Constructor Index

 o ValueAdaptor(ValueModel)
Construct an instance with a reference model.

Method Index

 o addObserver(Observer)
Adds an observer to the observer list.
 o deleteObserver(Observer)
Deletes an observer from the observer list.
 o deleteObservers()
Deletes observers from the observer list.
 o getModel()
Return the reference model that we are adapting on.
 o getValue()
Called to get the current value this object represents.
 o setModel(ValueModel)
Set the reference model.
 o setValue(Object)
Called to set the current value, which must be cast to an Object.
 o update(Observable, Object)
The reference model changed, so propagate the update.
 o valueFromModel(Object)
The value coming from my model can be modified.
 o valueToModel(Object)
The value to set to my model can be modified.

Constructors

 o ValueAdaptor
  public ValueAdaptor(ValueModel aModel)
Construct an instance with a reference model.
Parameters:
aModel - a reference model

Methods

 o getModel
  public ValueModel getModel()
Return the reference model that we are adapting on. Nothing special.
Returns:
the reference model
 o setModel
  public synchronized void setModel(ValueModel newModel)
Set the reference model. Make sure we establish the appropriate dependencies, if appropriate.
Parameters:
newModel - the new model to set
 o update
  public void update(Observable o,
                     Object arg)
The reference model changed, so propagate the update.
Parameters:
o - should be the list of observers
arg - the argument being notified
 o addObserver
  public synchronized void addObserver(Observer o)
Adds an observer to the observer list.
Parameters:
o - the observer to be added
Overrides:
addObserver in class Observable
 o deleteObserver
  public synchronized void deleteObserver(Observer o)
Deletes an observer from the observer list.
Parameters:
o - the observer to be deleted
Overrides:
deleteObserver in class Observable
 o deleteObservers
  public synchronized void deleteObservers()
Deletes observers from the observer list.
Overrides:
deleteObservers in class Observable
 o getValue
  public Object getValue()
Called to get the current value this object represents. This will be my model's value modified by one of my subclass' valueFromModel() method. Necessary to implement Valuable.
Returns:
the calculated value, which is cast to an Object
Overrides:
getValue in class ValueModel
 o setValue
  public void setValue(Object newValue)
Called to set the current value, which must be cast to an Object. I will set my model's value, but first modifying it by one of my subclass' valueToModel() method. Necessary to implement Valuable.
Parameters:
newValue - the new value to set
Overrides:
setValue in class ValueModel
 o valueFromModel
  protected abstract Object valueFromModel(Object aValue)
The value coming from my model can be modified. Return the modified value that will be forwarded on.
Parameters:
aValue - the value of my model
Returns:
the value which I represent
 o valueToModel
  protected abstract Object valueToModel(Object aValue)
The value to set to my model can be modified. Return the modified value that my model will be set to.
Parameters:
aValue - the value to I should represent
Returns:
the value which my model should be set to

All Packages  Class Hierarchy  This Package  Previous  Next  Index