1 |
/* TableModel.java -- |
/* TableModel.java -- |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2005, Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
39 |
|
|
40 |
import javax.swing.event.TableModelListener; |
import javax.swing.event.TableModelListener; |
41 |
|
|
|
|
|
42 |
/** |
/** |
43 |
* TableModel public interface |
* A <code>TableModel</code> is a two dimensional data structure that |
44 |
|
* can store arbitrary <code>Object</code> instances, usually for the |
45 |
|
* purpose of display in a {@link JTable} component. Individual objects |
46 |
|
* can be accessed by specifying the row index and column index for |
47 |
|
* the object. Each column in the model has a name associated with it. |
48 |
|
* <p> |
49 |
|
* The {@link DefaultTableModel} class provides one implementation of |
50 |
|
* this interface. |
51 |
|
* |
52 |
* @author Andrew Selkirk |
* @author Andrew Selkirk |
53 |
*/ |
*/ |
54 |
public interface TableModel |
public interface TableModel |
55 |
{ |
{ |
56 |
/** |
/** |
57 |
* getRowCount |
* Returns the number of rows in the model. |
58 |
* @return row count |
* |
59 |
|
* @return The row count. |
60 |
*/ |
*/ |
61 |
int getRowCount(); |
int getRowCount(); |
62 |
|
|
63 |
/** |
/** |
64 |
* getColumnCount |
* Returns the number of columns in the model. |
65 |
* @return column count |
* |
66 |
|
* @return The column count |
67 |
*/ |
*/ |
68 |
int getColumnCount(); |
int getColumnCount(); |
69 |
|
|
70 |
/** |
/** |
71 |
* getColumnName |
* Returns the name of a column in the model. |
72 |
* @param columnIndex Column index |
* |
73 |
* @return Column name |
* @param columnIndex the column index. |
74 |
|
* |
75 |
|
* @return The column name. |
76 |
*/ |
*/ |
77 |
String getColumnName(int columnIndex); |
String getColumnName(int columnIndex); |
78 |
|
|
79 |
/** |
/** |
80 |
* getColumnClass |
* Returns the <code>Class</code> for all <code>Object</code> instances |
81 |
* @param columnIndex Column index |
* in the specified column. |
82 |
* @return Column class |
* |
83 |
|
* @param columnIndex the column index. |
84 |
|
* |
85 |
|
* @return The class. |
86 |
*/ |
*/ |
87 |
Class getColumnClass(int columnIndex); |
Class getColumnClass(int columnIndex); |
88 |
|
|
89 |
/** |
/** |
90 |
* isCellEditable |
* Returns <code>true</code> if the cell is editable, and <code>false</code> |
91 |
* @param rowIndex Row index |
* otherwise. |
92 |
* @param columnIndex Column index |
* |
93 |
* @return true if editable, false otherwise |
* @param rowIndex the row index. |
94 |
|
* @param columnIndex the column index. |
95 |
|
* |
96 |
|
* @return <code>true</code> if editable, <code>false</code> otherwise. |
97 |
*/ |
*/ |
98 |
boolean isCellEditable(int rowIndex, int columnIndex); |
boolean isCellEditable(int rowIndex, int columnIndex); |
99 |
|
|
100 |
/** |
/** |
101 |
* getValueAt |
* Returns the value (<code>Object</code>) at a particular cell in the |
102 |
* @param rowIndex Row index |
* table. |
103 |
* @param columnIndex Column index |
* |
104 |
* @return Value at specified indices |
* @param rowIndex the row index. |
105 |
|
* @param columnIndex the column index. |
106 |
|
* |
107 |
|
* @return The value at the specified cell. |
108 |
*/ |
*/ |
109 |
Object getValueAt(int rowIndex, int columnIndex); |
Object getValueAt(int rowIndex, int columnIndex); |
110 |
|
|
111 |
/** |
/** |
112 |
* setValueAt |
* Sets the value at a particular cell in the table. |
113 |
* @param aValue Value to set |
* |
114 |
* @param rowIndex Row index |
* @param aValue the value (<code>null</code> permitted). |
115 |
* @param columnIndex Column index |
* @param rowIndex the row index. |
116 |
|
* @param columnIndex the column index. |
117 |
*/ |
*/ |
118 |
void setValueAt(Object aValue, int rowIndex, int columnIndex); |
void setValueAt(Object aValue, int rowIndex, int columnIndex); |
119 |
|
|
120 |
/** |
/** |
121 |
* addTableModelListener |
* Adds a listener to the model. The listener will receive notification |
122 |
* @param listener TableModelListener |
* of updates to the model. |
123 |
|
* |
124 |
|
* @param listener the listener. |
125 |
*/ |
*/ |
126 |
void addTableModelListener(TableModelListener listener); |
void addTableModelListener(TableModelListener listener); |
127 |
|
|
128 |
/** |
/** |
129 |
* removeTableModelListener |
* Removes a listener from the model. |
130 |
* @param listener TableModelListener |
* |
131 |
|
* @param listener the listener. |
132 |
*/ |
*/ |
133 |
void removeTableModelListener(TableModelListener listener); |
void removeTableModelListener(TableModelListener listener); |
134 |
} |
} |