KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > debugger > jpda > VariablesFilter


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.debugger.jpda;
21
22 import javax.swing.Action JavaDoc;
23 import org.netbeans.api.debugger.jpda.Variable;
24 import org.netbeans.spi.viewmodel.NodeActionsProvider;
25 import org.netbeans.spi.viewmodel.NodeModel;
26 import org.netbeans.spi.viewmodel.TableModel;
27 import org.netbeans.spi.viewmodel.TreeModel;
28 import org.netbeans.spi.viewmodel.UnknownTypeException;
29
30
31 /**
32  * This filter allows to change nodes in Locals View and Watches View for
33  * some concrete variable types. For example itallows to define "logical" view
34  * for java.util.Hashtable.
35  *
36  * Instances of this filter should be registerred in: "
37  * "META-INF\debugger\netbeans-JPDADebuggerEngine\org.netbeans.spi.debugger.jpda.VariablesFilter"
38  * file.
39  *
40  * @author Jan Jancura
41  */

42 public abstract class VariablesFilter {
43     
44
45     /**
46      * Returns set of fully quilified class names (like java.lang.String) this
47      * filter is registerred to.
48      *
49      * @return set of fully quilified class names
50      */

51     public abstract String JavaDoc[] getSupportedTypes ();
52
53     /**
54      * Returns set of fully quilified class names (like java.lang.String) this
55      * filter is registerred to.
56      *
57      * @return set of fully quilified class names
58      */

59     public abstract String JavaDoc[] getSupportedAncestors ();
60     
61     /**
62      * Returns filtered children for given variable on given indexes.
63      *
64      * @param original the original tree model
65      * @param variable a variable of returned fields
66      * @throws NoInformationException if the set of children can not be
67      * resolved
68      * @throws ComputingException if the children resolving process
69      * is time consuming, and will be performed off-line
70      * @throws UnknownTypeException if this TreeModelFilter implementation is not
71      * able to resolve dchildren for given node type
72      *
73      * @return children for given parent on given indexes
74      */

75     public abstract Object JavaDoc[] getChildren (
76         TreeModel original,
77         Variable variable,
78         int from,
79         int to
80     ) throws UnknownTypeException;
81     
82     /**
83      * Returns number of filtered children for given variable.
84      *
85      * @param original the original tree model
86      * @param variable a variable of returned fields
87      *
88      * @throws NoInformationException if the set of children can not be
89      * resolved
90      * @throws ComputingException if the children resolving process
91      * is time consuming, and will be performed off-line
92      * @throws UnknownTypeException if this TreeModelFilter implementation is not
93      * able to resolve dchildren for given node type
94      *
95      * @return number of filtered children for given variable
96      */

97     public abstract int getChildrenCount (
98         TreeModel original,
99         Variable variable
100     ) throws UnknownTypeException;
101     
102     /**
103      * Returns true if variable is leaf.
104      *
105      * @param original the original tree model
106      * @throws UnknownTypeException if this TreeModel implementation is not
107      * able to resolve dchildren for given node type
108      * @return true if node is leaf
109      */

110     public abstract boolean isLeaf (
111         TreeModel original,
112         Variable variable
113     ) throws UnknownTypeException;
114     
115     
116     // NodeModelFilter
117

118     /**
119      * Returns filterred display name for given variable.
120      *
121      * @throws ComputingException if the display name resolving process
122      * is time consuming, and the value will be updated later
123      * @throws UnknownTypeException if this NodeModel implementation is not
124      * able to resolve display name for given node type
125      * @return display name for given node
126      */

127     public abstract String JavaDoc getDisplayName (NodeModel original, Variable variable)
128     throws UnknownTypeException;
129     
130     /**
131      * Returns filterred icon for given variable.
132      *
133      * @throws ComputingException if the icon resolving process
134      * is time consuming, and the value will be updated later
135      * @throws UnknownTypeException if this NodeModel implementation is not
136      * able to resolve icon for given node type
137      * @return icon for given node
138      */

139     public abstract String JavaDoc getIconBase (NodeModel original, Variable variable)
140     throws UnknownTypeException;
141     
142     /**
143      * Returns filterred tooltip for given variable.
144      *
145      * @throws ComputingException if the tooltip resolving process
146      * is time consuming, and the value will be updated later
147      * @throws UnknownTypeException if this NodeModel implementation is not
148      * able to resolve tooltip for given node type
149      * @return tooltip for given node
150      */

151     public abstract String JavaDoc getShortDescription (NodeModel original, Variable variable)
152     throws UnknownTypeException;
153     
154     
155     // NodeActionsProviderFilter
156

157     /**
158      * Returns set of actions for given variable.
159      *
160      * @throws UnknownTypeException if this NodeActionsProvider implementation
161      * is not able to resolve actions for given node type
162      * @return set of actions for given variable
163      */

164     public abstract Action JavaDoc[] getActions (
165         NodeActionsProvider original,
166         Variable variable
167     ) throws UnknownTypeException;
168     
169     /**
170      * Performs default action for given variable.
171      *
172      * @throws UnknownTypeException if this NodeActionsProvider implementation
173      * is not able to resolve actions for given node type
174      */

175     public abstract void performDefaultAction (
176         NodeActionsProvider original,
177         Variable variable
178     ) throws UnknownTypeException;
179     
180     
181     // TableModelFilter
182

183     /**
184      * Returns filterred value to be displayed in column <code>columnID</code>
185      * and for variable <code>variable</code>. Column ID is defined in by
186      * {@link org.netbeans.spi.viewmodel.ColumnModel#getID}, and variables are defined by values returned from
187      * {@link TreeModel#getChildren}.
188      *
189      * @param original the original table model
190      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
191      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
192      * @throws ComputingException if the value is not known yet and will
193      * be computed later
194      * @throws UnknownTypeException if there is no TableModel defined for given
195      * parameter type
196      *
197      * @return value of variable representing given position in tree table.
198      */

199     public abstract Object JavaDoc getValueAt (
200         TableModel original,
201         Variable variable,
202         String JavaDoc columnID
203     ) throws UnknownTypeException;
204     
205     /**
206      * Filters original isReadOnly value from given table model.
207      *
208      * @param original the original table model
209      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
210      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
211      * @throws UnknownTypeException if there is no TableModel defined for given
212      * parameter type
213      *
214      * @return true if variable on given position is read only
215      */

216     public abstract boolean isReadOnly (
217         TableModel original,
218         Variable variable,
219         String JavaDoc columnID
220     ) throws UnknownTypeException;
221     
222     /**
223      * Changes a value displayed in column <code>columnID</code>
224      * for variable <code>variable</code>. Column ID is defined in by
225      * {@link org.netbeans.spi.viewmodel.ColumnModel#getID}, and variable are defined by values returned from
226      * {@link TreeModel#getChildren}.
227      *
228      * @param original the original table model
229      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
230      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
231      * @param value a new value of variable on given position
232      * @throws UnknownTypeException if there is no TableModel defined for given
233      * parameter type
234      */

235     public abstract void setValueAt (
236         TableModel original,
237         Variable variable,
238         String JavaDoc columnID,
239         Object JavaDoc value
240     ) throws UnknownTypeException;
241 }
242
Popular Tags