KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultiListUI.java 1.27 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.ListUI JavaDoc;
11 import javax.swing.JList JavaDoc;
12 import java.awt.Point JavaDoc;
13 import java.awt.Rectangle 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>ListUI</code>s.
22  *
23  * <p>This file was automatically generated by AutoMulti.
24  *
25  * @version 1.27 12/19/03 17:39:33
26  * @author Otto Multey
27  */

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

55     /**
56      * Invokes the <code>locationToIndex</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 int locationToIndex(JList JavaDoc a, Point JavaDoc b) {
62         int returnValue =
63             ((ListUI JavaDoc) (uis.elementAt(0))).locationToIndex(a,b);
64         for (int i = 1; i < uis.size(); i++) {
65             ((ListUI JavaDoc) (uis.elementAt(i))).locationToIndex(a,b);
66         }
67         return returnValue;
68     }
69
70     /**
71      * Invokes the <code>indexToLocation</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 Point JavaDoc indexToLocation(JList JavaDoc a, int b) {
77         Point JavaDoc returnValue =
78             ((ListUI JavaDoc) (uis.elementAt(0))).indexToLocation(a,b);
79         for (int i = 1; i < uis.size(); i++) {
80             ((ListUI JavaDoc) (uis.elementAt(i))).indexToLocation(a,b);
81         }
82         return returnValue;
83     }
84
85     /**
86      * Invokes the <code>getCellBounds</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 Rectangle JavaDoc getCellBounds(JList JavaDoc a, int b, int c) {
92         Rectangle JavaDoc returnValue =
93             ((ListUI JavaDoc) (uis.elementAt(0))).getCellBounds(a,b,c);
94         for (int i = 1; i < uis.size(); i++) {
95             ((ListUI JavaDoc) (uis.elementAt(i))).getCellBounds(a,b,c);
96         }
97         return returnValue;
98     }
99
100 ////////////////////
101
// ComponentUI methods
102
////////////////////
103

104     /**
105      * Invokes the <code>contains</code> method on each UI handled by this object.
106      *
107      * @return the value obtained from the first UI, which is
108      * the UI obtained from the default <code>LookAndFeel</code>
109      */

110     public boolean contains(JComponent JavaDoc a, int b, int c) {
111         boolean returnValue =
112             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
113         for (int i = 1; i < uis.size(); i++) {
114             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
115         }
116         return returnValue;
117     }
118
119     /**
120      * Invokes the <code>update</code> method on each UI handled by this object.
121      */

122     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
123         for (int i = 0; i < uis.size(); i++) {
124             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
125         }
126     }
127
128     /**
129      * Returns a multiplexing UI instance if any of the auxiliary
130      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
131      * UI object obtained from the default <code>LookAndFeel</code>.
132      */

133     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
134         ComponentUI JavaDoc mui = new MultiListUI JavaDoc();
135         return MultiLookAndFeel.createUIs(mui,
136                                           ((MultiListUI JavaDoc) mui).uis,
137                                           a);
138     }
139
140     /**
141      * Invokes the <code>installUI</code> method on each UI handled by this object.
142      */

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

152     public void uninstallUI(JComponent JavaDoc a) {
153         for (int i = 0; i < uis.size(); i++) {
154             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
155         }
156     }
157
158     /**
159      * Invokes the <code>paint</code> method on each UI handled by this object.
160      */

161     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
162         for (int i = 0; i < uis.size(); i++) {
163             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
164         }
165     }
166
167     /**
168      * Invokes the <code>getPreferredSize</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 getPreferredSize(JComponent JavaDoc a) {
174         Dimension JavaDoc returnValue =
175             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
176         for (int i = 1; i < uis.size(); i++) {
177             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
178         }
179         return returnValue;
180     }
181
182     /**
183      * Invokes the <code>getMinimumSize</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 getMinimumSize(JComponent JavaDoc a) {
189         Dimension JavaDoc returnValue =
190             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
191         for (int i = 1; i < uis.size(); i++) {
192             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
193         }
194         return returnValue;
195     }
196
197     /**
198      * Invokes the <code>getMaximumSize</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 Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
204         Dimension JavaDoc returnValue =
205             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
206         for (int i = 1; i < uis.size(); i++) {
207             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
208         }
209         return returnValue;
210     }
211
212     /**
213      * Invokes the <code>getAccessibleChildrenCount</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 int getAccessibleChildrenCount(JComponent JavaDoc a) {
219         int returnValue =
220             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
221         for (int i = 1; i < uis.size(); i++) {
222             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
223         }
224         return returnValue;
225     }
226
227     /**
228      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
229      *
230      * @return the value obtained from the first UI, which is
231      * the UI obtained from the default <code>LookAndFeel</code>
232      */

233     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
234         Accessible JavaDoc returnValue =
235             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
236         for (int i = 1; i < uis.size(); i++) {
237             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
238         }
239         return returnValue;
240     }
241 }
242
Popular Tags