KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Adds support for columns to basic {@link TreeModel}.
29  *
30  * @author Jan Jancura
31  */

32 public interface TableModel extends Model {
33
34
35     /**
36      * Returns value to be displayed in column <code>columnID</code>
37      * and row identified by <code>node</code>. Column ID is defined in by
38      * {@link ColumnModel#getID}, and rows are defined by values returned from
39      * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren}.
40      *
41      * @param node a object returned from
42      * {@link org.netbeans.spi.viewmodel.TreeModel#getChildren} for this row
43      * @param columnID a id of column defined by {@link ColumnModel#getID}
44      * @throws UnknownTypeException if there is no TableModel defined for given
45      * parameter type
46      *
47      * @return value of variable representing given position in tree table.
48      */

49     public abstract Object JavaDoc getValueAt (Object JavaDoc node, String JavaDoc columnID) throws
50     UnknownTypeException;
51     
52     /**
53      * Returns true if value displayed in column <code>columnID</code>
54      * and row <code>node</code> is read only. Column ID is defined in by
55      * {@link ColumnModel#getID}, and rows are defined by values returned from
56      * {@link TreeModel#getChildren}.
57      *
58      * @param node a object returned from {@link TreeModel#getChildren} for this row
59      * @param columnID a id of column defined by {@link ColumnModel#getID}
60      * @throws UnknownTypeException if there is no TableModel defined for given
61      * parameter type
62      *
63      * @return true if variable on given position is read only
64      */

65     public abstract boolean isReadOnly (Object JavaDoc node, String JavaDoc columnID) throws
66     UnknownTypeException;
67     
68     /**
69      * Changes a value displayed in column <code>columnID</code>
70      * and row <code>node</code>. Column ID is defined in by
71      * {@link ColumnModel#getID}, and rows are defined by values returned from
72      * {@link TreeModel#getChildren}.
73      *
74      * @param node a object returned from {@link TreeModel#getChildren} for this row
75      * @param columnID a id of column defined by {@link ColumnModel#getID}
76      * @param value a new value of variable on given position
77      * @throws UnknownTypeException if there is no TableModel defined for given
78      * parameter type
79      */

80     public abstract void setValueAt (Object JavaDoc node, String JavaDoc columnID, Object JavaDoc value)
81     throws UnknownTypeException;
82
83     /**
84      * Registers given listener.
85      *
86      * @param l the listener to add
87      */

88     public abstract void addModelListener (ModelListener l);
89
90     /**
91      * Unregisters given listener.
92      *
93      * @param l the listener to remove
94      */

95     public abstract void removeModelListener (ModelListener l);
96 }
97
Popular Tags