KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultiToolBarUI.java 1.28 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.ToolBarUI JavaDoc;
11 import javax.swing.plaf.ComponentUI JavaDoc;
12 import javax.swing.JComponent JavaDoc;
13 import java.awt.Graphics JavaDoc;
14 import java.awt.Dimension JavaDoc;
15 import javax.accessibility.Accessible JavaDoc;
16
17 /**
18  * A multiplexing UI used to combine <code>ToolBarUI</code>s.
19  *
20  * <p>This file was automatically generated by AutoMulti.
21  *
22  * @version 1.28 12/19/03 17:39:45
23  * @author Otto Multey
24  */

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

33     protected Vector JavaDoc uis = new Vector JavaDoc();
34
35 ////////////////////
36
// Common UI methods
37
////////////////////
38

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

44     public ComponentUI JavaDoc[] getUIs() {
45         return MultiLookAndFeel.uisToArray(uis);
46     }
47
48 ////////////////////
49
// ToolBarUI methods
50
////////////////////
51

52 ////////////////////
53
// ComponentUI methods
54
////////////////////
55

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

62     public boolean contains(JComponent JavaDoc a, int b, int c) {
63         boolean returnValue =
64             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
65         for (int i = 1; i < uis.size(); i++) {
66             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
67         }
68         return returnValue;
69     }
70
71     /**
72      * Invokes the <code>update</code> method on each UI handled by this object.
73      */

74     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
75         for (int i = 0; i < uis.size(); i++) {
76             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
77         }
78     }
79
80     /**
81      * Returns a multiplexing UI instance if any of the auxiliary
82      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
83      * UI object obtained from the default <code>LookAndFeel</code>.
84      */

85     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
86         ComponentUI JavaDoc mui = new MultiToolBarUI JavaDoc();
87         return MultiLookAndFeel.createUIs(mui,
88                                           ((MultiToolBarUI JavaDoc) mui).uis,
89                                           a);
90     }
91
92     /**
93      * Invokes the <code>installUI</code> method on each UI handled by this object.
94      */

95     public void installUI(JComponent JavaDoc a) {
96         for (int i = 0; i < uis.size(); i++) {
97             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
98         }
99     }
100
101     /**
102      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
103      */

104     public void uninstallUI(JComponent JavaDoc a) {
105         for (int i = 0; i < uis.size(); i++) {
106             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
107         }
108     }
109
110     /**
111      * Invokes the <code>paint</code> method on each UI handled by this object.
112      */

113     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
114         for (int i = 0; i < uis.size(); i++) {
115             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
116         }
117     }
118
119     /**
120      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
121      *
122      * @return the value obtained from the first UI, which is
123      * the UI obtained from the default <code>LookAndFeel</code>
124      */

125     public Dimension JavaDoc getPreferredSize(JComponent JavaDoc a) {
126         Dimension JavaDoc returnValue =
127             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
128         for (int i = 1; i < uis.size(); i++) {
129             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
130         }
131         return returnValue;
132     }
133
134     /**
135      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
136      *
137      * @return the value obtained from the first UI, which is
138      * the UI obtained from the default <code>LookAndFeel</code>
139      */

140     public Dimension JavaDoc getMinimumSize(JComponent JavaDoc a) {
141         Dimension JavaDoc returnValue =
142             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
143         for (int i = 1; i < uis.size(); i++) {
144             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
145         }
146         return returnValue;
147     }
148
149     /**
150      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
151      *
152      * @return the value obtained from the first UI, which is
153      * the UI obtained from the default <code>LookAndFeel</code>
154      */

155     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
156         Dimension JavaDoc returnValue =
157             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
158         for (int i = 1; i < uis.size(); i++) {
159             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
160         }
161         return returnValue;
162     }
163
164     /**
165      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
166      *
167      * @return the value obtained from the first UI, which is
168      * the UI obtained from the default <code>LookAndFeel</code>
169      */

170     public int getAccessibleChildrenCount(JComponent JavaDoc a) {
171         int returnValue =
172             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
173         for (int i = 1; i < uis.size(); i++) {
174             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
175         }
176         return returnValue;
177     }
178
179     /**
180      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
181      *
182      * @return the value obtained from the first UI, which is
183      * the UI obtained from the default <code>LookAndFeel</code>
184      */

185     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
186         Accessible JavaDoc returnValue =
187             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
188         for (int i = 1; i < uis.size(); i++) {
189             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
190         }
191         return returnValue;
192     }
193 }
194
Popular Tags