Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / javax / swing / table / TableColumnModel.java
blob986c02533237f46a67b7285c196d356686d3419c
1 /* TableColumnModel.java --
2 Copyright (C) 2002, 2004, 2005, 2006, 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)
9 any later version.
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
19 02110-1301 USA.
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
24 combination.
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.ChangeEvent;
46 import javax.swing.event.TableColumnModelEvent;
47 import javax.swing.event.TableColumnModelListener;
49 /**
50 * The interface used by {@link JTable} to access the columns in the table
51 * view.
53 * @author Andrew Selkirk
55 public interface TableColumnModel
57 /**
58 * Adds a column to the model.
60 * @param column the new column (<code>null</code> not permitted).
62 * @throws IllegalArgumentException if <code>column</code> is
63 * <code>null</code>.
65 void addColumn(TableColumn column);
67 /**
68 * Removes a column from the model. If <code>column</code> is not defined
69 * in the model, this method does nothing.
71 * @param column TableColumn
73 void removeColumn(TableColumn column);
75 /**
76 * Moves a column.
78 * @param columnIndex Index of column to move
79 * @param newIndex New index of column
81 void moveColumn(int columnIndex, int newIndex);
83 /**
84 * Sets the column margin and sends a {@link ChangeEvent} to all registered
85 * {@link TableColumnModelListener}s registered with the model.
87 * @param margin the column margin.
89 * @see #getColumnMargin()
91 void setColumnMargin(int margin);
93 /**
94 * Returns the number of columns in the model.
96 * @return The column count.
98 int getColumnCount();
101 * Returns an enumeration of the columns in the model.
103 * @return An enumeration of the columns in the model.
105 Enumeration getColumns();
108 * Returns the index of the {@link TableColumn} with the given identifier.
110 * @param identifier the identifier (<code>null</code> not permitted).
112 * @return The index of the {@link TableColumn} with the given identifier.
114 * @throws IllegalArgumentException if <code>identifier</code> is
115 * <code>null</code> or there is no column with that identifier.
117 int getColumnIndex(Object identifier);
120 * Returns the <code>TableColumn</code> at the specified index.
122 * @param columnIndex the column index.
124 * @return The table column.
126 TableColumn getColumn(int columnIndex);
129 * Returns the column margin.
131 * @return The column margin.
133 * @see #setColumnMargin(int)
135 int getColumnMargin();
138 * Returns the index of the column that contains the specified x-coordinate,
139 * assuming that:
140 * <ul>
141 * <li>column zero begins at position zero;</li>
142 * <li>all columns appear in order;</li>
143 * <li>individual column widths are taken into account, but the column margin
144 * is ignored.</li>
145 * </ul>
146 * If no column contains the specified position, this method returns
147 * <code>-1</code>.
149 * @param xPosition the x-position.
151 * @return The column index, or <code>-1</code>.
153 int getColumnIndexAtX(int xPosition);
156 * Returns total width of all the columns in the model, ignoring the
157 * column margin (see {@link #getColumnMargin()}).
159 * @return The total width of all the columns.
161 int getTotalColumnWidth();
164 * Sets the flag that indicates whether or not column selection is allowed.
166 * @param allowed the new flag value.
168 * @see #getColumnSelectionAllowed()
170 void setColumnSelectionAllowed(boolean allowed);
173 * Returns <code>true</code> if column selection is allowed, and
174 * <code>false</code> if column selection is not allowed.
176 * @return A boolean.
178 * @see #setColumnSelectionAllowed(boolean)
180 boolean getColumnSelectionAllowed();
183 * getSelectedColumns
184 * @return Selected columns
186 int[] getSelectedColumns();
189 * Returns the number of selected columns in the model.
191 * @return The selected column count.
193 * @see #getSelectionModel()
195 int getSelectedColumnCount();
198 * Sets the selection model that will be used to keep track of the selected
199 * columns.
201 * @param model the selection model (<code>null</code> not permitted).
203 * @throws IllegalArgumentException if <code>model</code> is
204 * <code>null</code>.
206 void setSelectionModel(ListSelectionModel model);
209 * Returns the selection model used to track table column selections.
211 * @return The selection model.
213 * @see #setSelectionModel(ListSelectionModel)
215 ListSelectionModel getSelectionModel();
218 * Registers a listener with the model, so that it will receive
219 * {@link TableColumnModelEvent} notifications.
221 * @param listener the listener (<code>null</code> ignored).
223 void addColumnModelListener(TableColumnModelListener listener);
226 * Deregisters a listener, so that it will no longer receive
227 * {@link TableColumnModelEvent} notifications.
229 * @param listener the listener.
231 void removeColumnModelListener(TableColumnModelListener listener);