1 /* BasicTreeUI.java 2 Copyright (C) 2002, 2003 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 39 package javax.swing.plaf.basic; 40 41 import java.awt.Rectangle; 42 import javax.swing.JTree; 43 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 */ getPathBounds(JTree tree, TreePath path)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 */ getPathForRow(JTree tree, int row)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 */ getRowForPath(JTree tree, TreePath path)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 */ getRowCount(JTree tree)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="../doc-files/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 */ getClosestPathForLocation(JTree tree, int x, int y)154 public TreePath getClosestPathForLocation(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 */ isEditing(JTree tree)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 */ stopEditing(JTree tree)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 */ cancelEditing(JTree tree)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 */ startEditingAtPath(JTree tree, TreePath path)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 */ getEditingPath(JTree tree)232 public TreePath getEditingPath(JTree tree) 233 { 234 return null; // FIXME: not implemented 235 } 236 } 237