borland Packages  Class Hierarchy  jbcl.model Package  Index 

WritableVectorModel interface

borland.jbcl.model.VectorModel
   +----borland.jbcl.model.WritableVectorModel

About the WritableVectorModel interface

Properties  Methods  Event Listeners

Implemented by VectorDataSetManager, BasicVectorContainer

Provides the methods required for a read-write vector model object; that is, a model that holds data in a one-dimensional array such as a list. WritableVectorModel extends the VectorModel interface and adds the methods needed to add, change, and delete items in the list.

Generally, you extend a class that implements this interface, such as BasicVectorContainer. You can, however, implement the interface directly if you are creating an entirely new component.

If you need read access only, you can choose to implement the VectorModel interface instead.

The setting of variableSize determines whether data items can be added or deleted from the vector. To add an item, call one of the addItem() methods. To remove items, call remove() or removeAll(). Set the data object at a specified position in the vector with the set() method. The touched() method notifies all listeners that a data item has been manipulated.


WritableVectorModel properties

*Read-only properties **Write-only properties

Properties defined in this interface

Properties implemented in borland.jbcl.model.VectorModel

WritableVectorModel methods

Methods defined in this interface

Methods implemented in borland.jbcl.model.VectorModel

WritableVectorModel event listeners


WritableVectorModel properties

variableSize

 public boolean isVariableSize()
Determines whether the vector size can vary, and therefore, whether data items can be added or removed. If variableSize is true, data items can be added and deleted; if it is false, the size of the vector cannot vary and data items can't be added or removed.

WritableVectorModel methods

addItem(int, java.lang.Object)

  public void addItem(int aheadOf, java.lang.Object data)
Adds a new data object to the vector. The data object is added above the specified location.

Parameters:

aheadOf
A zero-based index value that indicates the location of the data item in the vector. The new data object is inserted before this location. For example, if the value of aheadOf is 4, the new data object receives an index value of 4, and it becomes the fifth data object in the vector. The data item represented by aheadOf now has an index value of 5 and it is the sixth data object in the vector.

addItem(java.lang.Object)

  public void addItem(java.lang.Object data)
Appends a new data object at the end of the vector.

Parameters:

data
The new data object.

canSet(int, boolean)

  public boolean canSet(int index, boolean startEditing)
Determines whether the data object at the specified location in the vector can be modified. If canSet is true, the data object can be modified.

Parameters:

index
A zero-based index that specifies the location of the data item in the vector.
startEditing
If startEditing is true, the data object can be modified; it is false, the data object can't be changed.

enableModelEvents(boolean)

  public void enableModelEvents(boolean enable)
Determines whether the broadcasting of vector-model events is enabled or disabled.

Parameters:

enable
If enable is true, the broadcasting of vector-model events is enabled and a STRUCTURE_CHANGED event is fired to all vector-model listeners. If it is false, vector-model events are not broadcast.

remove(int)

  public void remove(int index)
Removes a data object from the vector at the specified location.

Parameters:

index
A zero-based index that specifies the location of the data object in the vector.

removeAll()

  public void removeAll()
Removes all data objects from vector.

set(int, java.lang.Object)

  public void set(int index, java.lang.Object data)
Sets the data object at the specified location.

Parameters:

index
A zero-based index that specifies the location of the data object in the vector.
data
The new data object.

touched(int)

  public void touched(int index)
Notifies all vector-model listeners that the data object at the specified location was manipulated.

Parameters:

index
A zero-based index that specifies the location of the data object in the vector.

WritableVectorModel event listeners

This interface is a source for the following event sets. For information on the JBCL event sets, see Events in JBCL.

model

 public void addModelListener(borland.jbcl.model.VectorModelListener listener)
 public void removeModelListener(borland.jbcl.model.VectorModelListener listener)