jbcl.model Package
java.lang.Object +----com.borland.jbcl.model.AbstractMatrixModel
Constructors Properties Methods Event Listeners
Implements MatrixModel, Serializable
AbstractMatrixModel
is an abstract implementation of the MatrixModel
interface. It provides the event management for a MatrixModel
implementor.
To create a fully functional read-only MatrixModel
, subclass AbstractMatrixModel
, and implement these methods:
To create a fully functional read/write MatrixModel
(WritableMatrixModel
), be sure to add "implements WritableMatrixModel" to your class definition, and implement the following methods:
The find(Object data) method of AbstractMatrixModel
always returns -1; therefore, it cannot find items in the matrix. To be able to locate items in this matrix, override this method and search for the passed data object in your matrix data structure.
public AbstractMatrixModel()An empty constructor for this abstract class.
public boolean isVariableColumns()Returns true, meaning that the matrix model permits the addition and removal of columns. To prevent columns from being added or removed, override this method and have it return false.
public boolean isVariableRows()Returns true, meaning that the matrix model permits the addition and removal of rows. To prevent rows from being added or removed, override this method and have it return false.
public boolean canSet(int row, int column, boolean startEdit)Returns true, which means that the item in the model specified with the
row
and column
paramters can be edited. This is usually desirable if the model is being used as a WritableMatrixModel
. To prevent the item from being edited, override this method and have it return false.
public void enableModelEvents(boolean enable)Determines whether events are enabled for this graph 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 fireColumnAdded(int column)This event fires when a new column is added to the matrix.
protected void fireColumnChanged(int column)This event fires when an entire column in the matrix has changed.
protected void fireColumnRemoved(int column)This event fires when a column is removed from the matrix.
protected void fireContentChanged()This event fires when the contents of the entire matrix have changed, but the row count and column count have not changed.
protected void fireItemChanged(int row, int column)This event fires when an item in the matrix has changed.
protected void fireItemTouched(int row, int column)This event fires when an item in the matrix has been touched.
protected void fireRowAdded(int row)This event fires when a new row is added to the matrix.
protected void fireRowChanged(int row)This event fires when an entire row in the matrix has changed.
protected void fireRowRemoved(int row)This event fires when a row is removed from the matrix.
protected void fireStructureChanged()This event fires when the entire matrix has changed,including changes to row and column counts.
fireStructureChanged()
notifies all listeners so they can analyze the matrix model again.
public void touched(int row, int column)Calls
fireItemTouched()
, notifying all listeners when the item specified with the row
and column
parameters is touched.
public void addModelListener(MatrixModelListener listener) public void removeModelListener(MatrixModelListener listener)