jbcl.model Package
java.lang.Object +----java.util.EventObject +----com.borland.jb.util.DispatchableEvent +----com.borland.jbcl.model.ModelEvent +----com.borland.jbcl.model.VectorModelEvent
Variables Constructors Properties Methods
Implements Serializable
A VectorModelEvent
object is created whenever a model event occurs in a vector-model component. Model events occur when the data in the model changes or when the structure of the data storage changes (for example, when an item is edited or when an item is inserted in the middle of the list). The ID
property specifies whether the event object was created in response to a modelContentChanged
event or to a modelStructureChanged
event. Based upon this id
the dispatch()
method calls the appropriate method in the listening component.
VectorModelEvent
has several variables that distinguish further the type of event that occurred beyond content changes and structure changes. For example, they can be used to specify event occurrences such as an item being added to the vector or an item being removed.
public static final int CONTENT_CHANGED = ModelEvent.CONTENT_CHANGEDThe content of the vector changed.
public static final int ITEM_ADDED = STRUCTURE_CHANGED | 0x0010A data item was added to the vector changing the vector's structure.
public static final int ITEM_CHANGED = CONTENT_CHANGED | 0x0010A data item changed changing the contents.
public static final int ITEM_REMOVED = STRUCTURE_CHANGED | 0x0020A data item was removed from the vector changing the vector's structure.
public static final int ITEM_TOUCHED = CONTENT_CHANGED | 0x0020The data item was manipulated.
public static final int STRUCTURE_CHANGED = ModelEvent.STRUCTURE_CHANGEDThe vector structure changed.
public VectorModelEvent(VectorModel model, int change)Constructs a
VectorModelEvent
, setting the model
and change
properties to the respective arguments. Use this constructor for model events that do not need to specify a location (item) where the change has taken place.
Parameters:
model
change
VectorModelEvent
variables.
public VectorModelEvent(VectorModel model, int change, int location)Constructs a
VectorModelEvent
, setting the model
, change
, and location
properties of the event object
Parameters:
model
change
location
public int getChange()Specifies the kind of change in the model that has precipitated the event. Accepted values for the
change
property are listed under VectorModelEvent
variables.
public int getLocation()Specifies the index of the item that has changed, generating the event.
public VectorModel getModel()Returns the vector-model object in which the event occurred.
public void dispatch(java.util.EventListener listener)Checks the
ID
property and sends copies of the event object to registered model event listeners, calling the modelContentChanged()
or modelStructureChanged()
methods as appropriate.
Parameters:
listener
protected String paramString()Appends
VectorModelEvent
parameters to the superclass paramString()
method. The parameter string that is appended is:
",model=" + model + ",change=" + changeString + ",location=" + location
The value of changeString
is one of the constants displayed as a string. For example, the changeString
of ITEM_CHANGED is "ITEM_CHANGED".
Overrides: com.borland.jbcl.model.ModelEvent.paramString()