diff options
Diffstat (limited to 'libjava/javax/swing/table/TableModel.java')
-rw-r--r-- | libjava/javax/swing/table/TableModel.java | 152 |
1 files changed, 88 insertions, 64 deletions
diff --git a/libjava/javax/swing/table/TableModel.java b/libjava/javax/swing/table/TableModel.java index a4732d061b9..591ce4342a0 100644 --- a/libjava/javax/swing/table/TableModel.java +++ b/libjava/javax/swing/table/TableModel.java @@ -1,5 +1,5 @@ /* TableModel.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,72 +39,96 @@ package javax.swing.table; import javax.swing.event.TableModelListener; - /** - * TableModel public interface + * A <code>TableModel</code> is a two dimensional data structure that + * can store arbitrary <code>Object</code> instances, usually for the + * purpose of display in a {@link JTable} component. Individual objects + * can be accessed by specifying the row index and column index for + * the object. Each column in the model has a name associated with it. + * <p> + * The {@link DefaultTableModel} class provides one implementation of + * this interface. + * * @author Andrew Selkirk */ public interface TableModel { - /** - * getRowCount - * @return row count - */ - int getRowCount(); - - /** - * getColumnCount - * @return column count - */ - int getColumnCount(); - - /** - * getColumnName - * @param columnIndex Column index - * @return Column name - */ - String getColumnName(int columnIndex); - - /** - * getColumnClass - * @param columnIndex Column index - * @return Column class - */ - Class getColumnClass(int columnIndex); - - /** - * isCellEditable - * @param rowIndex Row index - * @param columnIndex Column index - * @return true if editable, false otherwise - */ - boolean isCellEditable(int rowIndex, int columnIndex); - - /** - * getValueAt - * @param rowIndex Row index - * @param columnIndex Column index - * @return Value at specified indices - */ - Object getValueAt(int rowIndex, int columnIndex); - - /** - * setValueAt - * @param aValue Value to set - * @param rowIndex Row index - * @param columnIndex Column index - */ - void setValueAt(Object aValue, int rowIndex, int columnIndex); - - /** - * addTableModelListener - * @param listener TableModelListener - */ - void addTableModelListener(TableModelListener listener); - - /** - * removeTableModelListener - * @param listener TableModelListener - */ - void removeTableModelListener(TableModelListener listener); + /** + * Returns the number of rows in the model. + * + * @return The row count. + */ + int getRowCount(); + + /** + * Returns the number of columns in the model. + * + * @return The column count + */ + int getColumnCount(); + + /** + * Returns the name of a column in the model. + * + * @param columnIndex the column index. + * + * @return The column name. + */ + String getColumnName(int columnIndex); + + /** + * Returns the <code>Class</code> for all <code>Object</code> instances + * in the specified column. + * + * @param columnIndex the column index. + * + * @return The class. + */ + Class getColumnClass(int columnIndex); + + /** + * Returns <code>true</code> if the cell is editable, and <code>false</code> + * otherwise. + * + * @param rowIndex the row index. + * @param columnIndex the column index. + * + * @return <code>true</code> if editable, <code>false</code> otherwise. + */ + boolean isCellEditable(int rowIndex, int columnIndex); + + /** + * Returns the value (<code>Object</code>) at a particular cell in the + * table. + * + * @param rowIndex the row index. + * @param columnIndex the column index. + * + * @return The value at the specified cell. + */ + Object getValueAt(int rowIndex, int columnIndex); + + /** + * Sets the value at a particular cell in the table. + * + * @param aValue the value (<code>null</code> permitted). + * @param rowIndex the row index. + * @param columnIndex the column index. + */ + void setValueAt(Object aValue, int rowIndex, int columnIndex); + + /** + * Adds a listener to the model. The listener will receive notification + * of updates to the model. + * + * @param listener the listener. + */ + void addTableModelListener(TableModelListener listener); + + /** + * Removes a listener from the model. + * + * @param listener the listener. + */ + void removeTableModelListener(TableModelListener listener); } |