KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > viewmodel > ColumnModel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.viewmodel;
21
22 import java.beans.PropertyEditor JavaDoc;
23 import javax.swing.table.TableCellEditor JavaDoc;
24 import javax.swing.table.TableCellRenderer JavaDoc;
25
26
27 /**
28  * Defines model for one table view column. Can be used together with
29  * {@link TreeModel} for tree table view representation.
30  *
31  * @author Jan Jancura
32  */

33 public abstract class ColumnModel implements Model {
34
35
36     /**
37      * Returns unique ID of this column.
38      *
39      * @return unique ID of this column
40      */

41     public abstract String JavaDoc getID ();
42
43     /**
44      * Returns display name of this column.
45      *
46      * @return display name of this column
47      */

48     public abstract String JavaDoc getDisplayName ();
49     
50     /**
51      * Returns the character, that indicates a mnemonic key
52      * for this column name. Can be <code>null</code>.
53      *
54      * @return the mnemonic key or <code>null</code>.
55      * @since 1.11
56      */

57     public Character JavaDoc getDisplayedMnemonic() {
58         return null;
59     }
60     
61     /**
62      * Returns type of column items.
63      *
64      * @return type of column items
65      */

66     public abstract Class JavaDoc getType ();
67     
68     /**
69      * Returns ID of column this column should be installed before or
70      * <code>null</code>. Defines default order of columns only.
71      * This default order can be changed by user, and
72      * {@link #getCurrentOrderNumber} and {@link #setCurrentOrderNumber} are
73      * used for sorting after that.
74      *
75      * @return ID of column this column should be installed before or
76      * <code>null</code>
77      * @deprecated Not used. See {@link #getCurrentOrderNumber}.
78      */

79     public String JavaDoc getPreviuosColumnID () {
80         return null;
81     }
82     
83     /**
84      * Returns ID of column this column should be installed after or
85      * <code>null</code>. Defines default order of columns only.
86      * This default order can be changed by user, and
87      * {@link #getCurrentOrderNumber} and {@link #setCurrentOrderNumber} are
88      * used for sorting after that.
89      *
90      * @return ID of column next to this one or <code>null</code>
91      * @deprecated Not used. See {@link #getCurrentOrderNumber}.
92      */

93     public String JavaDoc getNextColumnID () {
94         return null;
95     }
96     
97     /**
98      * Returns tooltip for given column. Default implementation returns
99      * <code>null</code> - do not use tooltip.
100      *
101      * @return tooltip for given node or <code>null</code>
102      */

103     public String JavaDoc getShortDescription () {
104         return null;
105     }
106     
107     /**
108      * True if column can be sorted. Default implementation returns
109      * <code>true</code>.
110      *
111      * @return true if column can be sorted
112      */

113     public boolean isSortable () {
114         return true;
115     }
116     
117     /**
118      * True if column should be visible. Default implementation
119      * returns <code>true</code>.
120      *
121      * @return <code>true</code> if column should be visible
122      */

123     public boolean isVisible () {
124         return true;
125     }
126     
127     /**
128      * Set true if column is to be visible. Default implementation does nothing.
129      *
130      * @param visible set true if column is to be visible
131      */

132     public void setVisible (boolean visible) {}
133     
134     /**
135      * True if column is sorted.
136      * Default implementation returns <code>false</code>.
137      *
138      * @return <code>true</code> if column is sorted.
139      */

140     public boolean isSorted () {
141         return false;
142     }
143     
144     /**
145      * Set true if column is to be sorted. Default implementation does nothing.
146      *
147      * @param sorted set true if column is to be sorted
148      */

149     public void setSorted (boolean sorted) {}
150     
151     /**
152      * True if column should be sorted in descending order.
153      * Default implementation returns <code>false</code>.
154      *
155      * @return <code>true</code> if column should be sorted
156      * in descending order
157      */

158     public boolean isSortedDescending () {
159         return false;
160     }
161     
162     /**
163      * Set true if column is to be sorted in descending order.
164      * Default implementation does nothing.
165      *
166      * @param sortedDescending set true if column is to be sorted
167      * in descending order
168      */

169     public void setSortedDescending (boolean sortedDescending) {}
170     
171     /**
172      * Should return current order number of this column. Default value is
173      * <code>-1</code>.
174      *
175      * @return current order number of this column or <code>-1</code>
176      */

177     public int getCurrentOrderNumber () {
178         return -1;
179     }
180     
181     /**
182      * Is called when current order number of this column is changed.
183      * Default implementation does nothing.
184      *
185      * @param newOrderNumber new order number
186      */

187     public void setCurrentOrderNumber (int newOrderNumber) {}
188     
189     /**
190      * Return column width of this column.
191      *
192      * @return column width of this column
193      */

194     public int getColumnWidth () {
195         return 20;
196     }
197     
198     /**
199      * Is called when column width of this column is changed.
200      * Default implementation does nothing.
201      *
202      * @param newColumnWidth a new column width
203      */

204     public void setColumnWidth (int newColumnWidth) {}
205     
206     /**
207      * Returns {@link java.beans.PropertyEditor} to be used for
208      * this column. Default implementation returns <code>null</code> -
209      * means use default PropertyEditor.
210      *
211      * @return {@link java.beans.PropertyEditor} to be used for
212      * this column
213      */

214     public PropertyEditor JavaDoc getPropertyEditor () {
215         return null;
216     }
217     
218     /**
219      * Rerturns {@link javax.swing.table.TableCellEditor} to be used for
220      * this column.
221      *
222      * @return {@link javax.swing.table.TableCellEditor} to be used for
223      * this column
224      */

225 // public TableCellEditor getTableCellEditor () {
226
// return null;
227
// }
228

229     /**
230      * Rerturns {@link javax.swing.table.TableCellRenderer} to be used for
231      * this column.
232      *
233      * @return {@link javax.swing.table.TableCellRenderer} to be used for
234      * this column
235      */

236 // public TableCellRenderer getTableCellRenderer () {
237
// return null;
238
// }
239
}
240
Popular Tags