2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6
* The contents of this file are subject to the terms of either the GNU
7
* General Public License Version 2 only ("GPL") or the Common
8
* Development and Distribution License("CDDL") (collectively, the
9
* "License"). You may not use this file except in compliance with the
10
* License. You can obtain a copy of the License at
11
* http://www.netbeans.org/cddl-gplv2.html
12
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
* specific language governing permissions and limitations under the
14
* License. When distributing the software, include this License Header
15
* Notice in each file and include the License file at
16
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17
* particular file as subject to the "Classpath" exception as provided
18
* by Sun in the GPL Version 2 section of the License file that
19
* accompanied this code. If applicable, add the following below the
20
* License Header, with the fields enclosed by brackets [] replaced by
21
* your own identifying information:
22
* "Portions Copyrighted [year] [name of copyright owner]"
26
* The Original Software is NetBeans. The Initial Developer of the Original
27
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
* Microsystems, Inc. All Rights Reserved.
30
* If you wish your version of this file to be governed by only the CDDL
31
* or only the GPL Version 2, indicate your decision by adding
32
* "[Contributor] elects to include this software in this distribution
33
* under the [CDDL or GPL Version 2] license." If you do not indicate a
34
* single choice of license, a recipient has the option to distribute
35
* your version of this file under either the CDDL, the GPL Version 2 or
36
* to extend the choice of license to its licensees as provided above.
37
* However, if you add GPL Version 2 code and therefore, elected the GPL
38
* Version 2 license, then the option applies only if the new code is
39
* made subject to such option by the copyright holder.
42
package org.netbeans.spi.viewmodel;
44
import java.beans.PropertyEditor;
45
import javax.swing.table.TableCellEditor;
46
import javax.swing.table.TableCellRenderer;
50
* Defines model for one table view column. Can be used together with
51
* {@link TreeModel} for tree table view representation.
55
public abstract class ColumnModel implements Model {
59
* Returns unique ID of this column.
61
* @return unique ID of this column
63
public abstract String getID ();
66
* Returns display name of this column.
68
* @return display name of this column
70
public abstract String getDisplayName ();
73
* Returns the character, that indicates a mnemonic key
74
* for this column name. Can be <code>null</code>.
76
* @return the mnemonic key or <code>null</code>.
79
public Character getDisplayedMnemonic() {
84
* Returns type of column items.
86
* @return type of column items
88
public abstract Class getType ();
91
* Returns ID of column this column should be installed before or
92
* <code>null</code>. Defines default order of columns only.
93
* This default order can be changed by user, and
94
* {@link #getCurrentOrderNumber} and {@link #setCurrentOrderNumber} are
95
* used for sorting after that.
97
* @return ID of column this column should be installed before or
99
* @deprecated Not used. See {@link #getCurrentOrderNumber}.
101
public String getPreviuosColumnID () {
106
* Returns ID of column this column should be installed after or
107
* <code>null</code>. Defines default order of columns only.
108
* This default order can be changed by user, and
109
* {@link #getCurrentOrderNumber} and {@link #setCurrentOrderNumber} are
110
* used for sorting after that.
112
* @return ID of column next to this one or <code>null</code>
113
* @deprecated Not used. See {@link #getCurrentOrderNumber}.
115
public String getNextColumnID () {
120
* Returns tooltip for given column. Default implementation returns
121
* <code>null</code> - do not use tooltip.
123
* @return tooltip for given node or <code>null</code>
125
public String getShortDescription () {
130
* True if column can be sorted. Default implementation returns
133
* @return true if column can be sorted
135
public boolean isSortable () {
140
* True if column should be visible. Default implementation
141
* returns <code>true</code>.
143
* @return <code>true</code> if column should be visible
145
public boolean isVisible () {
150
* Set true if column is to be visible. Default implementation does nothing.
152
* @param visible set true if column is to be visible
154
public void setVisible (boolean visible) {}
157
* True if column is sorted.
158
* Default implementation returns <code>false</code>.
160
* @return <code>true</code> if column is sorted.
162
public boolean isSorted () {
167
* Set true if column is to be sorted. Default implementation does nothing.
169
* @param sorted set true if column is to be sorted
171
public void setSorted (boolean sorted) {}
174
* True if column should be sorted in descending order.
175
* Default implementation returns <code>false</code>.
177
* @return <code>true</code> if column should be sorted
178
* in descending order
180
public boolean isSortedDescending () {
185
* Set true if column is to be sorted in descending order.
186
* Default implementation does nothing.
188
* @param sortedDescending set true if column is to be sorted
189
* in descending order
191
public void setSortedDescending (boolean sortedDescending) {}
194
* Should return current order number of this column. Default value is
197
* @return current order number of this column or <code>-1</code>
199
public int getCurrentOrderNumber () {
204
* Is called when current order number of this column is changed.
205
* Default implementation does nothing.
207
* @param newOrderNumber new order number
209
public void setCurrentOrderNumber (int newOrderNumber) {}
212
* Return column width of this column.
214
* @return column width of this column
216
public int getColumnWidth () {
221
* Is called when column width of this column is changed.
222
* Default implementation does nothing.
224
* @param newColumnWidth a new column width
226
public void setColumnWidth (int newColumnWidth) {}
229
* Returns {@link java.beans.PropertyEditor} to be used for
230
* this column. Default implementation returns <code>null</code> -
231
* means use default PropertyEditor.
233
* @return {@link java.beans.PropertyEditor} to be used for
236
public PropertyEditor getPropertyEditor () {
241
* Rerturns {@link javax.swing.table.TableCellEditor} to be used for
244
* @return {@link javax.swing.table.TableCellEditor} to be used for
247
// public TableCellEditor getTableCellEditor () {
252
* Rerturns {@link javax.swing.table.TableCellRenderer} to be used for
255
* @return {@link javax.swing.table.TableCellRenderer} to be used for
258
// public TableCellRenderer getTableCellRenderer () {