1 |
/* BasicTreeUI.java |
/* BasicTreeUI.java |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
38 |
|
|
39 |
package javax.swing.plaf.basic; |
package javax.swing.plaf.basic; |
40 |
|
|
41 |
import javax.swing.plaf.*; |
import java.awt.Rectangle; |
42 |
|
import javax.swing.JTree; |
43 |
public class BasicTreeUI extends TreeUI |
import javax.swing.plaf.TreeUI; |
44 |
|
import javax.swing.tree.TreePath; |
45 |
|
|
46 |
|
|
47 |
|
/** |
48 |
|
* A delegate providing the user interface for <code>JTree</code> |
49 |
|
* according to the Basic look and feel. The current implementation |
50 |
|
* of GNU Classpath does really work; it is just a stub that allows |
51 |
|
* compiling the code. |
52 |
|
* |
53 |
|
* @see javax.swing.JTree |
54 |
|
* |
55 |
|
* @author Sascha Brawer (brawer@dandelis.ch) |
56 |
|
*/ |
57 |
|
public class BasicTreeUI |
58 |
|
extends TreeUI |
59 |
{ |
{ |
60 |
|
/** |
61 |
|
* Determines the geometric extent of the label that is |
62 |
|
* drawn for a path. |
63 |
|
* |
64 |
|
* @param tree the <code>JTree</code> for which this delegate |
65 |
|
* object provides the user interface. |
66 |
|
* |
67 |
|
* @param path the path whose label extent is requested. |
68 |
|
* |
69 |
|
* @return a rectangle enclosing the label, or <code>null</code> |
70 |
|
* if <code>path</code> contains invalid nodes. |
71 |
|
*/ |
72 |
|
public Rectangle getPathBounds(JTree tree, TreePath path) |
73 |
|
{ |
74 |
|
return null; // FIXME: not implemented |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
/** |
79 |
|
* Creates a <code>TreePath</code> for the specified row. |
80 |
|
* |
81 |
|
* @param tree the <code>JTree</code> for which this delegate |
82 |
|
* object provides the user interface. |
83 |
|
* |
84 |
|
* @param row the index of the row, which should be a number |
85 |
|
* in the range <code>[0, getRowCount(tree) - 1]</code>. |
86 |
|
* |
87 |
|
* @return a <code>TreePath</code> for the specified row, or |
88 |
|
* <code>null</code> if <code>row</code> is outside |
89 |
|
* the valid range. |
90 |
|
*/ |
91 |
|
public TreePath getPathForRow(JTree tree, int row) |
92 |
|
{ |
93 |
|
return null; // FIXME: not implemented |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
/** |
98 |
|
* Determines in which row a <code>TreePath</code> is currently |
99 |
|
* being displayed. |
100 |
|
* |
101 |
|
* @param tree the <code>JTree</code> for which this delegate |
102 |
|
* object provides the user interface. |
103 |
|
* |
104 |
|
* @param path the path for which the caller wants to know |
105 |
|
* in which row it is being displayed. |
106 |
|
* |
107 |
|
* @return a number in the range <code>[0, getRowCount(tree) |
108 |
|
* - 1]</code> if the path is currently on display; |
109 |
|
* <code>-1</code> if the path is not shown to the |
110 |
|
* user. |
111 |
|
*/ |
112 |
|
public int getRowForPath(JTree tree, TreePath path) |
113 |
|
{ |
114 |
|
return -1; // FIXME: not implemented |
115 |
|
} |
116 |
|
|
117 |
|
|
118 |
|
/** |
119 |
|
* Counts how many rows are currently displayed. |
120 |
|
* |
121 |
|
* @param tree the <code>JTree</code> for which this delegate |
122 |
|
* object provides the user interface. |
123 |
|
* |
124 |
|
* @return the number of visible rows. |
125 |
|
*/ |
126 |
|
public int getRowCount(JTree tree) |
127 |
|
{ |
128 |
|
return 0; // FIXME: not implemented |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
/** |
133 |
|
* Finds the path that is closest to the specified position. |
134 |
|
* |
135 |
|
* <p><img src="../TreeUI-1.png" width="300" height="250" |
136 |
|
* alt="[A screen shot of a JTree] /> |
137 |
|
* |
138 |
|
* <p>As shown by the above illustration, the bounds of the |
139 |
|
* closest path do not necessarily need to contain the passed |
140 |
|
* location. |
141 |
|
* |
142 |
|
* @param tree the <code>JTree</code> for which this delegate |
143 |
|
* object provides the user interface. |
144 |
|
* |
145 |
|
* @param x the horizontal location, relative to the origin |
146 |
|
* of <code>tree</code>. |
147 |
|
* |
148 |
|
* @param y the vertical location, relative to the origin |
149 |
|
* of <code>tree</code>. |
150 |
|
* |
151 |
|
* @return the closest path, or <code>null</code> if the |
152 |
|
* tree is currenlty not displaying any paths at all. |
153 |
|
*/ |
154 |
|
public TreePath getClosesPathForLocation(JTree tree, |
155 |
|
int x, int y) |
156 |
|
{ |
157 |
|
return null; // FIXME: not implemented |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
/** |
162 |
|
* Determines whether the user is currently editing a tree cell. |
163 |
|
* |
164 |
|
* @param tree the <code>JTree</code> for which this delegate |
165 |
|
* object provides the user interface. |
166 |
|
* |
167 |
|
* @see #getEditingPath |
168 |
|
*/ |
169 |
|
public boolean isEditing(JTree tree) |
170 |
|
{ |
171 |
|
return false; // FIXME: not implemented |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
/** |
176 |
|
* Stops editing a tree cell, committing the entered value into the |
177 |
|
* tree’s model. If no editing session is active, or if the |
178 |
|
* active editor does not agree to stopping, nothing happens. In |
179 |
|
* some look and feels, this action happens when the user has |
180 |
|
* pressed the enter key. |
181 |
|
* |
182 |
|
* @param tree the <code>JTree</code> for which this delegate |
183 |
|
* object provides the user interface. |
184 |
|
* |
185 |
|
* @return <code>false</code> if the editing still goes on because |
186 |
|
* the cell editor has objected to stopping the session; |
187 |
|
* <code>true</code> if editing has been stopped. |
188 |
|
*/ |
189 |
|
public boolean stopEditing(JTree tree) |
190 |
|
{ |
191 |
|
return true; // FIXME: not implemented |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
/** |
196 |
|
* Cancels editing a tree cell, discarding any entered value. |
197 |
|
* If no editing session is active, nothing happens. The cell |
198 |
|
* editor is not given an opportunity to veto the canceling. |
199 |
|
* In some look and feels, this action happens when the user has |
200 |
|
* pressed the escape key. |
201 |
|
* |
202 |
|
* @param tree the <code>JTree</code> for which this delegate |
203 |
|
* object provides the user interface. |
204 |
|
*/ |
205 |
|
public void cancelEditing(JTree tree) |
206 |
|
{ |
207 |
|
// FIXME: not implemented |
208 |
|
} |
209 |
|
|
210 |
|
|
211 |
|
/** |
212 |
|
* Starts a session to edit a tree cell. If the cell editor |
213 |
|
* rejects editing the cell, it will just be selected. |
214 |
|
* |
215 |
|
* @param tree the <code>JTree</code> for which this delegate |
216 |
|
* object provides the user interface. |
217 |
|
* |
218 |
|
* @param path the cell to edit. |
219 |
|
*/ |
220 |
|
public void startEditingAtPath(JTree tree, TreePath path) |
221 |
|
{ |
222 |
|
// FIXME: not implemented |
223 |
|
} |
224 |
|
|
225 |
|
|
226 |
|
/** |
227 |
|
* Retrieves the tree cell that is currently being edited. |
228 |
|
* |
229 |
|
* @return the currently edited path, or <code>null</code> |
230 |
|
* if no editing session is currently active. |
231 |
|
*/ |
232 |
|
public TreePath getEditingPath(JTree tree) |
233 |
|
{ |
234 |
|
return null; // FIXME: not implemented |
235 |
|
} |
236 |
} |
} |