1 /* 2 * Copyright (c) 1997, 2001, 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 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 */ getUIs()66 public ComponentUI[] getUIs() { 67 return MultiLookAndFeel.uisToArray(uis); 68 } 69 70 //////////////////// 71 // FileChooserUI methods 72 //////////////////// 73 74 /** 75 * Invokes the <code>getAcceptAllFileFilter</code> method on each UI handled by this object. 76 * 77 * @return the value obtained from the first UI, which is 78 * the UI obtained from the default <code>LookAndFeel</code> 79 */ getAcceptAllFileFilter(JFileChooser a)80 public FileFilter getAcceptAllFileFilter(JFileChooser a) { 81 FileFilter returnValue = 82 ((FileChooserUI) (uis.elementAt(0))).getAcceptAllFileFilter(a); 83 for (int i = 1; i < uis.size(); i++) { 84 ((FileChooserUI) (uis.elementAt(i))).getAcceptAllFileFilter(a); 85 } 86 return returnValue; 87 } 88 89 /** 90 * Invokes the <code>getFileView</code> method on each UI handled by this object. 91 * 92 * @return the value obtained from the first UI, which is 93 * the UI obtained from the default <code>LookAndFeel</code> 94 */ getFileView(JFileChooser a)95 public FileView getFileView(JFileChooser a) { 96 FileView returnValue = 97 ((FileChooserUI) (uis.elementAt(0))).getFileView(a); 98 for (int i = 1; i < uis.size(); i++) { 99 ((FileChooserUI) (uis.elementAt(i))).getFileView(a); 100 } 101 return returnValue; 102 } 103 104 /** 105 * Invokes the <code>getApproveButtonText</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 */ getApproveButtonText(JFileChooser a)110 public String getApproveButtonText(JFileChooser a) { 111 String returnValue = 112 ((FileChooserUI) (uis.elementAt(0))).getApproveButtonText(a); 113 for (int i = 1; i < uis.size(); i++) { 114 ((FileChooserUI) (uis.elementAt(i))).getApproveButtonText(a); 115 } 116 return returnValue; 117 } 118 119 /** 120 * Invokes the <code>getDialogTitle</code> method on each UI handled by this object. 121 * 122 * @return the value obtained from the first UI, which is 123 * the UI obtained from the default <code>LookAndFeel</code> 124 */ getDialogTitle(JFileChooser a)125 public String getDialogTitle(JFileChooser a) { 126 String returnValue = 127 ((FileChooserUI) (uis.elementAt(0))).getDialogTitle(a); 128 for (int i = 1; i < uis.size(); i++) { 129 ((FileChooserUI) (uis.elementAt(i))).getDialogTitle(a); 130 } 131 return returnValue; 132 } 133 134 /** 135 * Invokes the <code>rescanCurrentDirectory</code> method on each UI handled by this object. 136 */ rescanCurrentDirectory(JFileChooser a)137 public void rescanCurrentDirectory(JFileChooser a) { 138 for (int i = 0; i < uis.size(); i++) { 139 ((FileChooserUI) (uis.elementAt(i))).rescanCurrentDirectory(a); 140 } 141 } 142 143 /** 144 * Invokes the <code>ensureFileIsVisible</code> method on each UI handled by this object. 145 */ ensureFileIsVisible(JFileChooser a, File b)146 public void ensureFileIsVisible(JFileChooser a, File b) { 147 for (int i = 0; i < uis.size(); i++) { 148 ((FileChooserUI) (uis.elementAt(i))).ensureFileIsVisible(a,b); 149 } 150 } 151 152 //////////////////// 153 // ComponentUI methods 154 //////////////////// 155 156 /** 157 * Invokes the <code>contains</code> method on each UI handled by this object. 158 * 159 * @return the value obtained from the first UI, which is 160 * the UI obtained from the default <code>LookAndFeel</code> 161 */ contains(JComponent a, int b, int c)162 public boolean contains(JComponent a, int b, int c) { 163 boolean returnValue = 164 ((ComponentUI) (uis.elementAt(0))).contains(a,b,c); 165 for (int i = 1; i < uis.size(); i++) { 166 ((ComponentUI) (uis.elementAt(i))).contains(a,b,c); 167 } 168 return returnValue; 169 } 170 171 /** 172 * Invokes the <code>update</code> method on each UI handled by this object. 173 */ update(Graphics a, JComponent b)174 public void update(Graphics a, JComponent b) { 175 for (int i = 0; i < uis.size(); i++) { 176 ((ComponentUI) (uis.elementAt(i))).update(a,b); 177 } 178 } 179 180 /** 181 * Returns a multiplexing UI instance if any of the auxiliary 182 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the 183 * UI object obtained from the default <code>LookAndFeel</code>. 184 */ createUI(JComponent a)185 public static ComponentUI createUI(JComponent a) { 186 ComponentUI mui = new MultiFileChooserUI(); 187 return MultiLookAndFeel.createUIs(mui, 188 ((MultiFileChooserUI) mui).uis, 189 a); 190 } 191 192 /** 193 * Invokes the <code>installUI</code> method on each UI handled by this object. 194 */ installUI(JComponent a)195 public void installUI(JComponent a) { 196 for (int i = 0; i < uis.size(); i++) { 197 ((ComponentUI) (uis.elementAt(i))).installUI(a); 198 } 199 } 200 201 /** 202 * Invokes the <code>uninstallUI</code> method on each UI handled by this object. 203 */ uninstallUI(JComponent a)204 public void uninstallUI(JComponent a) { 205 for (int i = 0; i < uis.size(); i++) { 206 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a); 207 } 208 } 209 210 /** 211 * Invokes the <code>paint</code> method on each UI handled by this object. 212 */ paint(Graphics a, JComponent b)213 public void paint(Graphics a, JComponent b) { 214 for (int i = 0; i < uis.size(); i++) { 215 ((ComponentUI) (uis.elementAt(i))).paint(a,b); 216 } 217 } 218 219 /** 220 * Invokes the <code>getPreferredSize</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 */ getPreferredSize(JComponent a)225 public Dimension getPreferredSize(JComponent a) { 226 Dimension returnValue = 227 ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a); 228 for (int i = 1; i < uis.size(); i++) { 229 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a); 230 } 231 return returnValue; 232 } 233 234 /** 235 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object. 236 * 237 * @return the value obtained from the first UI, which is 238 * the UI obtained from the default <code>LookAndFeel</code> 239 */ getMinimumSize(JComponent a)240 public Dimension getMinimumSize(JComponent a) { 241 Dimension returnValue = 242 ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a); 243 for (int i = 1; i < uis.size(); i++) { 244 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a); 245 } 246 return returnValue; 247 } 248 249 /** 250 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object. 251 * 252 * @return the value obtained from the first UI, which is 253 * the UI obtained from the default <code>LookAndFeel</code> 254 */ getMaximumSize(JComponent a)255 public Dimension getMaximumSize(JComponent a) { 256 Dimension returnValue = 257 ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a); 258 for (int i = 1; i < uis.size(); i++) { 259 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a); 260 } 261 return returnValue; 262 } 263 264 /** 265 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object. 266 * 267 * @return the value obtained from the first UI, which is 268 * the UI obtained from the default <code>LookAndFeel</code> 269 */ getAccessibleChildrenCount(JComponent a)270 public int getAccessibleChildrenCount(JComponent a) { 271 int returnValue = 272 ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a); 273 for (int i = 1; i < uis.size(); i++) { 274 ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a); 275 } 276 return returnValue; 277 } 278 279 /** 280 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object. 281 * 282 * @return the value obtained from the first UI, which is 283 * the UI obtained from the default <code>LookAndFeel</code> 284 */ getAccessibleChild(JComponent a, int b)285 public Accessible getAccessibleChild(JComponent a, int b) { 286 Accessible returnValue = 287 ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b); 288 for (int i = 1; i < uis.size(); i++) { 289 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b); 290 } 291 return returnValue; 292 } 293 } 294