jbcl.model Package
com.borland.jbcl.model.MatrixModel +----com.borland.jbcl.model.WritableMatrixModel
Properties Methods Event Listeners
Implemented by GridControl, BasicMatrixContainer, MatrixDataSetManager
Provides the methods required for a read-write matrix model object; that is,
a model that holds data in a two-dimensional array such as a grid. WritableMatrixModel
extends the MatrixModel
interface and
adds the methods needed to add, change, and delete items in the matrix.
Generally, you extend a class that implements this interface, such as
BasicMatrixContainer
. 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 MatrixModel
interface instead.
To add one or more columns to the matrix, call one of the addColumn()
methods. To add one or more rows, call one of the addRow()
methods. You can delete columns and rows with the removeColumn()
, removeColumns()
, removeRow()
, and removeRows()
methods.
Whether columns can be added or deleted depends on the setting of the variableColumns
property. Whether rows can be added or deleted depends on the setting of the variableRows
property.
public boolean isVariableColumns()Determines whether columns can be add to or removed from the matrix. If
variableColumns
is true, columns can be added or removed.
public boolean isVariableRows()Determines whether rows can be add to or removed from the matrix. If
variableRows
is true, rows can be added or removed.
public void addColumn()Appends a new column after the last column in the matrix.
public void addColumn(int aheadOf)Inserts a new column into the matrix before the specified column.
Parameters:
aheadOf
aheadOf
is 4, the new inserted column receives a value of 4 and becomes the fifth column in the matrix. The column represented by aheadOf
now has an index value of 5 and is the sixth column in the matrix.
public void addRow()Appends a new row after the last row.
public void addRow(int aheadOf)Inserts a new row before the specified row.
Parameters:
aheadOf
aheadOf
is 2, the new inserted row receives a value of 2 and becomes the third row in the matrix. The row represented by aheadOf
now has an index value of 3 and is the fourth row in the matrix.
public boolean canSet(int row, int column, boolean startEdit)Determines whether the data object at the specified row and column can be modified. If
canSet()
returns true, the data object can be changed.
Parameters:
row
column
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 matrix-model events is enabled or disabled.
Parameters:
enable
enable
is true, the broadcasting of matrix-model events is enabled and a STRUCTURE_CHANGED event is fired to all matrix-model listeners. If it is false, matrix-model events are not broadcast.
public void removeAllColumns()Removes all columns in the matrix.
public void removeAllRows()Removes all rows in the matrix .
public void removeColumn(int column)Removes the specified column from the matrix.
Parameters:
column
public void removeRow(int row)Removes the specified row from the matrix.
Parameters:
row
public void set(int row, int column, Object data)Sets the data object at the specified row and column location within the matrix.
Parameters:
row
column
public void touched(int row, int column)Notifies all matrix-model listeners that the data object at the specified row and column location was manipulated.
Parameters:
index
index
public void addModelListener(MatrixModelListener listener) public void removeModelListener(MatrixModelListener listener)