KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultiFileChooserUI.java 1.26 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.FileChooserUI JavaDoc;
11 import javax.swing.filechooser.FileFilter JavaDoc;
12 import javax.swing.JFileChooser JavaDoc;
13 import javax.swing.filechooser.FileView JavaDoc;
14 import java.lang.String JavaDoc;
15 import java.io.File JavaDoc;
16 import javax.swing.plaf.ComponentUI JavaDoc;
17 import javax.swing.JComponent JavaDoc;
18 import java.awt.Graphics JavaDoc;
19 import java.awt.Dimension JavaDoc;
20 import javax.accessibility.Accessible JavaDoc;
21
22 /**
23  * A multiplexing UI used to combine <code>FileChooserUI</code>s.
24  *
25  * <p>This file was automatically generated by AutoMulti.
26  *
27  * @version 1.26 12/19/03 17:39:31
28  * @author Otto Multey
29  */

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

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

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

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

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

63     public FileFilter JavaDoc getAcceptAllFileFilter(JFileChooser JavaDoc a) {
64         FileFilter JavaDoc returnValue =
65             ((FileChooserUI JavaDoc) (uis.elementAt(0))).getAcceptAllFileFilter(a);
66         for (int i = 1; i < uis.size(); i++) {
67             ((FileChooserUI JavaDoc) (uis.elementAt(i))).getAcceptAllFileFilter(a);
68         }
69         return returnValue;
70     }
71
72     /**
73      * Invokes the <code>getFileView</code> method on each UI handled by this object.
74      *
75      * @return the value obtained from the first UI, which is
76      * the UI obtained from the default <code>LookAndFeel</code>
77      */

78     public FileView JavaDoc getFileView(JFileChooser JavaDoc a) {
79         FileView JavaDoc returnValue =
80             ((FileChooserUI JavaDoc) (uis.elementAt(0))).getFileView(a);
81         for (int i = 1; i < uis.size(); i++) {
82             ((FileChooserUI JavaDoc) (uis.elementAt(i))).getFileView(a);
83         }
84         return returnValue;
85     }
86
87     /**
88      * Invokes the <code>getApproveButtonText</code> method on each UI handled by this object.
89      *
90      * @return the value obtained from the first UI, which is
91      * the UI obtained from the default <code>LookAndFeel</code>
92      */

93     public String JavaDoc getApproveButtonText(JFileChooser JavaDoc a) {
94         String JavaDoc returnValue =
95             ((FileChooserUI JavaDoc) (uis.elementAt(0))).getApproveButtonText(a);
96         for (int i = 1; i < uis.size(); i++) {
97             ((FileChooserUI JavaDoc) (uis.elementAt(i))).getApproveButtonText(a);
98         }
99         return returnValue;
100     }
101
102     /**
103      * Invokes the <code>getDialogTitle</code> method on each UI handled by this object.
104      *
105      * @return the value obtained from the first UI, which is
106      * the UI obtained from the default <code>LookAndFeel</code>
107      */

108     public String JavaDoc getDialogTitle(JFileChooser JavaDoc a) {
109         String JavaDoc returnValue =
110             ((FileChooserUI JavaDoc) (uis.elementAt(0))).getDialogTitle(a);
111         for (int i = 1; i < uis.size(); i++) {
112             ((FileChooserUI JavaDoc) (uis.elementAt(i))).getDialogTitle(a);
113         }
114         return returnValue;
115     }
116
117     /**
118      * Invokes the <code>rescanCurrentDirectory</code> method on each UI handled by this object.
119      */

120     public void rescanCurrentDirectory(JFileChooser JavaDoc a) {
121         for (int i = 0; i < uis.size(); i++) {
122             ((FileChooserUI JavaDoc) (uis.elementAt(i))).rescanCurrentDirectory(a);
123         }
124     }
125
126     /**
127      * Invokes the <code>ensureFileIsVisible</code> method on each UI handled by this object.
128      */

129     public void ensureFileIsVisible(JFileChooser JavaDoc a, File JavaDoc b) {
130         for (int i = 0; i < uis.size(); i++) {
131             ((FileChooserUI JavaDoc) (uis.elementAt(i))).ensureFileIsVisible(a,b);
132         }
133     }
134
135 ////////////////////
136
// ComponentUI methods
137
////////////////////
138

139     /**
140      * Invokes the <code>contains</code> method on each UI handled by this object.
141      *
142      * @return the value obtained from the first UI, which is
143      * the UI obtained from the default <code>LookAndFeel</code>
144      */

145     public boolean contains(JComponent JavaDoc a, int b, int c) {
146         boolean returnValue =
147             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
148         for (int i = 1; i < uis.size(); i++) {
149             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
150         }
151         return returnValue;
152     }
153
154     /**
155      * Invokes the <code>update</code> method on each UI handled by this object.
156      */

157     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
158         for (int i = 0; i < uis.size(); i++) {
159             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
160         }
161     }
162
163     /**
164      * Returns a multiplexing UI instance if any of the auxiliary
165      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
166      * UI object obtained from the default <code>LookAndFeel</code>.
167      */

168     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
169         ComponentUI JavaDoc mui = new MultiFileChooserUI JavaDoc();
170         return MultiLookAndFeel.createUIs(mui,
171                                           ((MultiFileChooserUI JavaDoc) mui).uis,
172                                           a);
173     }
174
175     /**
176      * Invokes the <code>installUI</code> method on each UI handled by this object.
177      */

178     public void installUI(JComponent JavaDoc a) {
179         for (int i = 0; i < uis.size(); i++) {
180             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
181         }
182     }
183
184     /**
185      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
186      */

187     public void uninstallUI(JComponent JavaDoc a) {
188         for (int i = 0; i < uis.size(); i++) {
189             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
190         }
191     }
192
193     /**
194      * Invokes the <code>paint</code> method on each UI handled by this object.
195      */

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

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

223     public Dimension JavaDoc getMinimumSize(JComponent JavaDoc a) {
224         Dimension JavaDoc returnValue =
225             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
226         for (int i = 1; i < uis.size(); i++) {
227             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
228         }
229         return returnValue;
230     }
231
232     /**
233      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
234      *
235      * @return the value obtained from the first UI, which is
236      * the UI obtained from the default <code>LookAndFeel</code>
237      */

238     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
239         Dimension JavaDoc returnValue =
240             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
241         for (int i = 1; i < uis.size(); i++) {
242             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
243         }
244         return returnValue;
245     }
246
247     /**
248      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
249      *
250      * @return the value obtained from the first UI, which is
251      * the UI obtained from the default <code>LookAndFeel</code>
252      */

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

268     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
269         Accessible JavaDoc returnValue =
270             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
271         for (int i = 1; i < uis.size(); i++) {
272             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
273         }
274         return returnValue;
275     }
276 }
277
Popular Tags