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
-
ValueAdaptor(ValueModel)
- Construct an instance with a reference model.
-
addObserver(Observer)
- Adds an observer to the observer list.
-
deleteObserver(Observer)
- Deletes an observer from the observer list.
-
deleteObservers()
- Deletes observers from the observer list.
-
getModel()
- Return the reference model that we are adapting
on.
-
getValue()
- Called to get the current value this object represents.
-
setModel(ValueModel)
- Set the reference model.
-
setValue(Object)
- Called to set the current value, which must
be cast to an Object.
-
update(Observable, Object)
- The reference model changed, so propagate the
update.
-
valueFromModel(Object)
- The value coming from my model can be modified.
-
valueToModel(Object)
- The value to set to my model can be modified.
ValueAdaptor
public ValueAdaptor(ValueModel aModel)
- Construct an instance with a reference model.
- Parameters:
- aModel - a reference model
getModel
public ValueModel getModel()
- Return the reference model that we are adapting
on. Nothing special.
- Returns:
- the reference model
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
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
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
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
deleteObservers
public synchronized void deleteObservers()
- Deletes observers from the observer list.
- Overrides:
- deleteObservers in class Observable
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
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
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
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