jbcl.model Package
java.lang.Object +----com.borland.jbcl.model.AbstractVectorModel
Constructors Properties Methods Event Listeners
Implements VectorModel, Serializable
AbstractVectorModel
is an abstract implementation of the VectorModel
interface. It provides the event management for a VectorModel
implementor.
To create a fully functional read-only VectorModel
, subclass AbstractVectorModel
, and implement these methods:
To create a fully functional read/write VectorModel
(WritableVectorModel
), be sure to add "implements WritableVectorModel" to your class definition, and implement the following methods:
The find(Object data) method of AbstractVectorModel
always returns -1; therefore, it cannot find items in the vector. To be able to locate items in this vector, override this method and search for the passed data object in your vector data structure.
public AbstractVectorModel()An empty constructor for this abstract class.
public boolean isVariableSize()Returns true, which means that items can be added and removed to the model. This is usually desirable if the model is being used as a
WritableVectorModel
. To prevent items from being added or removed, override this method and have it return false.
public boolean canSet(int index, boolean startEdit)Returns true, which means that the item specified with the index parameter can be edited. This is usually desirable if the model is being used as a
WritableVectorModel
. To prevent items from being edited, override this method and have it return false.
public void enableModelEvents(boolean enable)Determines whether events are enabled for this vector model class. If the
enable
parameter is true, events are enabled and a structure-changed event is fired. If the enable
parameter is false, events are not enabled.
protected void fireContentChanged()This event fires when the contents of the entire vector has changed, but the total count of items remains unchanged.
protected void fireItemAdded(int index)This event fires when a new item is added to the vector.
protected void fireItemChanged(int index)This event fires when an item in the vector has changed.
protected void fireItemRemoved(int index)This event fires when a item is removed from the vector.
protected void fireItemTouched(int index)This event fires when an item in the vector has been touched.
protected void fireStructureChanged()This event fires when the entire vector has changed, including change in the number of items in the vector.
public void touched(int index)Calls
fireItemTouched()
, notifying listeners that the item specified with the index
parameter has been touched.
public void addModelListener(VectorModelListener listener) public void removeModelListener(VectorModelListener listener)