org.scopemvc.view.util
Class ActiveBoundModel

java.lang.Object
  |
  +--org.scopemvc.view.util.BoundModel
        |
        +--org.scopemvc.view.util.ActiveBoundModel
All Implemented Interfaces:
ModelChangeListener
Direct Known Subclasses:
SwingBoundModel

public class ActiveBoundModel
extends BoundModel
implements ModelChangeListener

A BoundModel that handles ModelChangeEvents and provides full two-way data-binding between a View and its bound model property. The parent View needs to implement the ModelBindable interface to provide a generic interface used by this delegate. An ActiveBoundModel registers itself as a ModelChangeListener to the bound model object so that it can update its parent View.

Version:
$Revision: 1.12 $ $Date: 2002/09/13 17:11:29 $
Author:
Steve Meyfroidt
See Also:
SwingBoundModel

Field Summary
protected  PropertyManager manager
          PropertyManager for the bound model.
protected  ModelBindable view
          The ModelBindable View that delegates bound Model handling to this helper.
 
Fields inherited from class org.scopemvc.view.util.BoundModel
boundModel, selector
 
Constructor Summary
ActiveBoundModel(ModelBindable inView)
          Constructor for the ActiveBoundModel object
 
Method Summary
 java.lang.Class getPropertyClass()
          Gets the class of the property in the bound model
 PropertyManager getPropertyManager()
          Gets the property manager
 boolean getPropertyReadOnly()
          Returns true if the property in the bound model is read only
 java.lang.Object getPropertyValue()
          Gets the value of the property in the bound model
 void modelChanged(ModelChangeEvent inEvent)
          Update the parent View in response to the passed ModelChangeEvent, if the event reports that the property we are bound to has changed.
 void setBoundModel(java.lang.Object inModel)
          Sets the bound model
 void setSelector(Selector inSelector)
          Sets the selector
 void updateFromModel(int inEventType)
          Calls parent View's {org.scopemvc.view.util.ModelBindable#validationSuccess} to clear any previous validation failure.
 void updateModel()
          Put the current View contents into the bound model property.
 
Methods inherited from class org.scopemvc.view.util.BoundModel
getBoundModel, getSelector, setSelectorString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected ModelBindable view
The ModelBindable View that delegates bound Model handling to this helper.


manager

protected PropertyManager manager
PropertyManager for the bound model.

Constructor Detail

ActiveBoundModel

public ActiveBoundModel(ModelBindable inView)
Constructor for the ActiveBoundModel object

Parameters:
inView - The view to bind to the model
Method Detail

getPropertyManager

public PropertyManager getPropertyManager()
Gets the property manager

Returns:
The propertyManager value

getPropertyReadOnly

public boolean getPropertyReadOnly()
Returns true if the property in the bound model is read only

Returns:
true if the property in the bound model is read only

getPropertyValue

public java.lang.Object getPropertyValue()
Gets the value of the property in the bound model

Returns:
The value of the property in the bound model

getPropertyClass

public java.lang.Class getPropertyClass()
Gets the class of the property in the bound model

Returns:
The class of the property in the bound model

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Sets the bound model

Overrides:
setBoundModel in class BoundModel
Parameters:
inModel - The new boundModel value

setSelector

public final void setSelector(Selector inSelector)
Sets the selector

Overrides:
setSelector in class BoundModel
Parameters:
inSelector - The new selector value

modelChanged

public final void modelChanged(ModelChangeEvent inEvent)
Update the parent View in response to the passed ModelChangeEvent, if the event reports that the property we are bound to has changed.

Specified by:
modelChanged in interface ModelChangeListener
Parameters:
inEvent - The event describing the change in the model

updateModel

public void updateModel()
Put the current View contents into the bound model property.
Errors in getting the UI's new value into the model property are handled by calling back into the parent View's {org.scopemvc.view.util.ModelBindable#validationFailed} with the Exception.
On no errors, call the parent's {org.scopemvc.view.util.ModelBindable#validationSuccess}


updateFromModel

public void updateFromModel(int inEventType)
Calls parent View's {org.scopemvc.view.util.ModelBindable#validationSuccess} to clear any previous validation failure.

Parameters:
inEventType - The type of the change event, one of the ModelChangeTypes values


Copyright © 2000-2002 The Scope Team. All Rights Reserved.