Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nextapp.echo2.app.table
Class DefaultTableModel

    java.lang.Object
      nextapp.echo2.app.table.AbstractTableModel
          nextapp.echo2.app.table.DefaultTableModel

All Implemented Interfaces:
  java.io.Serializable, TableModel

Direct Known Subclasses:
  DefaultSortableTableModel

    public class DefaultTableModel

extends AbstractTableModel

The default `TableModel` implementation.

See Also:
  Serialized Form

Constructor Summary
`DefaultTableModel()` Creates a new table model of 0x0 size.
`DefaultTableModel(int columns, int rows)` Creates a new table model with the specified dimensions.
`DefaultTableModel(java.lang.Object[][] data, java.lang.Object[] names)` Creates a new Table Model with the specified data and column names.

Method Summary
`void` | `addRow(java.lang.Object[] rowData)` Adds a row containing the provided data to the end of the model.
`void` | `deleteRow(int row)` Deletes the specified row.
`int` | `getColumnCount()` Returns the number of columns in the table.
`java.lang.String` | `getColumnName(int column)` Returns column names using a "spreadsheet-style" convention, i.e., A, B, C...Y, Z, AA, AB, AC...
`int` | `getRowCount()` Returns the number of rows in the table.
`java.lang.Object` | `getValueAt(int column, int row)` Returns the value found at the given coordinate within the table.
`void` | `insertRow(int row, java.lang.Object[] rowData)` Inserts a row containing the provided data.
`void` | `setColumnCount(int newValue)` Sets the number of columns in the table.
`void` | `setColumnName(int column, java.lang.String columnName)` Sets the name of the specified column.
`void` | `setRowCount(int newValue)` Sets the number of rows in the table.
`void` | `setValueAt(java.lang.Object newValue, int column, int row)` Sets the contents of the table cell at the specified coordinate.

Methods inherited from class nextapp.echo2.app.table.AbstractTableModel
`addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getEventListenerList, removeTableModelListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultTableModel

    public DefaultTableModel()

  Creates a new table model of 0x0 size.

### DefaultTableModel

    public DefaultTableModel(int columns,
                             int rows)

  Creates a new table model with the specified dimensions.

  Parameters:
    `columns` - the initial number of columns
    `rows` - the initial number of rows

### DefaultTableModel

    public DefaultTableModel(java.lang.Object[][] data,
                             java.lang.Object[] names)

  Creates a new Table Model with the specified data and column names.

  Parameters:
    `data` - a two dimensional array containing the table data (the first index of the array represents the column index, and the second index represents the row index)
    `names` - the column names

Method Detail

### addRow

    public void addRow(java.lang.Object[] rowData)

  Adds a row containing the provided data to the end of the model.

  Parameters:
    `rowData` - the row data

### deleteRow

    public void deleteRow(int row)

  Deletes the specified row.

  Parameters:
    `row` - the row to delete

### getColumnCount

    public int getColumnCount()

  Description copied from interface: `TableModel`
  Returns the number of columns in the table.

  Returns:
    the column count
  See Also:
    `TableModel.getColumnCount()`

### getColumnName

    public java.lang.String getColumnName(int column)

  Description copied from class: `AbstractTableModel`
  Returns column names using a "spreadsheet-style" convention, i.e., A, B, C...Y, Z, AA, AB, AC...

  Specified by:
    `getColumnName` in interface `TableModel`
  Overrides:
    `getColumnName` in class `AbstractTableModel`
  Parameters:
    `column` - the column index (0-based)
  Returns:
    the column name
  See Also:
    `TableModel.getColumnName(int)`

### getRowCount

    public int getRowCount()

  Description copied from interface: `TableModel`
  Returns the number of rows in the table.

  Returns:
    the row count
  See Also:
    `TableModel.getRowCount()`

### getValueAt

    public java.lang.Object getValueAt(int column,
                                       int row)

  Description copied from interface: `TableModel`
  Returns the value found at the given coordinate within the table. Column and row values are 0-based. WARNING: Take note that the column is the first parameter passed to this method, and the row is the second parameter.

  Parameters:
    `column` - the column index (0-based)
    `row` - the row index (0-based)
  See Also:
    `TableModel.getValueAt(int, int)`

### insertRow

    public void insertRow(int row,
                          java.lang.Object[] rowData)

  Inserts a row containing the provided data.

  Parameters:
    `row` - the insertion index
    `rowData` - the row data

### setColumnCount

    public void setColumnCount(int newValue)

  Sets the number of columns in the table. Empty columns will be added at the end of the table if the new column count exceeds the number of existing columns. Existing columns will be hidden if the number of existing columns exceeds the new column count.

  Parameters:
    `newValue` - the new column count

### setColumnName

    public void setColumnName(int column,
                              java.lang.String columnName)

  Sets the name of the specified column.

  Parameters:
    `column` - the column index
    `columnName` - the new column name

### setRowCount

    public void setRowCount(int newValue)

  Sets the number of rows in the table. Empty rows will be added at the end of the table if the new row count exceeds the number of existing rows. Existing rows will be hidden if the number of existing rows exceeds the new row count.

  Parameters:
    `newValue` - the new row count

### setValueAt

    public void setValueAt(java.lang.Object newValue,
                           int column,
                           int row)

  Sets the contents of the table cell at the specified coordinate.

  Parameters:
    `newValue` - the new value
    `column` - the column index
    `row` - the row index
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the column or row index exceed the column or row count

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD