CoffeeTable.Grid
Interface GridDataInterface

All Known Implementing Classes:
GridData

public interface GridDataInterface

GridData is an abstract interface for a class used for storing the data for the Grid's cells, and the Row and Column headers. An instance of a class that implements this interface is stored in the GridPanel and it's methods are called to get or set the data, as well as to resize it's structure as and when needed. The GridData object implements this interface.

Version:
2.1.3 of October 1, 1999 Copyright © 1996-1999 3Magic

Method Summary
 int compare(java.lang.Object aData, java.lang.Object bData, int col)
          The default compare method used by 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.
 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.
 

Method Detail

setNumRows

public void setNumRows(int numRows)
Adjusts the number rows in this object. This method is called by the GridPanel's setNumRows() method when the Grid's number of rows change.
Parameters:
numRows - the number of rows
See Also:
GridPanel.setNumRows(int)

getNumRows

public int getNumRows()
Return the number rows in this object.
Returns:
the number of rows

setNumCols

public void setNumCols(int numCols)
Adjusts the number columns in this object. This method is called by the GridPanel's setNumCols() method when the Grid's number of columns change.
Parameters:
numRows - the number of rows
See Also:
GridPanel.setNumCols(int)

getNumCols

public int getNumCols()
Return the number columns in this object.
Returns:
the number of columns

insertRows

public void insertRows(int atRow,
                       int count)
Insert a specified number of rows at a specified position. This method is called by the GridPanel's insertRows() method. This method adjusts the Vectors that store the Grid's data and row header data.
Parameters:
atRow - the index at which new rows will be inserted
count - the number of rows to be inserted
See Also:
GridPanel.insertRows(int, int)

deleteRows

public void deleteRows(int atRow,
                       int count)
Delete a specified number of rows from a specified position. This method is called by the GridPanel's deleteRows() method. This method adjusts the Vectors that store the Grid's data and row header data.
Parameters:
atRow - the index from which new rows will be deleted
count - the number of rows to be deleted
See Also:
GridPanel.deleteRows(int, int)

insertCols

public void insertCols(int atCol,
                       int count)
Insert a specified number of columns at a specified position. This method is called by the GridPanel's insertCols() method. This method adjusts the Vectors that store the Grid's data and row header data.
Parameters:
atCol - the index at which new columns will be inserted
count - the number of columns to be inserted
See Also:
GridPanel.insertCols(int, int)

deleteCols

public void deleteCols(int atCol,
                       int count)
Delete a specified number of columns from a specified position. This method is called by the GridPanel's deleteCols() method. This method adjusts the Vectors that store the Grid's data and row header data.
Parameters:
atCol - the index from which new columns will be deleted
count - the number of columns to be deleted
See Also:
GridPanel.deleteCols(int, int)

getCellText

public java.lang.String getCellText(int col,
                                    int row)
Return the text for a cell. This method is called by the GridPanel's getCellText() method, and calls the getCellData() method and returns a string version of the data (using toString()).
Parameters:
col - the column
row - the row
Returns:
a string version of the cell data or an empty string (if null)
See Also:
GridPanel.getCellText(int, int)

getCellData

public java.lang.Object getCellData(int col,
                                    int row)
Return the data for a cell. The method returns a reference to the data object will need to be converted or displayed appropriately.
Parameters:
col - the column
row - the row
Returns:
the data for a cell

getRowHeaderText

public java.lang.String getRowHeaderText(int row)
Return the text for a row header. This method is called by the GridPanel's getRowHeaderText() method, and calls the getRowHeaderData() method and returns a string version of the data (using toString()).
Parameters:
row - the row
Returns:
a string version of the row header data or an empty string (if null)
See Also:
GridPanel.getRowHeaderText(int)

getRowHeaderData

public java.lang.Object getRowHeaderData(int row)
Return the data for a row header. The method returns a reference to the data object will need to be converted or displayed appropriately.
Parameters:
row - the row
Returns:
the data for a row header

getColHeaderText

public java.lang.String getColHeaderText(int col)
Return the text for a column header. This method is called by the GridPanel's getColHeaderText() method, and calls the getColHeaderData() method and returns a string version of the data (using toString()).
Parameters:
col - the column
Returns:
a string version of the column header data or an empty string (if null)
See Also:
GridPanel.getColHeaderText(int)

getColHeaderData

public java.lang.Object getColHeaderData(int col)
Return the data for a column header. The method returns a reference to the data object will need to be converted or displayed appropriately.
Parameters:
col - the column
Returns:
the data for a column header

setCellText

public void setCellText(int col,
                        int row,
                        java.lang.String cellText)
Sets the text data for a cell. This method is called by the GridPanel's setCellText() method, and sets the text data for the cell by calling the setCellData() method.
Parameters:
col - the column
row - the row
cellText - the text data for the cell
See Also:
GridPanel.setCellText(int, int, java.lang.String, boolean)

setCellData

public void setCellData(int col,
                        int row,
                        java.lang.Object cellData)
Sets the data for a cell. This method stores a reference to the data Object in the GridData structure.
Parameters:
col - the column
row - the row
cellData - a reference to the data for a cell

setRowHeaderText

public void setRowHeaderText(int row,
                             java.lang.String rowHeaderText)
Sets the text data for a row header. This method is called by the GridPanel's setRowHeaderText() method, and sets the text data for the row header by calling the setRowHeaderData() method.
Parameters:
row - the row
rowHeaderText - the text data for the row header
See Also:
GridPanel.setRowHeaderText(int, java.lang.String, boolean)

setRowHeaderData

public void setRowHeaderData(int row,
                             java.lang.Object rowHeaderData)
Sets the data for a row header. This method stores a reference to the data Object in the GridData structure.
Parameters:
row - the row
rowHeaderData - a reference to the data for a row header

setColHeaderText

public void setColHeaderText(int col,
                             java.lang.String colHeaderText)
Sets the text data for a column header. This method is called by the GridPanel's setColHeaderText() method, and sets the text data for the column header by calling the setColHeaderData() method.
Parameters:
col - the column
colHeaderText - the text data for the column header
See Also:
GridPanel.setColHeaderText(int, java.lang.String, boolean)

setColHeaderData

public void setColHeaderData(int col,
                             java.lang.Object colHeaderData)
Sets the data for a column header. This method stores a reference to the data Object in the GridData structure.
Parameters:
col - the column
colHeaderData - a reference to the data for a row header

getRowData

public java.util.Vector getRowData(int row)
Return the data for all the cells in a row. The method returns a Vector containing reference to the data objects for all the cells in a row.
Parameters:
row - the row
Returns:
the Vector containg references to the data for all the cells in a row

setRowData

public void setRowData(int row,
                       java.util.Vector rowData)
Sets the data for all the cells in a row. This method stores a reference to a Vector containing reference to the data objects for all the cells in a row.
Parameters:
row - the row
rowData - a Vector containing references to the data for all the cells in a row

compare

public int compare(java.lang.Object aData,
                   java.lang.Object bData,
                   int col)
The default compare method used by sortRows(). This method compares two cell data objects. If the Objects implement the Comparable interface, the compareTo method is called to compare the Objects, otherwise they Objects are compared by comparing their string representations and return 0 if they're equal, a value less than 0 if aData.toString() is less than bData.toString(), and a value greater than 0 if aData.toString() is greater than bData.toString(). This method can be overridden if they cells need to be compared differently.
Parameters:
aData - the first data object
bData - the second data object
col - the column whose data objects are being compared for the sort