001 /*
002 * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.swing.plaf.multi;
026
027 import java.util.Vector;
028 import javax.swing.plaf.FileChooserUI;
029 import javax.swing.filechooser.FileFilter;
030 import javax.swing.JFileChooser;
031 import javax.swing.filechooser.FileView;
032 import java.lang.String;
033 import java.io.File;
034 import javax.swing.plaf.ComponentUI;
035 import javax.swing.JComponent;
036 import java.awt.Graphics;
037 import java.awt.Dimension;
038 import javax.accessibility.Accessible;
039
040 /**
041 * A multiplexing UI used to combine <code>FileChooserUI</code>s.
042 *
043 * <p>This file was automatically generated by AutoMulti.
044 *
045 * @version 1.33 05/05/07 17:20:39
046 * @author Otto Multey
047 */
048 public class MultiFileChooserUI extends FileChooserUI {
049
050 /**
051 * The vector containing the real UIs. This is populated
052 * in the call to <code>createUI</code>, and can be obtained by calling
053 * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
054 * obtained from the default look and feel.
055 */
056 protected Vector uis = new Vector();
057
058 ////////////////////
059 // Common UI methods
060 ////////////////////
061
062 /**
063 * Returns the list of UIs associated with this multiplexing UI. This
064 * allows processing of the UIs by an application aware of multiplexing
065 * UIs on components.
066 */
067 public ComponentUI[] getUIs() {
068 return MultiLookAndFeel.uisToArray(uis);
069 }
070
071 ////////////////////
072 // FileChooserUI methods
073 ////////////////////
074
075 /**
076 * Invokes the <code>getAcceptAllFileFilter</code> method on each UI handled by this object.
077 *
078 * @return the value obtained from the first UI, which is
079 * the UI obtained from the default <code>LookAndFeel</code>
080 */
081 public FileFilter getAcceptAllFileFilter(JFileChooser a) {
082 FileFilter returnValue = ((FileChooserUI) (uis.elementAt(0)))
083 .getAcceptAllFileFilter(a);
084 for (int i = 1; i < uis.size(); i++) {
085 ((FileChooserUI) (uis.elementAt(i)))
086 .getAcceptAllFileFilter(a);
087 }
088 return returnValue;
089 }
090
091 /**
092 * Invokes the <code>getFileView</code> method on each UI handled by this object.
093 *
094 * @return the value obtained from the first UI, which is
095 * the UI obtained from the default <code>LookAndFeel</code>
096 */
097 public FileView getFileView(JFileChooser a) {
098 FileView returnValue = ((FileChooserUI) (uis.elementAt(0)))
099 .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 */
112 public String getApproveButtonText(JFileChooser a) {
113 String returnValue = ((FileChooserUI) (uis.elementAt(0)))
114 .getApproveButtonText(a);
115 for (int i = 1; i < uis.size(); i++) {
116 ((FileChooserUI) (uis.elementAt(i)))
117 .getApproveButtonText(a);
118 }
119 return returnValue;
120 }
121
122 /**
123 * Invokes the <code>getDialogTitle</code> method on each UI handled by this object.
124 *
125 * @return the value obtained from the first UI, which is
126 * the UI obtained from the default <code>LookAndFeel</code>
127 */
128 public String getDialogTitle(JFileChooser a) {
129 String returnValue = ((FileChooserUI) (uis.elementAt(0)))
130 .getDialogTitle(a);
131 for (int i = 1; i < uis.size(); i++) {
132 ((FileChooserUI) (uis.elementAt(i))).getDialogTitle(a);
133 }
134 return returnValue;
135 }
136
137 /**
138 * Invokes the <code>rescanCurrentDirectory</code> method on each UI handled by this object.
139 */
140 public void rescanCurrentDirectory(JFileChooser a) {
141 for (int i = 0; i < uis.size(); i++) {
142 ((FileChooserUI) (uis.elementAt(i)))
143 .rescanCurrentDirectory(a);
144 }
145 }
146
147 /**
148 * Invokes the <code>ensureFileIsVisible</code> method on each UI handled by this object.
149 */
150 public void ensureFileIsVisible(JFileChooser a, File b) {
151 for (int i = 0; i < uis.size(); i++) {
152 ((FileChooserUI) (uis.elementAt(i))).ensureFileIsVisible(a,
153 b);
154 }
155 }
156
157 ////////////////////
158 // ComponentUI methods
159 ////////////////////
160
161 /**
162 * Invokes the <code>contains</code> method on each UI handled by this object.
163 *
164 * @return the value obtained from the first UI, which is
165 * the UI obtained from the default <code>LookAndFeel</code>
166 */
167 public boolean contains(JComponent a, int b, int c) {
168 boolean returnValue = ((ComponentUI) (uis.elementAt(0)))
169 .contains(a, b, c);
170 for (int i = 1; i < uis.size(); i++) {
171 ((ComponentUI) (uis.elementAt(i))).contains(a, b, c);
172 }
173 return returnValue;
174 }
175
176 /**
177 * Invokes the <code>update</code> method on each UI handled by this object.
178 */
179 public void update(Graphics a, JComponent b) {
180 for (int i = 0; i < uis.size(); i++) {
181 ((ComponentUI) (uis.elementAt(i))).update(a, b);
182 }
183 }
184
185 /**
186 * Returns a multiplexing UI instance if any of the auxiliary
187 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
188 * UI object obtained from the default <code>LookAndFeel</code>.
189 */
190 public static ComponentUI createUI(JComponent a) {
191 ComponentUI mui = new MultiFileChooserUI();
192 return MultiLookAndFeel.createUIs(mui,
193 ((MultiFileChooserUI) mui).uis, a);
194 }
195
196 /**
197 * Invokes the <code>installUI</code> method on each UI handled by this object.
198 */
199 public void installUI(JComponent a) {
200 for (int i = 0; i < uis.size(); i++) {
201 ((ComponentUI) (uis.elementAt(i))).installUI(a);
202 }
203 }
204
205 /**
206 * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
207 */
208 public void uninstallUI(JComponent a) {
209 for (int i = 0; i < uis.size(); i++) {
210 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
211 }
212 }
213
214 /**
215 * Invokes the <code>paint</code> method on each UI handled by this object.
216 */
217 public void paint(Graphics a, JComponent b) {
218 for (int i = 0; i < uis.size(); i++) {
219 ((ComponentUI) (uis.elementAt(i))).paint(a, b);
220 }
221 }
222
223 /**
224 * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
225 *
226 * @return the value obtained from the first UI, which is
227 * the UI obtained from the default <code>LookAndFeel</code>
228 */
229 public Dimension getPreferredSize(JComponent a) {
230 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
231 .getPreferredSize(a);
232 for (int i = 1; i < uis.size(); i++) {
233 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
234 }
235 return returnValue;
236 }
237
238 /**
239 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
240 *
241 * @return the value obtained from the first UI, which is
242 * the UI obtained from the default <code>LookAndFeel</code>
243 */
244 public Dimension getMinimumSize(JComponent a) {
245 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
246 .getMinimumSize(a);
247 for (int i = 1; i < uis.size(); i++) {
248 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
249 }
250 return returnValue;
251 }
252
253 /**
254 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
255 *
256 * @return the value obtained from the first UI, which is
257 * the UI obtained from the default <code>LookAndFeel</code>
258 */
259 public Dimension getMaximumSize(JComponent a) {
260 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
261 .getMaximumSize(a);
262 for (int i = 1; i < uis.size(); i++) {
263 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
264 }
265 return returnValue;
266 }
267
268 /**
269 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
270 *
271 * @return the value obtained from the first UI, which is
272 * the UI obtained from the default <code>LookAndFeel</code>
273 */
274 public int getAccessibleChildrenCount(JComponent a) {
275 int returnValue = ((ComponentUI) (uis.elementAt(0)))
276 .getAccessibleChildrenCount(a);
277 for (int i = 1; i < uis.size(); i++) {
278 ((ComponentUI) (uis.elementAt(i)))
279 .getAccessibleChildrenCount(a);
280 }
281 return returnValue;
282 }
283
284 /**
285 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
286 *
287 * @return the value obtained from the first UI, which is
288 * the UI obtained from the default <code>LookAndFeel</code>
289 */
290 public Accessible getAccessibleChild(JComponent a, int b) {
291 Accessible returnValue = ((ComponentUI) (uis.elementAt(0)))
292 .getAccessibleChild(a, b);
293 for (int i = 1; i < uis.size(); i++) {
294 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a, b);
295 }
296 return returnValue;
297 }
298 }
|