jbcl.model Package
com.borland.jbcl.model.VectorModel +----com.borland.jbcl.model.WritableVectorModel
Properties Methods Event Listeners
Implemented by BasicVectorContainer, VectorDataSetManager
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.
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.
public void addItem(int aheadOf, Object data)Adds a new data object to the vector. The data object is added above the specified location.
Parameters:
aheadOf
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.
public void addItem(Object data)Appends a new data object at the end of the vector.
Parameters:
data
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
startEditing
startEditing
is true, the data object can be modified; it is false
, the data object can't be changed.
public void enableModelEvents(boolean enable)Determines whether the broadcasting of vector-model events is enabled or disabled.
Parameters:
enable
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.
public void remove(int index)Removes a data object from the vector at the specified location.
Parameters:
index
public void removeAll()Removes all data objects from vector.
public void set(int index, Object data)Sets the data object at the specified location.
Parameters:
index
data
public void touched(int index)Notifies all vector-model listeners that the data object at the specified location was manipulated.
Parameters:
index
public void addModelListener(VectorModelListener listener) public void removeModelListener(VectorModelListener listener)