KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Allows to filter content of some existing {@link TableModel}. You can add
29  * a new column, remmove some existing one, or change content of some existing
30  * column.
31  *
32  * @author Jan Jancura
33  */

34 public interface TableModelFilter extends Model {
35
36
37     /**
38      * Returns filterred value to be displayed in column <code>columnID</code>
39      * and row <code>node</code>. Column ID is defined in by
40      * {@link ColumnModel#getID}, and rows are defined by values returned from
41      * {@link TreeModel#getChildren}. You should not throw UnknownTypeException
42      * directly from this method!
43      *
44      * @param original the original table model
45      * @param node a object returned from {@link TreeModel#getChildren} for this row
46      * @param columnID a id of column defined by {@link ColumnModel#getID}
47      * @throws UnknownTypeException this exception can be thrown from
48      * <code>original.getValueAt (...)</code> method call only!
49      *
50      * @return value of variable representing given position in tree table.
51      */

52     public abstract Object JavaDoc getValueAt (
53         TableModel original,
54         Object JavaDoc node,
55         String JavaDoc columnID
56     ) throws UnknownTypeException;
57     
58     /**
59      * Filters original isReadOnly value from given table model. You should
60      * not throw UnknownTypeException
61      * directly from this method!
62      *
63      * @param original the original table model
64      * @param node a object returned from {@link TreeModel#getChildren} for this row
65      * @param columnID a id of column defined by {@link ColumnModel#getID}
66      * @throws UnknownTypeException this exception can be thrown from
67      * <code>original.isReadOnly (...)</code> method call only!
68      *
69      * @return true if variable on given position is read only
70      */

71     public abstract boolean isReadOnly (
72         TableModel original,
73         Object JavaDoc node,
74         String JavaDoc columnID
75     ) throws UnknownTypeException;
76     
77     /**
78      * Changes a value displayed in column <code>columnID</code>
79      * and row <code>node</code>. Column ID is defined in by
80      * {@link ColumnModel#getID}, and rows are defined by values returned from
81      * {@link TreeModel#getChildren}. You should not throw UnknownTypeException
82      * directly from this method!
83      *
84      * @param original the original table model
85      * @param node a object returned from {@link TreeModel#getChildren} for this row
86      * @param columnID a id of column defined by {@link ColumnModel#getID}
87      * @param value a new value of variable on given position
88      * @throws UnknownTypeException this exception can be thrown from
89      * <code>original.setValueAt (...)</code> method call only!
90      */

91     public abstract void setValueAt (
92         TableModel original,
93         Object JavaDoc node,
94         String JavaDoc columnID,
95         Object JavaDoc value
96     ) throws UnknownTypeException;
97
98     /**
99      * Registers given listener.
100      *
101      * @param l the listener to add
102      */

103     public abstract void addModelListener (ModelListener l);
104
105     /**
106      * Unregisters given listener.
107      *
108      * @param l the listener to remove
109      */

110     public abstract void removeModelListener (ModelListener l);
111 }
112
Popular Tags