KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultiPopupMenuUI.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.PopupMenuUI JavaDoc;
11 import java.awt.event.MouseEvent JavaDoc;
12 import javax.swing.Popup JavaDoc;
13 import javax.swing.JPopupMenu 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>PopupMenuUI</code>s.
22  *
23  * <p>This file was automatically generated by AutoMulti.
24  *
25  * @version 1.28 12/19/03 17:39:37
26  * @author Otto Multey
27  */

28 public class MultiPopupMenuUI extends PopupMenuUI 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
// PopupMenuUI methods
53
////////////////////
54

55     /**
56      * Invokes the <code>isPopupTrigger</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 boolean isPopupTrigger(MouseEvent JavaDoc a) {
62         boolean returnValue =
63             ((PopupMenuUI JavaDoc) (uis.elementAt(0))).isPopupTrigger(a);
64         for (int i = 1; i < uis.size(); i++) {
65             ((PopupMenuUI JavaDoc) (uis.elementAt(i))).isPopupTrigger(a);
66         }
67         return returnValue;
68     }
69
70     /**
71      * Invokes the <code>getPopup</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 Popup JavaDoc getPopup(JPopupMenu JavaDoc a, int b, int c) {
77         Popup JavaDoc returnValue =
78             ((PopupMenuUI JavaDoc) (uis.elementAt(0))).getPopup(a,b,c);
79         for (int i = 1; i < uis.size(); i++) {
80             ((PopupMenuUI JavaDoc) (uis.elementAt(i))).getPopup(a,b,c);
81         }
82         return returnValue;
83     }
84
85 ////////////////////
86
// ComponentUI methods
87
////////////////////
88

89     /**
90      * Invokes the <code>contains</code> method on each UI handled by this object.
91      *
92      * @return the value obtained from the first UI, which is
93      * the UI obtained from the default <code>LookAndFeel</code>
94      */

95     public boolean contains(JComponent JavaDoc a, int b, int c) {
96         boolean returnValue =
97             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
98         for (int i = 1; i < uis.size(); i++) {
99             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
100         }
101         return returnValue;
102     }
103
104     /**
105      * Invokes the <code>update</code> method on each UI handled by this object.
106      */

107     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
108         for (int i = 0; i < uis.size(); i++) {
109             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
110         }
111     }
112
113     /**
114      * Returns a multiplexing UI instance if any of the auxiliary
115      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
116      * UI object obtained from the default <code>LookAndFeel</code>.
117      */

118     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
119         ComponentUI JavaDoc mui = new MultiPopupMenuUI JavaDoc();
120         return MultiLookAndFeel.createUIs(mui,
121                                           ((MultiPopupMenuUI JavaDoc) mui).uis,
122                                           a);
123     }
124
125     /**
126      * Invokes the <code>installUI</code> method on each UI handled by this object.
127      */

128     public void installUI(JComponent JavaDoc a) {
129         for (int i = 0; i < uis.size(); i++) {
130             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
131         }
132     }
133
134     /**
135      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
136      */

137     public void uninstallUI(JComponent JavaDoc a) {
138         for (int i = 0; i < uis.size(); i++) {
139             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
140         }
141     }
142
143     /**
144      * Invokes the <code>paint</code> method on each UI handled by this object.
145      */

146     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
147         for (int i = 0; i < uis.size(); i++) {
148             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
149         }
150     }
151
152     /**
153      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
154      *
155      * @return the value obtained from the first UI, which is
156      * the UI obtained from the default <code>LookAndFeel</code>
157      */

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

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

188     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
189         Dimension JavaDoc returnValue =
190             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
191         for (int i = 1; i < uis.size(); i++) {
192             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
193         }
194         return returnValue;
195     }
196
197     /**
198      * Invokes the <code>getAccessibleChildrenCount</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 int getAccessibleChildrenCount(JComponent JavaDoc a) {
204         int returnValue =
205             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
206         for (int i = 1; i < uis.size(); i++) {
207             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
208         }
209         return returnValue;
210     }
211
212     /**
213      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
214      *
215      * @return the value obtained from the first UI, which is
216      * the UI obtained from the default <code>LookAndFeel</code>
217      */

218     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
219         Accessible JavaDoc returnValue =
220             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
221         for (int i = 1; i < uis.size(); i++) {
222             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
223         }
224         return returnValue;
225     }
226 }
227
Popular Tags