1 /* TableColumnModel.java --
2 Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax
.swing
.table
;
41 import java
.util
.Enumeration
;
43 import javax
.swing
.JTable
;
44 import javax
.swing
.ListSelectionModel
;
45 import javax
.swing
.event
.TableColumnModelListener
;
48 * The interface used by {@link JTable} to access the columns in the table
51 * @author Andrew Selkirk
53 // FIXME: The API documentation in this class is incomplete.
54 public interface TableColumnModel
57 * Adds a column to the model.
59 * @param column the new column (<code>null</code> not permitted).
61 * @throws IllegalArgumentException if <code>column</code> is
64 void addColumn(TableColumn column
);
67 * Removes a column from the model. If <code>column</code> is not defined
68 * in the model, this method does nothing.
70 * @param column TableColumn
72 void removeColumn(TableColumn column
);
77 * @param columnIndex Index of column to move
78 * @param newIndex New index of column
80 void moveColumn(int columnIndex
, int newIndex
);
84 * @param margin Margin of column
86 void setColumnMargin(int margin
);
89 * Returns the number of columns in the model.
91 * @return The column count
97 * @return Enumeration of columns
99 Enumeration
getColumns();
102 * Returns the index of the {@link TableColumn} with the given identifier.
104 * @param identifier the identifier (<code>null</code> not permitted).
106 * @return The index of the {@link TableColumn} with the given identifier.
108 * @throws IllegalArgumentException if <code>identifier</code> is
109 * <code>null</code> or there is no column with that identifier.
111 int getColumnIndex(Object identifier
);
114 * Returns the <code>TableColumn</code> at the specified index.
116 * @param columnIndex the column index.
118 * @return The table column.
120 TableColumn
getColumn(int columnIndex
);
123 * Returns the column margin.
125 * @return The column margin.
127 int getColumnMargin();
131 * @return Column index as position x
133 int getColumnIndexAtX(int xPosition
);
136 * getTotalColumnWidth
137 * @return Total column width
139 int getTotalColumnWidth();
142 * setColumnSelectionAllowed
143 * @param value Set column selection
145 void setColumnSelectionAllowed(boolean value
);
148 * getColumnSelectionAllowed
149 * @return true if column selection allowed, false otherwise
151 boolean getColumnSelectionAllowed();
155 * @return Selected columns
157 int[] getSelectedColumns();
160 * getSelectedColumnCount
161 * @return Count of selected columns
163 int getSelectedColumnCount();
167 * @param model ListSelectionModel
169 void setSelectionModel(ListSelectionModel model
);
174 ListSelectionModel
getSelectionModel();
177 * addColumnModelListener
178 * @param listener TableColumnModelListener
180 void addColumnModelListener(TableColumnModelListener listener
);
183 * removeColumnModelListener
184 * @param listener TableColumnModelListener
186 void removeColumnModelListener(TableColumnModelListener listener
);