1 /*
2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 package javax.swing.plaf.multi;
26 
27 import java.util.Vector;
28 import javax.swing.plaf.FileChooserUI;
29 import javax.swing.filechooser.FileFilter;
30 import javax.swing.JFileChooser;
31 import javax.swing.filechooser.FileView;
32 import java.lang.String;
33 import java.io.File;
34 import javax.swing.plaf.ComponentUI;
35 import javax.swing.JComponent;
36 import java.awt.Graphics;
37 import java.awt.Dimension;
38 import javax.accessibility.Accessible;
39 
40 /**
41  * A multiplexing UI used to combine <code>FileChooserUI</code>s.
42  *
43  * <p>This file was automatically generated by AutoMulti.
44  *
45  * @author  Otto Multey
46  */
47 public class MultiFileChooserUI extends FileChooserUI {
48 
49     /**
50      * The vector containing the real UIs.  This is populated
51      * in the call to <code>createUI</code>, and can be obtained by calling
52      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI
53      * obtained from the default look and feel.
54      */
55     protected Vector<ComponentUI> uis = new Vector<>();
56 
57 ////////////////////
58 // Common UI methods
59 ////////////////////
60 
61     /**
62      * Returns the list of UIs associated with this multiplexing UI.  This
63      * allows processing of the UIs by an application aware of multiplexing
64      * UIs on components.
65      *
66      * @return an array of the UI delegates
67      */
getUIs()68     public ComponentUI[] getUIs() {
69         return MultiLookAndFeel.uisToArray(uis);
70     }
71 
72 ////////////////////
73 // FileChooserUI methods
74 ////////////////////
75 
76     /**
77      * Invokes the <code>getAcceptAllFileFilter</code> method on each UI handled by this object.
78      *
79      * @return the value obtained from the first UI, which is
80      * the UI obtained from the default <code>LookAndFeel</code>
81      */
getAcceptAllFileFilter(JFileChooser a)82     public FileFilter getAcceptAllFileFilter(JFileChooser a) {
83         FileFilter returnValue =
84             ((FileChooserUI) (uis.elementAt(0))).getAcceptAllFileFilter(a);
85         for (int i = 1; i < uis.size(); i++) {
86             ((FileChooserUI) (uis.elementAt(i))).getAcceptAllFileFilter(a);
87         }
88         return returnValue;
89     }
90 
91     /**
92      * Invokes the <code>getFileView</code> method on each UI handled by this object.
93      *
94      * @return the value obtained from the first UI, which is
95      * the UI obtained from the default <code>LookAndFeel</code>
96      */
getFileView(JFileChooser a)97     public FileView getFileView(JFileChooser a) {
98         FileView returnValue =
99             ((FileChooserUI) (uis.elementAt(0))).getFileView(a);
100         for (int i = 1; i < uis.size(); i++) {
101             ((FileChooserUI) (uis.elementAt(i))).getFileView(a);
102         }
103         return returnValue;
104     }
105 
106     /**
107      * Invokes the <code>getApproveButtonText</code> method on each UI handled by this object.
108      *
109      * @return the value obtained from the first UI, which is
110      * the UI obtained from the default <code>LookAndFeel</code>
111      */
getApproveButtonText(JFileChooser a)112     public String getApproveButtonText(JFileChooser a) {
113         String returnValue =
114             ((FileChooserUI) (uis.elementAt(0))).getApproveButtonText(a);
115         for (int i = 1; i < uis.size(); i++) {
116             ((FileChooserUI) (uis.elementAt(i))).getApproveButtonText(a);
117         }
118         return returnValue;
119     }
120 
121     /**
122      * Invokes the <code>getDialogTitle</code> method on each UI handled by this object.
123      *
124      * @return the value obtained from the first UI, which is
125      * the UI obtained from the default <code>LookAndFeel</code>
126      */
getDialogTitle(JFileChooser a)127     public String getDialogTitle(JFileChooser a) {
128         String returnValue =
129             ((FileChooserUI) (uis.elementAt(0))).getDialogTitle(a);
130         for (int i = 1; i < uis.size(); i++) {
131             ((FileChooserUI) (uis.elementAt(i))).getDialogTitle(a);
132         }
133         return returnValue;
134     }
135 
136     /**
137      * Invokes the <code>rescanCurrentDirectory</code> method on each UI handled by this object.
138      */
rescanCurrentDirectory(JFileChooser a)139     public void rescanCurrentDirectory(JFileChooser a) {
140         for (int i = 0; i < uis.size(); i++) {
141             ((FileChooserUI) (uis.elementAt(i))).rescanCurrentDirectory(a);
142         }
143     }
144 
145     /**
146      * Invokes the <code>ensureFileIsVisible</code> method on each UI handled by this object.
147      */
ensureFileIsVisible(JFileChooser a, File b)148     public void ensureFileIsVisible(JFileChooser a, File b) {
149         for (int i = 0; i < uis.size(); i++) {
150             ((FileChooserUI) (uis.elementAt(i))).ensureFileIsVisible(a,b);
151         }
152     }
153 
154 ////////////////////
155 // ComponentUI methods
156 ////////////////////
157 
158     /**
159      * Invokes the <code>contains</code> method on each UI handled by this object.
160      *
161      * @return the value obtained from the first UI, which is
162      * the UI obtained from the default <code>LookAndFeel</code>
163      */
contains(JComponent a, int b, int c)164     public boolean contains(JComponent a, int b, int c) {
165         boolean returnValue =
166             uis.elementAt(0).contains(a,b,c);
167         for (int i = 1; i < uis.size(); i++) {
168             uis.elementAt(i).contains(a,b,c);
169         }
170         return returnValue;
171     }
172 
173     /**
174      * Invokes the <code>update</code> method on each UI handled by this object.
175      */
update(Graphics a, JComponent b)176     public void update(Graphics a, JComponent b) {
177         for (int i = 0; i < uis.size(); i++) {
178             uis.elementAt(i).update(a,b);
179         }
180     }
181 
182     /**
183      * Returns a multiplexing UI instance if any of the auxiliary
184      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
185      * UI object obtained from the default <code>LookAndFeel</code>.
186      *
187      * @param  a the component to create the UI for
188      * @return the UI delegate created
189      */
createUI(JComponent a)190     public static ComponentUI createUI(JComponent a) {
191         MultiFileChooserUI mui = new MultiFileChooserUI();
192         return MultiLookAndFeel.createUIs(mui, mui.uis, a);
193     }
194 
195     /**
196      * Invokes the <code>installUI</code> method on each UI handled by this object.
197      */
installUI(JComponent a)198     public void installUI(JComponent a) {
199         for (int i = 0; i < uis.size(); i++) {
200             uis.elementAt(i).installUI(a);
201         }
202     }
203 
204     /**
205      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
206      */
uninstallUI(JComponent a)207     public void uninstallUI(JComponent a) {
208         for (int i = 0; i < uis.size(); i++) {
209             uis.elementAt(i).uninstallUI(a);
210         }
211     }
212 
213     /**
214      * Invokes the <code>paint</code> method on each UI handled by this object.
215      */
paint(Graphics a, JComponent b)216     public void paint(Graphics a, JComponent b) {
217         for (int i = 0; i < uis.size(); i++) {
218             uis.elementAt(i).paint(a,b);
219         }
220     }
221 
222     /**
223      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
224      *
225      * @return the value obtained from the first UI, which is
226      * the UI obtained from the default <code>LookAndFeel</code>
227      */
getPreferredSize(JComponent a)228     public Dimension getPreferredSize(JComponent a) {
229         Dimension returnValue =
230             uis.elementAt(0).getPreferredSize(a);
231         for (int i = 1; i < uis.size(); i++) {
232             uis.elementAt(i).getPreferredSize(a);
233         }
234         return returnValue;
235     }
236 
237     /**
238      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
239      *
240      * @return the value obtained from the first UI, which is
241      * the UI obtained from the default <code>LookAndFeel</code>
242      */
getMinimumSize(JComponent a)243     public Dimension getMinimumSize(JComponent a) {
244         Dimension returnValue =
245             uis.elementAt(0).getMinimumSize(a);
246         for (int i = 1; i < uis.size(); i++) {
247             uis.elementAt(i).getMinimumSize(a);
248         }
249         return returnValue;
250     }
251 
252     /**
253      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
254      *
255      * @return the value obtained from the first UI, which is
256      * the UI obtained from the default <code>LookAndFeel</code>
257      */
getMaximumSize(JComponent a)258     public Dimension getMaximumSize(JComponent a) {
259         Dimension returnValue =
260             uis.elementAt(0).getMaximumSize(a);
261         for (int i = 1; i < uis.size(); i++) {
262             uis.elementAt(i).getMaximumSize(a);
263         }
264         return returnValue;
265     }
266 
267     /**
268      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
269      *
270      * @return the value obtained from the first UI, which is
271      * the UI obtained from the default <code>LookAndFeel</code>
272      */
getAccessibleChildrenCount(JComponent a)273     public int getAccessibleChildrenCount(JComponent a) {
274         int returnValue =
275             uis.elementAt(0).getAccessibleChildrenCount(a);
276         for (int i = 1; i < uis.size(); i++) {
277             uis.elementAt(i).getAccessibleChildrenCount(a);
278         }
279         return returnValue;
280     }
281 
282     /**
283      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
284      *
285      * @return the value obtained from the first UI, which is
286      * the UI obtained from the default <code>LookAndFeel</code>
287      */
getAccessibleChild(JComponent a, int b)288     public Accessible getAccessibleChild(JComponent a, int b) {
289         Accessible returnValue =
290             uis.elementAt(0).getAccessibleChild(a,b);
291         for (int i = 1; i < uis.size(); i++) {
292             uis.elementAt(i).getAccessibleChild(a,b);
293         }
294         return returnValue;
295     }
296 }
297