~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to debuggercore/viewmodel/src/org/netbeans/spi/viewmodel/ColumnModel.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
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]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
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.
 
29
 *
 
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.
 
40
 */
 
41
 
 
42
package org.netbeans.spi.viewmodel;
 
43
 
 
44
import java.beans.PropertyEditor;
 
45
import javax.swing.table.TableCellEditor;
 
46
import javax.swing.table.TableCellRenderer;
 
47
 
 
48
 
 
49
/**
 
50
 * Defines model for one table view column. Can be used together with
 
51
 * {@link TreeModel} for tree table view representation.
 
52
 *
 
53
 * @author   Jan Jancura
 
54
 */
 
55
public abstract class ColumnModel implements Model {
 
56
 
 
57
 
 
58
    /**
 
59
     * Returns unique ID of this column.
 
60
     *
 
61
     * @return unique ID of this column
 
62
     */
 
63
    public abstract String getID ();
 
64
 
 
65
    /**
 
66
     * Returns display name of this column.
 
67
     *
 
68
     * @return display name of this column
 
69
     */
 
70
    public abstract String getDisplayName ();
 
71
    
 
72
    /** 
 
73
     * Returns the character, that indicates a mnemonic key
 
74
     * for this column name. Can be <code>null</code>.
 
75
     *
 
76
     * @return the mnemonic key or <code>null</code>.
 
77
     * @since 1.11
 
78
     */
 
79
    public Character getDisplayedMnemonic() {
 
80
        return null;
 
81
    }
 
82
    
 
83
    /**
 
84
     * Returns type of column items.
 
85
     *
 
86
     * @return type of column items
 
87
     */
 
88
    public abstract Class getType ();
 
89
    
 
90
    /**
 
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.
 
96
     *
 
97
     * @return ID of column this column should be installed before or 
 
98
     * <code>null</code>
 
99
     * @deprecated Not used. See {@link #getCurrentOrderNumber}.
 
100
     */
 
101
    public String getPreviuosColumnID () {
 
102
        return null;
 
103
    }
 
104
    
 
105
    /**
 
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.
 
111
     *
 
112
     * @return ID of column next to this one or <code>null</code>
 
113
     * @deprecated Not used. See {@link #getCurrentOrderNumber}.
 
114
     */
 
115
    public String getNextColumnID () {
 
116
        return null;
 
117
    }
 
118
    
 
119
    /**
 
120
     * Returns tooltip for given column. Default implementation returns 
 
121
     * <code>null</code> - do not use tooltip.
 
122
     *
 
123
     * @return  tooltip for given node or <code>null</code>
 
124
     */
 
125
    public String getShortDescription () {
 
126
        return null;
 
127
    }
 
128
    
 
129
    /**
 
130
     * True if column can be sorted. Default implementation returns 
 
131
     * <code>true</code>.
 
132
     *
 
133
     * @return true if column can be sorted
 
134
     */
 
135
    public boolean isSortable () {
 
136
        return true;
 
137
    }
 
138
    
 
139
    /**
 
140
     * True if column should be visible. Default implementation 
 
141
     * returns <code>true</code>.
 
142
     *
 
143
     * @return <code>true</code> if column should be visible
 
144
     */
 
145
    public boolean isVisible () {
 
146
        return true;
 
147
    }
 
148
    
 
149
    /**
 
150
     * Set true if column is to be visible. Default implementation does nothing.
 
151
     *
 
152
     * @param visible set true if column is to be visible
 
153
     */
 
154
    public void setVisible (boolean visible) {}
 
155
    
 
156
    /**
 
157
     * True if column is sorted.
 
158
     * Default implementation returns <code>false</code>.
 
159
     *
 
160
     * @return <code>true</code> if column is sorted.
 
161
     */
 
162
    public boolean isSorted () {
 
163
        return false;
 
164
    }
 
165
    
 
166
    /**
 
167
     * Set true if column is to be sorted. Default implementation does nothing.
 
168
     *
 
169
     * @param sorted set true if column is to be sorted
 
170
     */
 
171
    public void setSorted (boolean sorted) {}
 
172
    
 
173
    /**
 
174
     * True if column should be sorted in descending order.
 
175
     * Default implementation returns <code>false</code>.
 
176
     *
 
177
     * @return <code>true</code> if column should be sorted
 
178
     *         in descending order
 
179
     */
 
180
    public boolean isSortedDescending () {
 
181
        return false;
 
182
    }
 
183
    
 
184
    /**
 
185
     * Set true if column is to be sorted in descending order.
 
186
     * Default implementation does nothing.
 
187
     *
 
188
     * @param sortedDescending set true if column is to be sorted
 
189
     *        in descending order
 
190
     */
 
191
    public void setSortedDescending (boolean sortedDescending) {}
 
192
    
 
193
    /**
 
194
     * Should return current order number of this column. Default value is 
 
195
     * <code>-1</code>.
 
196
     *
 
197
     * @return current order number of this column or <code>-1</code>
 
198
     */
 
199
    public int getCurrentOrderNumber () {
 
200
        return -1;
 
201
    }
 
202
    
 
203
    /**
 
204
     * Is called when current order number of this column is changed.
 
205
     * Default implementation does nothing.
 
206
     *
 
207
     * @param newOrderNumber new order number
 
208
     */
 
209
    public void setCurrentOrderNumber (int newOrderNumber) {}
 
210
    
 
211
    /**
 
212
     * Return column width of this column.
 
213
     *
 
214
     * @return column width of this column
 
215
     */
 
216
    public int getColumnWidth () {
 
217
        return 20;
 
218
    }
 
219
    
 
220
    /**
 
221
     * Is called when column width of this column is changed.
 
222
     * Default implementation does nothing.
 
223
     *
 
224
     * @param newColumnWidth a new column width
 
225
     */
 
226
    public void setColumnWidth (int newColumnWidth) {}
 
227
    
 
228
    /**
 
229
     * Returns {@link java.beans.PropertyEditor} to be used for 
 
230
     * this column. Default implementation returns <code>null</code> - 
 
231
     * means use default PropertyEditor.
 
232
     *
 
233
     * @return {@link java.beans.PropertyEditor} to be used for 
 
234
     *         this column
 
235
     */
 
236
    public PropertyEditor getPropertyEditor () {
 
237
        return null;
 
238
    }
 
239
    
 
240
    /**
 
241
     * Rerturns {@link javax.swing.table.TableCellEditor} to be used for 
 
242
     * this column.
 
243
     *
 
244
     * @return {@link javax.swing.table.TableCellEditor} to be used for 
 
245
     *         this column
 
246
     */
 
247
//    public TableCellEditor getTableCellEditor () {
 
248
//        return null;
 
249
//    }
 
250
    
 
251
    /**
 
252
     * Rerturns {@link javax.swing.table.TableCellRenderer} to be used for 
 
253
     * this column.
 
254
     *
 
255
     * @return {@link javax.swing.table.TableCellRenderer} to be used for 
 
256
     *         this column
 
257
     */
 
258
//    public TableCellRenderer getTableCellRenderer () {
 
259
//        return null;
 
260
//    }
 
261
}