KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > TreeUI


1 /*
2  * @(#)TreeUI.java 1.24 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.plaf;
9
10 import java.awt.Rectangle JavaDoc;
11 import javax.swing.JTree JavaDoc;
12 import javax.swing.tree.TreePath JavaDoc;
13
14 /**
15  * Pluggable look and feel interface for JTree.
16  *
17  * @version 1.24 12/19/03
18  * @author Rob Davis
19  * @author Scott Violet
20  */

21 public abstract class TreeUI extends ComponentUI JavaDoc
22 {
23     /**
24       * Returns the Rectangle enclosing the label portion that the
25       * last item in path will be drawn into. Will return null if
26       * any component in path is currently valid.
27       */

28     public abstract Rectangle JavaDoc getPathBounds(JTree JavaDoc tree, TreePath JavaDoc path);
29
30     /**
31       * Returns the path for passed in row. If row is not visible
32       * null is returned.
33       */

34     public abstract TreePath JavaDoc getPathForRow(JTree JavaDoc tree, int row);
35
36     /**
37       * Returns the row that the last item identified in path is visible
38       * at. Will return -1 if any of the elements in path are not
39       * currently visible.
40       */

41     public abstract int getRowForPath(JTree JavaDoc tree, TreePath JavaDoc path);
42
43     /**
44       * Returns the number of rows that are being displayed.
45       */

46     public abstract int getRowCount(JTree JavaDoc tree);
47
48     /**
49       * Returns the path to the node that is closest to x,y. If
50       * there is nothing currently visible this will return null, otherwise
51       * it'll always return a valid path. If you need to test if the
52       * returned object is exactly at x, y you should get the bounds for
53       * the returned path and test x, y against that.
54       */

55     public abstract TreePath JavaDoc getClosestPathForLocation(JTree JavaDoc tree, int x,
56                                int y);
57
58     /**
59       * Returns true if the tree is being edited. The item that is being
60       * edited can be returned by getEditingPath().
61       */

62     public abstract boolean isEditing(JTree JavaDoc tree);
63
64     /**
65       * Stops the current editing session. This has no effect if the
66       * tree isn't being edited. Returns true if the editor allows the
67       * editing session to stop.
68       */

69     public abstract boolean stopEditing(JTree JavaDoc tree);
70
71     /**
72       * Cancels the current editing session. This has no effect if the
73       * tree isn't being edited. Returns true if the editor allows the
74       * editing session to stop.
75       */

76     public abstract void cancelEditing(JTree JavaDoc tree);
77
78     /**
79       * Selects the last item in path and tries to edit it. Editing will
80       * fail if the CellEditor won't allow it for the selected item.
81       */

82     public abstract void startEditingAtPath(JTree JavaDoc tree, TreePath JavaDoc path);
83
84     /**
85      * Returns the path to the element that is being edited.
86      */

87     public abstract TreePath JavaDoc getEditingPath(JTree JavaDoc tree);
88 }
89
Popular Tags