|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--CoffeeTable.Grid.GridData
GridData is a class holds the data for the GridPanel. This class implements the GridDataInterface, which is an abstract interface for storing the data for the Grid's cells, and the Row and Column headers. An instance of this class is stored in the GridPanel and it's methods are called to get or set the data, as well as to resize the GridData as and when needed. The Grid's data can be accessed as Objects or as Strings (uses toString() to get the String representation). The default implementation of the GridPanel and particularly the drawCell() method, always accesses and stores the GridData as Strings using the get/setCellText(), get/setRowHeaderText() and get/setColHeaderText() methods. If an implementation stores the data as any other objects such as Integers, Images etc., then the get/setCellData(), get/setRowHeaderData() and get/setColHeaderData() methods can be used. In addition, the comapre() method may also need to be overridden to deal with non-string data types.
| Constructor Summary | |
GridData()
Constructs a new empty GridData Object. |
|
GridData(int numRows,
int numCols)
Constructs a new GridData Object. |
|
GridData(int numRows,
int numCols,
boolean needRowHeaders,
boolean needColHeaders)
Constructs a new GridData Object. |
|
| Method Summary | |
int |
compare(java.lang.Object aData,
java.lang.Object bData,
int col)
The default compare method used by GridPanel.sortRows(). |
void |
deleteCols(int atCol,
int count)
Delete a specified number of columns from a specified position. |
void |
deleteRows(int atRow,
int count)
Delete a specified number of rows from a specified position. |
protected void |
finalize()
Remove all the elements in the internal lists. |
java.lang.Object |
getCellData(int col,
int row)
Return the data for a cell. |
java.lang.String |
getCellText(int col,
int row)
Return the text for a cell. |
java.lang.Object |
getColHeaderData(int col)
Return the data for a column header. |
java.lang.String |
getColHeaderText(int col)
Return the text for a column header. |
int |
getNumCols()
Return the number columns in this object. |
int |
getNumRows()
Return the number rows in this object. |
java.util.Vector |
getRowData(int row)
Return the data for all the cells in a row. |
java.lang.Object |
getRowHeaderData(int row)
Return the data for a row header. |
java.lang.String |
getRowHeaderText(int row)
Return the text for a row header. |
void |
insertCols(int atCol,
int count)
Insert a specified number of columns at a specified position. |
void |
insertRows(int atRow,
int count)
Insert a specified number of rows at a specified position. |
void |
setCellData(int col,
int row,
java.lang.Object cellData)
Sets the data for a cell. |
void |
setCellText(int col,
int row,
java.lang.String cellText)
Sets the text data for a cell. |
void |
setColHeaderData(int col,
java.lang.Object colHeaderData)
Sets the data for a column header. |
void |
setColHeaderText(int col,
java.lang.String colHeaderText)
Sets the text data for a column header. |
void |
setNumCols(int numCols)
Adjusts the number columns in this object. |
void |
setNumRows(int numRows)
Adjusts the number rows in this object. |
void |
setRowData(int row,
java.util.Vector rowData)
Sets the data for all the cells in a row. |
void |
setRowHeaderData(int row,
java.lang.Object rowHeaderData)
Sets the data for a row header. |
void |
setRowHeaderText(int row,
java.lang.String rowHeaderText)
Sets the text data for a row header. |
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public GridData()
public GridData(int numRows, int numCols)
numRows - the number of rowsnumCols - the number of columnspublic GridData(int numRows, int numCols, boolean needRowHeaders, boolean needColHeaders)
numRows - the number of rowsnumCols - the number of columnsneedRowHeaders - whether or not to allocate data for row headersneedColHeaders - whether or not to allocate data for column headers| Method Detail |
protected void finalize()
public void setNumRows(int numRows)
numRows - the number of rowsGridPanel.setNumRows(int)public int getNumRows()
public void setNumCols(int numCols)
numRows - the number of rowsGridPanel.setNumCols(int)public int getNumCols()
public void insertRows(int atRow, int count)
atRow - the index at which new rows will be insertedcount - the number of rows to be insertedGridPanel.insertRows(int, int)public void deleteRows(int atRow, int count)
atRow - the index from which new rows will be deletedcount - the number of rows to be deletedGridPanel.deleteRows(int, int)public void insertCols(int atCol, int count)
atCol - the index at which new columns will be insertedcount - the number of columns to be insertedGridPanel.insertCols(int, int)public void deleteCols(int atCol, int count)
atCol - the index from which new columns will be deletedcount - the number of columns to be deletedGridPanel.deleteCols(int, int)public java.lang.String getCellText(int col, int row)
col - the columnrow - the rowGridPanel.getCellText(int, int),
getCellData(int, int)public java.lang.Object getCellData(int col, int row)
col - the columnrow - the rowpublic java.lang.String getRowHeaderText(int row)
row - the rowGridPanel.getRowHeaderText(int),
getRowHeaderData(int)public java.lang.Object getRowHeaderData(int row)
row - the rowpublic java.lang.String getColHeaderText(int col)
col - the columnGridPanel.getColHeaderText(int),
getColHeaderData(int)public java.lang.Object getColHeaderData(int col)
col - the columnpublic void setCellText(int col, int row, java.lang.String cellText)
col - the columnrow - the rowcellText - the text data for the cellGridPanel.setCellText(int, int, java.lang.String, boolean),
setCellData(int, int, java.lang.Object)public void setCellData(int col, int row, java.lang.Object cellData)
col - the columnrow - the rowcellData - a reference to the data for a cellpublic void setRowHeaderText(int row, java.lang.String rowHeaderText)
row - the rowrowHeaderText - the text data for the row headerGridPanel.setRowHeaderText(int, java.lang.String, boolean),
setRowHeaderData(int, java.lang.Object)public void setRowHeaderData(int row, java.lang.Object rowHeaderData)
row - the rowrowHeaderData - a reference to the data for a row headerpublic void setColHeaderText(int col, java.lang.String colHeaderText)
col - the columncolHeaderText - the text data for the column headerGridPanel.setColHeaderText(int, java.lang.String, boolean),
setColHeaderData(int, java.lang.Object)public void setColHeaderData(int col, java.lang.Object colHeaderData)
col - the columncolHeaderData - a reference to the data for a row headerpublic java.util.Vector getRowData(int row)
row - the rowpublic void setRowData(int row, java.util.Vector rowData)
row - the rowrowData - a Vector containing references to the data for all the cells in a rowpublic int compare(java.lang.Object aData, java.lang.Object bData, int col)
aData - the first data objectbData - the second data objectcol - the column whose data objects are being compared for the sort
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||