com.guiseframework.model
Class DefaultTableModel
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
com.guiseframework.model.AbstractModel
com.guiseframework.model.AbstractTableModel
com.guiseframework.model.DefaultTableModel
- All Implemented Interfaces:
- com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Model, TableModel
public class DefaultTableModel
- extends AbstractTableModel
The default implementation of a table model.
The model is thread-safe, synchronized on itself. Any iteration over values should include synchronization on the instance of this class.
- Author:
- Garret Wilson
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
|
Constructor Summary |
DefaultTableModel(java.lang.Class<C> valueClass,
C[][] rowValues,
java.lang.String... columnNames)
Constructs a default table model indicating the type of values it can hold and column names. |
DefaultTableModel(java.lang.Class<C> valueClass,
java.lang.String... columnNames)
Constructs a default table model indicating the type of values it can hold, using default column models. |
DefaultTableModel(java.lang.Object[][] rowValues,
TableColumnModel<?>... columns)
Constructs a default table model indicating the type of values it can hold. |
DefaultTableModel(TableColumnModel<?>... columns)
Constructs a default table model indicating the type of values it can hold along with column definitions. |
| Methods inherited from class com.globalmentor.beans.BoundPropertyObject |
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.globalmentor.beans.PropertyBindable |
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.globalmentor.beans.PropertyConstrainable |
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener |
DefaultTableModel
public DefaultTableModel(java.lang.Class<C> valueClass,
java.lang.String... columnNames)
- Constructs a default table model indicating the type of values it can hold, using default column models.
- Type Parameters:
C - The type of values in all the cells in the table.- Parameters:
valueClass - The class indicating the type of values held in the model.columnNames - The names to serve as label headers for the columns.
- Throws:
java.lang.NullPointerException - if the given class object is null.
DefaultTableModel
public DefaultTableModel(TableColumnModel<?>... columns)
- Constructs a default table model indicating the type of values it can hold along with column definitions.
- Parameters:
columns - The models representing the table columns.
- Throws:
java.lang.NullPointerException - if the given class object is null.
DefaultTableModel
public DefaultTableModel(java.lang.Class<C> valueClass,
C[][] rowValues,
java.lang.String... columnNames)
- Constructs a default table model indicating the type of values it can hold and column names.
- Type Parameters:
C - The type of values in all the cells in the table.- Parameters:
valueClass - The class indicating the type of values held in the model.rowValues - The two-dimensional list of values, where the first index represents the row and the second represents the column, or null if no default values should be given.columnNames - The names to serve as label headers for the columns.
- Throws:
java.lang.NullPointerException - if the given class object is null.
java.lang.IllegalArgumentException - if the given number of columns does not equal the number of columns in any given data row.
DefaultTableModel
public DefaultTableModel(java.lang.Object[][] rowValues,
TableColumnModel<?>... columns)
- Constructs a default table model indicating the type of values it can hold.
- Parameters:
rowValues - The two-dimensional list of values, where the first index represents the row and the second represents the column, or null if no default values should be given.columns - The models representing the table columns.
- Throws:
java.lang.IllegalArgumentException - if the given number of columns does not equal the number of columns in any given data row.
java.lang.ClassCastException - if one of the values in a row is not compatible with the type of its column.
getRowCount
public int getRowCount()
- Returns:
- The number of rows in this table.
createDefaultColumns
public static <C> TableColumnModel<C>[] createDefaultColumns(java.lang.Class<C> valueClass,
java.lang.String... columnNames)
- Creates default columns with the given column names.
- Type Parameters:
C - The type of values contained in the columns.- Parameters:
valueClass - The class representing the values contained in the columns.columnNames - The names to serve as label headers for the columns.
- Returns:
- An array of default columns.
getCellValue
public <C> C getCellValue(int rowIndex,
TableColumnModel<C> column)
- Returns the cell value at the given row and column.
- Type Parameters:
C - The type of cell values in the given column.- Parameters:
rowIndex - The zero-based row index.column - The column for which a value should be returned.
- Returns:
- The value in the cell at the given row and column, or
null if there is no value in that cell.
- Throws:
java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
java.lang.IllegalArgumentException - if the given column is not one of this table's columns.
setCellValue
public <C> void setCellValue(int rowIndex,
TableColumnModel<C> column,
C newCellValue)
- Sets the cell value at the given row and column.
- Type Parameters:
C - The type of cell values in the given column.- Parameters:
rowIndex - The zero-based row index.column - The column for which a value should be returned.newCellValue - The value to place in the cell at the given row and column, or null if there should be no value in that cell.
- Throws:
java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
java.lang.IllegalArgumentException - if the given column is not one of this table's columns.
Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.