jbcl.model Package
java.lang.Object +----com.borland.jbcl.model.BasicMatrixContainer
Constructors Properties Methods Event Listeners
Implements MatrixModel, WritableMatrixModel, Serializable
This container provides read-write access to data items stored in a two-dimension array, such as that used by a grid. Use BasicMatrixContainer
in composing new model-view components that need a simple read-write model.
Use the items
property to access the data items in the matrix. The number of columns and the number of rows in the matrix are contained in the columnCount
and rowCount
properties, respectively. Whether the number of columns and rows in the matrix can change depends on the setting of the variableColumns
and variableRows
properties.
public BasicMatrixContainer()Constructs a
BasicMatrixContainer
object.
public BasicMatrixContainer(int rows, int columns)Constructs a
BasicMatrixContainer
object that uses the rows
and columns
parmeters to create a two-dimensional array (a matrix) to hold the data items.
public BasicMatrixContainer(Object[][] newItems)Constructs a
BasicMatrixContainer
object from the passed two-dimensional array of objects (a matrix) in the newItems
parameter. This constructor creates a copy of the passed matrix.
Parameters:
newItems
public int getColumnCount() public void setColumnCount(int columnCount)Used to obtain and set the number of columns in the matrix.
Parameters:
columnCount
public Object[][] getItems() public void setItems(Object[][] newItems)Used to obtain and set the data objects in the matrix. When
items
is set, a structure-changed MatrixModelEvent
is generated and sent to matrix-model listeners.
Parameters:
newItems
public int getRowCount() public void setRowCount(int rowCount)Used to retrieve and set the number of rows in the matrix. Setting
rowCount
generates a structure-changed MatrixModelEvent
is generated and set to matrix-model listeners.
Parameters:
rowCount
public boolean isVariableColumns() public void setVariableColumns(boolean variable)Determines whether the number of columns in the matrix can vary. If
variableColumns
is true, the columns can be added and removed from the matrix. If it is false, the number of columns cannot change.
Parameters:
variable
public boolean isVariableRows() public void setVariableRows(boolean variable)Determines whether the number of rows in the matrix can vary. If
variableRows
is true, the rows can be added and removed from the matrix. If it is false, the number of rows cannot change.
Parameters:
variable
protected void processModelEvent(MatrixModelEvent e)This method is called when a content-change or structure-change model event occurs in the matrix container. It sends a copy of the event object to registered listeners for matrix-model events.
public void addModelListener(MatrixModelListener listener) public void removeModelListener(MatrixModelListener listener)