Skip navigation links


com.bea.p13n.model
Class Model.ChangeEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.bea.p13n.model.Model.ChangeEvent

All Implemented Interfaces
Serializable
Enclosing class:
Model

public static class Model.ChangeEvent
extends EventObject

A model change event.

getModel() will return the model that was changed. getSource() will generally be either the Model (if the listener was added to the model) or the DocumentModel containing the model that changed (if the listener was added to the DocumentModel.

If getType() is Type.PROPERTY_CHANGE, then getPropertyName() will return the name of the property that changed, and getOldValue() and getNewValue() will return the appropriate values.

If getType() is Type.CHILD_CHANGE, then getPropertyName() will return null; if the child was added, getNewValue() will return the added child; if the child was removed, getOldValue() will return the removed child.

If getType() is Type.PARENT_CHANGE, then getNewValue() will be the new parent, and getOldValue() will be the old parent.

If getType() is Type.ROOT_MODEL_CHANGE, then getPropertyName() will return null, getModel() and getNewValue() will return the new root model, and getOldValue() will return the previous root model.

See Also
Serialized Form

Nested Class Summary
static class Model.ChangeEvent.Type
          Enumeration of the possible types of changes.

 

Field Summary

 

Fields inherited from class java.util.EventObject
source

 

Constructor Summary
Model.ChangeEvent(Object src, Model oldRoot, Model newRoot)
          Construct a root model change event.
Model.ChangeEvent(Object src, Model parent, Model child, boolean added)
          Construct a model child added/removed change event.
Model.ChangeEvent(Object src, Model model, Model oldParent, Model newParent)
          Construct a model parent change event.
Model.ChangeEvent(Object src, Model model, String propName, Object oldVal, Object newVal)
          Construct a model property change event.

 

Method Summary
 Model getModel()
          Get the model that changed.
 Object getNewValue()
          Get the new value or the added child or the new parent.
 Object getOldValue()
          Get the old value or the removed child or the previous parent.
 String getPropertyName()
           
 Model.ChangeEvent.Type getType()
          Get the type.
 String toString()
           

 

Methods inherited from class java.util.EventObject
getSource

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

Model.ChangeEvent

public Model.ChangeEvent(Object src,
                         Model model,
                         String propName,
                         Object oldVal,
                         Object newVal)
Construct a model property change event.
Parameters
src - the orginator of the change (cannot be null).
model - the model that changed (cannot be null).
propName - the property that changed (cannot be null).
oldVal - the old value (null is valid).
newVal - the new value (null is valid).

Model.ChangeEvent

public Model.ChangeEvent(Object src,
                         Model model,
                         Model oldParent,
                         Model newParent)
Construct a model parent change event.
Parameters
src - the orginator of the change (cannot be null).
model - the model that changed (cannot be null).
propName - the property that changed (cannot be null).
oldParent - the old value (null is valid).
newParent - the new value (null is valid).

Model.ChangeEvent

public Model.ChangeEvent(Object src,
                         Model parent,
                         Model child,
                         boolean added)
Construct a model child added/removed change event.
Parameters
src - the orginator of the change (cannot be null).
parent - the parent model that changed (cannot be null).
child - the child model (cannot be null).
added - true if the child was added, false if removed.

Model.ChangeEvent

public Model.ChangeEvent(Object src,
                         Model oldRoot,
                         Model newRoot)
Construct a root model change event.
Parameters
src - the DocumentModel originator (cannot be null).
oldRoot - the previous root model (null is valid).
newRoot - the new root model (null is valid).

Method Detail

getModel

public Model getModel()
Get the model that changed.

getType

public Model.ChangeEvent.Type getType()
Get the type.

getPropertyName

public String getPropertyName()

getOldValue

public Object getOldValue()
Get the old value or the removed child or the previous parent.

getNewValue

public Object getNewValue()
Get the new value or the added child or the new parent.

toString

public String toString()
Overrides:
toString in class EventObject

Skip navigation links


Copyright © 2010, Oracle. All rights reserved.