KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

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

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

59     public boolean isFocusTraversable(JComboBox JavaDoc a) {
60         boolean returnValue =
61             ((ComboBoxUI JavaDoc) (uis.elementAt(0))).isFocusTraversable(a);
62         for (int i = 1; i < uis.size(); i++) {
63             ((ComboBoxUI JavaDoc) (uis.elementAt(i))).isFocusTraversable(a);
64         }
65         return returnValue;
66     }
67
68     /**
69      * Invokes the <code>setPopupVisible</code> method on each UI handled by this object.
70      */

71     public void setPopupVisible(JComboBox JavaDoc a, boolean b) {
72         for (int i = 0; i < uis.size(); i++) {
73             ((ComboBoxUI JavaDoc) (uis.elementAt(i))).setPopupVisible(a,b);
74         }
75     }
76
77     /**
78      * Invokes the <code>isPopupVisible</code> method on each UI handled by this object.
79      *
80      * @return the value obtained from the first UI, which is
81      * the UI obtained from the default <code>LookAndFeel</code>
82      */

83     public boolean isPopupVisible(JComboBox JavaDoc a) {
84         boolean returnValue =
85             ((ComboBoxUI JavaDoc) (uis.elementAt(0))).isPopupVisible(a);
86         for (int i = 1; i < uis.size(); i++) {
87             ((ComboBoxUI JavaDoc) (uis.elementAt(i))).isPopupVisible(a);
88         }
89         return returnValue;
90     }
91
92 ////////////////////
93
// ComponentUI methods
94
////////////////////
95

96     /**
97      * Invokes the <code>contains</code> method on each UI handled by this object.
98      *
99      * @return the value obtained from the first UI, which is
100      * the UI obtained from the default <code>LookAndFeel</code>
101      */

102     public boolean contains(JComponent JavaDoc a, int b, int c) {
103         boolean returnValue =
104             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
105         for (int i = 1; i < uis.size(); i++) {
106             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
107         }
108         return returnValue;
109     }
110
111     /**
112      * Invokes the <code>update</code> method on each UI handled by this object.
113      */

114     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
115         for (int i = 0; i < uis.size(); i++) {
116             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
117         }
118     }
119
120     /**
121      * Returns a multiplexing UI instance if any of the auxiliary
122      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
123      * UI object obtained from the default <code>LookAndFeel</code>.
124      */

125     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
126         ComponentUI JavaDoc mui = new MultiComboBoxUI JavaDoc();
127         return MultiLookAndFeel.createUIs(mui,
128                                           ((MultiComboBoxUI JavaDoc) mui).uis,
129                                           a);
130     }
131
132     /**
133      * Invokes the <code>installUI</code> method on each UI handled by this object.
134      */

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

144     public void uninstallUI(JComponent JavaDoc a) {
145         for (int i = 0; i < uis.size(); i++) {
146             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
147         }
148     }
149
150     /**
151      * Invokes the <code>paint</code> method on each UI handled by this object.
152      */

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

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

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

195     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
196         Dimension JavaDoc returnValue =
197             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
198         for (int i = 1; i < uis.size(); i++) {
199             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
200         }
201         return returnValue;
202     }
203
204     /**
205      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
206      *
207      * @return the value obtained from the first UI, which is
208      * the UI obtained from the default <code>LookAndFeel</code>
209      */

210     public int getAccessibleChildrenCount(JComponent JavaDoc a) {
211         int returnValue =
212             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
213         for (int i = 1; i < uis.size(); i++) {
214             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
215         }
216         return returnValue;
217     }
218
219     /**
220      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
221      *
222      * @return the value obtained from the first UI, which is
223      * the UI obtained from the default <code>LookAndFeel</code>
224      */

225     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
226         Accessible JavaDoc returnValue =
227             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
228         for (int i = 1; i < uis.size(); i++) {
229             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
230         }
231         return returnValue;
232     }
233 }
234
Popular Tags