Oracle JEWT API Reference
Release 4.2.24.0.0
B12199-01

oracle.bali.ewt.model
Interface TwoDModel

All Known Implementing Classes:
AbstractTwoDModel, NullTwoDModel

public interface TwoDModel

A TwoDModel is an interface used for getting and setting data in a two dimension case.

TwoDModel contains methods for getting the number of columns and rows, getting and setting the data for each cell, and adding and removing TwoDModelListeners. A TwoDModelListeners listens for the addition and removal of columns and rows as well as the invalidation of columns, rows, and cells.

The model package provides one concrete TwoDModel class. ArrayTwoDModel takes a row and column count at creation time and allows each cell to be set via the setData method. Columns and rows can also be added at run time.

Clients who implement their own TwoDModel must send the proper TwoDModelEvent to all registered listeners.

When columns are added to the data source, clients must send a TwoDModelEvent.COLUMNS_ADDED event. The column start index is the index where the first column is being added and column count is the number of columns that are being added.

When columns are removed from the data source, clients must send a TwoDModelEvent.COLUMNS_REMOVED event. The column start index is the index of the first column being removed and column count is the number of columns that are being removed.

When columns of data have changed in the data source, clients must send a TwoDModelEvent.COLUMNS_INVALID event. The column start index is the index of the first column that is changed and column count is the number of columns that have changed.

When rows are added to the data source, clients must send a TwoDModelEvent.ROWS_ADDED event. The row start index is the index where the first row is being added and row count is the number of rows that are being added.

When rows are removed from the data source, clients must send a TwoDModelEvent.ROWS_REMOVED event. The row start index is the index of the first row being removed and row count is the number of rows that are being removed.

When rows of data have changed in the data source, clients must send a TwoDModelEvent.ROWS_INVALID event. The row start index is the index of the first row that is changed and row count is the number of rows that have changed.

When certain cells have changed in the data source, clients must send a TwoDModelEvent.CELLS_INVALID event. The column start index is the index of the first column that has changed, column count is the number of columns that have changed, row start index is the index of the first row that has changed, and row count is the number of rows have have changed. Clients should sent the TwoDModelEvent.CELLS_INVALID in response to a setData() call because the data in that cell has become invalid.

See Also:
AbstractTwoDModel, ArrayTwoDModel, TwoDModelListener, TwoDModelEvent

Method Summary
 void addModelListener(TwoDModelListener listener)
          Add a TwoDModelListener to this TwoDModel.
 int getColumnCount()
          Get the number of columns.
 java.lang.Object getData(int columnIndex, int rowIndex)
          Return the data of the cell.
 int getRowCount()
          Get the number of rows.
 void removeModelListener(TwoDModelListener listener)
          Remove a TwoDModelListener from this TwoDModel.
 void setData(int columnIndex, int rowIndex, java.lang.Object data)
          Set the cell data to the new value.
 

Method Detail

getColumnCount

public int getColumnCount()
Get the number of columns.

getRowCount

public int getRowCount()
Get the number of rows.

getData

public java.lang.Object getData(int columnIndex,
                                int rowIndex)
Return the data of the cell.

Parameters:
columnIndex - the column index of the cell
rowIndex - the row index of the cell

setData

public void setData(int columnIndex,
                    int rowIndex,
                    java.lang.Object data)
Set the cell data to the new value.

Parameters:
columnIndex - the column index of the cell
rowIndex - the row index of the cell
data - the new data

addModelListener

public void addModelListener(TwoDModelListener listener)
Add a TwoDModelListener to this TwoDModel.

Parameters:
listener - new listener

removeModelListener

public void removeModelListener(TwoDModelListener listener)
Remove a TwoDModelListener from this TwoDModel.

Parameters:
listener - new listener

Oracle JEWT 4.2.24

Copyright © [xxxx],2003, Oracle. All Rights Reserved.