KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > multi > MultiTreeUI


1 /*
2  * @(#)MultiTreeUI.java 1.32 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 package javax.swing.plaf.multi;
8
9 import java.util.Vector JavaDoc;
10 import javax.swing.plaf.TreeUI JavaDoc;
11 import java.awt.Rectangle JavaDoc;
12 import javax.swing.JTree JavaDoc;
13 import javax.swing.tree.TreePath JavaDoc;
14 import javax.swing.plaf.ComponentUI JavaDoc;
15 import javax.swing.JComponent JavaDoc;
16 import java.awt.Graphics JavaDoc;
17 import java.awt.Dimension JavaDoc;
18 import javax.accessibility.Accessible JavaDoc;
19
20 /**
21  * A multiplexing UI used to combine <code>TreeUI</code>s.
22  *
23  * <p>This file was automatically generated by AutoMulti.
24  *
25  * @version 1.32 12/19/03 17:39:46
26  * @author Otto Multey
27  */

28 public class MultiTreeUI extends TreeUI JavaDoc {
29
30     /**
31      * The vector containing the real UIs. This is populated
32      * in the call to <code>createUI</code>, and can be obtained by calling
33      * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
34      * obtained from the default look and feel.
35      */

36     protected Vector JavaDoc uis = new Vector JavaDoc();
37
38 ////////////////////
39
// Common UI methods
40
////////////////////
41

42     /**
43      * Returns the list of UIs associated with this multiplexing UI. This
44      * allows processing of the UIs by an application aware of multiplexing
45      * UIs on components.
46      */

47     public ComponentUI JavaDoc[] getUIs() {
48         return MultiLookAndFeel.uisToArray(uis);
49     }
50
51 ////////////////////
52
// TreeUI methods
53
////////////////////
54

55     /**
56      * Invokes the <code>getPathBounds</code> method on each UI handled by this object.
57      *
58      * @return the value obtained from the first UI, which is
59      * the UI obtained from the default <code>LookAndFeel</code>
60      */

61     public Rectangle JavaDoc getPathBounds(JTree JavaDoc a, TreePath JavaDoc b) {
62         Rectangle JavaDoc returnValue =
63             ((TreeUI JavaDoc) (uis.elementAt(0))).getPathBounds(a,b);
64         for (int i = 1; i < uis.size(); i++) {
65             ((TreeUI JavaDoc) (uis.elementAt(i))).getPathBounds(a,b);
66         }
67         return returnValue;
68     }
69
70     /**
71      * Invokes the <code>getPathForRow</code> method on each UI handled by this object.
72      *
73      * @return the value obtained from the first UI, which is
74      * the UI obtained from the default <code>LookAndFeel</code>
75      */

76     public TreePath JavaDoc getPathForRow(JTree JavaDoc a, int b) {
77         TreePath JavaDoc returnValue =
78             ((TreeUI JavaDoc) (uis.elementAt(0))).getPathForRow(a,b);
79         for (int i = 1; i < uis.size(); i++) {
80             ((TreeUI JavaDoc) (uis.elementAt(i))).getPathForRow(a,b);
81         }
82         return returnValue;
83     }
84
85     /**
86      * Invokes the <code>getRowForPath</code> method on each UI handled by this object.
87      *
88      * @return the value obtained from the first UI, which is
89      * the UI obtained from the default <code>LookAndFeel</code>
90      */

91     public int getRowForPath(JTree JavaDoc a, TreePath JavaDoc b) {
92         int returnValue =
93             ((TreeUI JavaDoc) (uis.elementAt(0))).getRowForPath(a,b);
94         for (int i = 1; i < uis.size(); i++) {
95             ((TreeUI JavaDoc) (uis.elementAt(i))).getRowForPath(a,b);
96         }
97         return returnValue;
98     }
99
100     /**
101      * Invokes the <code>getRowCount</code> method on each UI handled by this object.
102      *
103      * @return the value obtained from the first UI, which is
104      * the UI obtained from the default <code>LookAndFeel</code>
105      */

106     public int getRowCount(JTree JavaDoc a) {
107         int returnValue =
108             ((TreeUI JavaDoc) (uis.elementAt(0))).getRowCount(a);
109         for (int i = 1; i < uis.size(); i++) {
110             ((TreeUI JavaDoc) (uis.elementAt(i))).getRowCount(a);
111         }
112         return returnValue;
113     }
114
115     /**
116      * Invokes the <code>getClosestPathForLocation</code> method on each UI handled by this object.
117      *
118      * @return the value obtained from the first UI, which is
119      * the UI obtained from the default <code>LookAndFeel</code>
120      */

121     public TreePath JavaDoc getClosestPathForLocation(JTree JavaDoc a, int b, int c) {
122         TreePath JavaDoc returnValue =
123             ((TreeUI JavaDoc) (uis.elementAt(0))).getClosestPathForLocation(a,b,c);
124         for (int i = 1; i < uis.size(); i++) {
125             ((TreeUI JavaDoc) (uis.elementAt(i))).getClosestPathForLocation(a,b,c);
126         }
127         return returnValue;
128     }
129
130     /**
131      * Invokes the <code>isEditing</code> method on each UI handled by this object.
132      *
133      * @return the value obtained from the first UI, which is
134      * the UI obtained from the default <code>LookAndFeel</code>
135      */

136     public boolean isEditing(JTree JavaDoc a) {
137         boolean returnValue =
138             ((TreeUI JavaDoc) (uis.elementAt(0))).isEditing(a);
139         for (int i = 1; i < uis.size(); i++) {
140             ((TreeUI JavaDoc) (uis.elementAt(i))).isEditing(a);
141         }
142         return returnValue;
143     }
144
145     /**
146      * Invokes the <code>stopEditing</code> method on each UI handled by this object.
147      *
148      * @return the value obtained from the first UI, which is
149      * the UI obtained from the default <code>LookAndFeel</code>
150      */

151     public boolean stopEditing(JTree JavaDoc a) {
152         boolean returnValue =
153             ((TreeUI JavaDoc) (uis.elementAt(0))).stopEditing(a);
154         for (int i = 1; i < uis.size(); i++) {
155             ((TreeUI JavaDoc) (uis.elementAt(i))).stopEditing(a);
156         }
157         return returnValue;
158     }
159
160     /**
161      * Invokes the <code>cancelEditing</code> method on each UI handled by this object.
162      */

163     public void cancelEditing(JTree JavaDoc a) {
164         for (int i = 0; i < uis.size(); i++) {
165             ((TreeUI JavaDoc) (uis.elementAt(i))).cancelEditing(a);
166         }
167     }
168
169     /**
170      * Invokes the <code>startEditingAtPath</code> method on each UI handled by this object.
171      */

172     public void startEditingAtPath(JTree JavaDoc a, TreePath JavaDoc b) {
173         for (int i = 0; i < uis.size(); i++) {
174             ((TreeUI JavaDoc) (uis.elementAt(i))).startEditingAtPath(a,b);
175         }
176     }
177
178     /**
179      * Invokes the <code>getEditingPath</code> method on each UI handled by this object.
180      *
181      * @return the value obtained from the first UI, which is
182      * the UI obtained from the default <code>LookAndFeel</code>
183      */

184     public TreePath JavaDoc getEditingPath(JTree JavaDoc a) {
185         TreePath JavaDoc returnValue =
186             ((TreeUI JavaDoc) (uis.elementAt(0))).getEditingPath(a);
187         for (int i = 1; i < uis.size(); i++) {
188             ((TreeUI JavaDoc) (uis.elementAt(i))).getEditingPath(a);
189         }
190         return returnValue;
191     }
192
193 ////////////////////
194
// ComponentUI methods
195
////////////////////
196

197     /**
198      * Invokes the <code>contains</code> method on each UI handled by this object.
199      *
200      * @return the value obtained from the first UI, which is
201      * the UI obtained from the default <code>LookAndFeel</code>
202      */

203     public boolean contains(JComponent JavaDoc a, int b, int c) {
204         boolean returnValue =
205             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
206         for (int i = 1; i < uis.size(); i++) {
207             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
208         }
209         return returnValue;
210     }
211
212     /**
213      * Invokes the <code>update</code> method on each UI handled by this object.
214      */

215     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
216         for (int i = 0; i < uis.size(); i++) {
217             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
218         }
219     }
220
221     /**
222      * Returns a multiplexing UI instance if any of the auxiliary
223      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
224      * UI object obtained from the default <code>LookAndFeel</code>.
225      */

226     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
227         ComponentUI JavaDoc mui = new MultiTreeUI JavaDoc();
228         return MultiLookAndFeel.createUIs(mui,
229                                           ((MultiTreeUI JavaDoc) mui).uis,
230                                           a);
231     }
232
233     /**
234      * Invokes the <code>installUI</code> method on each UI handled by this object.
235      */

236     public void installUI(JComponent JavaDoc a) {
237         for (int i = 0; i < uis.size(); i++) {
238             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
239         }
240     }
241
242     /**
243      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
244      */

245     public void uninstallUI(JComponent JavaDoc a) {
246         for (int i = 0; i < uis.size(); i++) {
247             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
248         }
249     }
250
251     /**
252      * Invokes the <code>paint</code> method on each UI handled by this object.
253      */

254     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
255         for (int i = 0; i < uis.size(); i++) {
256             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
257         }
258     }
259
260     /**
261      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
262      *
263      * @return the value obtained from the first UI, which is
264      * the UI obtained from the default <code>LookAndFeel</code>
265      */

266     public Dimension JavaDoc getPreferredSize(JComponent JavaDoc a) {
267         Dimension JavaDoc returnValue =
268             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
269         for (int i = 1; i < uis.size(); i++) {
270             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
271         }
272         return returnValue;
273     }
274
275     /**
276      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
277      *
278      * @return the value obtained from the first UI, which is
279      * the UI obtained from the default <code>LookAndFeel</code>
280      */

281     public Dimension JavaDoc getMinimumSize(JComponent JavaDoc a) {
282         Dimension JavaDoc returnValue =
283             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
284         for (int i = 1; i < uis.size(); i++) {
285             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
286         }
287         return returnValue;
288     }
289
290     /**
291      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
292      *
293      * @return the value obtained from the first UI, which is
294      * the UI obtained from the default <code>LookAndFeel</code>
295      */

296     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
297         Dimension JavaDoc returnValue =
298             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
299         for (int i = 1; i < uis.size(); i++) {
300             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
301         }
302         return returnValue;
303     }
304
305     /**
306      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
307      *
308      * @return the value obtained from the first UI, which is
309      * the UI obtained from the default <code>LookAndFeel</code>
310      */

311     public int getAccessibleChildrenCount(JComponent JavaDoc a) {
312         int returnValue =
313             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
314         for (int i = 1; i < uis.size(); i++) {
315             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
316         }
317         return returnValue;
318     }
319
320     /**
321      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
322      *
323      * @return the value obtained from the first UI, which is
324      * the UI obtained from the default <code>LookAndFeel</code>
325      */

326     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
327         Accessible JavaDoc returnValue =
328             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
329         for (int i = 1; i < uis.size(); i++) {
330             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
331         }
332         return returnValue;
333     }
334 }
335
Popular Tags