|
Oracle JEWT API Reference Release 4.2.24.0.0 B12199-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
public int getColumnCount()
public int getRowCount()
public java.lang.Object getData(int columnIndex, int rowIndex)
columnIndex
- the column index of the cellrowIndex
- the row index of the cellpublic void setData(int columnIndex, int rowIndex, java.lang.Object data)
columnIndex
- the column index of the cellrowIndex
- the row index of the celldata
- the new datapublic void addModelListener(TwoDModelListener listener)
listener
- new listenerpublic void removeModelListener(TwoDModelListener listener)
listener
- new listener
|
Oracle JEWT 4.2.24 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |