KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Default "empty" implementation of {@link VariablesFilter} returns original
33  * values (name, icon, fields, ...) for given variable.
34  *
35  * @author Jan Jancura
36  */

37 public abstract class VariablesFilterAdapter extends VariablesFilter {
38     
39
40     /**
41      * Returns set of fully quilified class names (like java.lang.String) this
42      * filter is registerred to.
43      *
44      * @return set of fully quilified class names
45      */

46     public abstract String JavaDoc[] getSupportedAncestors ();
47     
48     /**
49      * Returns set of fully quilified class names (like java.lang.String) this
50      * filter is registerred to.
51      *
52      * @return set of fully quilified class names
53      */

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

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

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

109     public boolean isLeaf (
110         TreeModel original,
111         Variable variable
112     ) throws UnknownTypeException {
113         return original.isLeaf (variable);
114     }
115     
116     
117     // NodeModelFilter
118

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

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

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

156     public String JavaDoc getShortDescription (NodeModel original, Variable variable)
157     throws UnknownTypeException {
158         return original.getShortDescription (variable);
159     }
160     
161     
162     // NodeActionsProviderFilter
163

164     /**
165      * Returns set of actions for given variable.
166      *
167      * @throws UnknownTypeException if this NodeActionsProvider implementation
168      * is not able to resolve actions for given node type
169      * @return set of actions for given variable
170      */

171     public Action JavaDoc[] getActions (
172         NodeActionsProvider original,
173         Variable variable
174     ) throws UnknownTypeException {
175         return original.getActions (variable);
176     }
177     
178     /**
179      * Performs default action for given variable.
180      *
181      * @throws UnknownTypeException if this NodeActionsProvider implementation
182      * is not able to resolve actions for given node type
183      */

184     public void performDefaultAction (
185         NodeActionsProvider original,
186         Variable variable
187     ) throws UnknownTypeException {
188         original.performDefaultAction (variable);
189     }
190     
191     
192     // TableModelFilter
193

194     /**
195      * Returns filterred value to be displayed in column <code>columnID</code>
196      * and for variable <code>variable</code>. Column ID is defined in by
197      * {@link org.netbeans.spi.viewmodel.ColumnModel#getID}, and variables are defined by values returned from
198      * {@link TreeModel#getChildren}.
199      *
200      * @param original the original table model
201      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
202      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
203      * @throws ComputingException if the value is not known yet and will
204      * be computed later
205      * @throws UnknownTypeException if there is no TableModel defined for given
206      * parameter type
207      *
208      * @return value of variable representing given position in tree table.
209      */

210     public Object JavaDoc getValueAt (
211         TableModel original,
212         Variable variable,
213         String JavaDoc columnID
214     ) throws UnknownTypeException {
215         return original.getValueAt (variable, columnID);
216     }
217     
218     /**
219      * Filters original isReadOnly value from given table model.
220      *
221      * @param original the original table model
222      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
223      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
224      * @throws UnknownTypeException if there is no TableModel defined for given
225      * parameter type
226      *
227      * @return true if variable on given position is read only
228      */

229     public boolean isReadOnly (
230         TableModel original,
231         Variable variable,
232         String JavaDoc columnID
233     ) throws UnknownTypeException {
234         return original.isReadOnly (variable, columnID);
235     }
236     
237     /**
238      * Changes a value displayed in column <code>columnID</code>
239      * for variable <code>variable</code>. Column ID is defined in by
240      * {@link org.netbeans.spi.viewmodel.ColumnModel#getID}, and variable are defined by values returned from
241      * {@link TreeModel#getChildren}.
242      *
243      * @param original the original table model
244      * @param variable a variable returned from {@link TreeModel#getChildren} for this row
245      * @param columnID a id of column defined by {@link org.netbeans.spi.viewmodel.ColumnModel#getID}
246      * @param value a new value of variable on given position
247      * @throws UnknownTypeException if there is no TableModel defined for given
248      * parameter type
249      */

250     public void setValueAt (
251         TableModel original,
252         Variable variable,
253         String JavaDoc columnID,
254         Object JavaDoc value
255     ) throws UnknownTypeException {
256         original.setValueAt (variable, columnID, value);
257     }
258 }
259
Popular Tags