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 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      */
  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      */
  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      */
  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      */
 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      */
 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      */
 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      */
 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      */
 164     public boolean contains(JComponent a, int b, int c) {
 165         boolean returnValue =
 166             ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
 167         for (int i = 1; i < uis.size(); i++) {
 168             ((ComponentUI) (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      */
 176     public void update(Graphics a, JComponent b) {
 177         for (int i = 0; i < uis.size(); i++) {
 178             ((ComponentUI) (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      */
 190     public static ComponentUI createUI(JComponent a) {
 191         ComponentUI mui = new MultiFileChooserUI();
 192         return MultiLookAndFeel.createUIs(mui,
 193                                           ((MultiFileChooserUI) mui).uis,
 194                                           a);
 195     }
 196 
 197     /**
 198      * Invokes the <code>installUI</code> method on each UI handled by this object.
 199      */
 200     public void installUI(JComponent a) {
 201         for (int i = 0; i < uis.size(); i++) {
 202             ((ComponentUI) (uis.elementAt(i))).installUI(a);
 203         }
 204     }
 205 
 206     /**
 207      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
 208      */
 209     public void uninstallUI(JComponent a) {
 210         for (int i = 0; i < uis.size(); i++) {
 211             ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
 212         }
 213     }
 214 
 215     /**
 216      * Invokes the <code>paint</code> method on each UI handled by this object.
 217      */
 218     public void paint(Graphics a, JComponent b) {
 219         for (int i = 0; i < uis.size(); i++) {
 220             ((ComponentUI) (uis.elementAt(i))).paint(a,b);
 221         }
 222     }
 223 
 224     /**
 225      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
 226      *
 227      * @return the value obtained from the first UI, which is
 228      * the UI obtained from the default <code>LookAndFeel</code>
 229      */
 230     public Dimension getPreferredSize(JComponent a) {
 231         Dimension returnValue =
 232             ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
 233         for (int i = 1; i < uis.size(); i++) {
 234             ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
 235         }
 236         return returnValue;
 237     }
 238 
 239     /**
 240      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
 241      *
 242      * @return the value obtained from the first UI, which is
 243      * the UI obtained from the default <code>LookAndFeel</code>
 244      */
 245     public Dimension getMinimumSize(JComponent a) {
 246         Dimension returnValue =
 247             ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
 248         for (int i = 1; i < uis.size(); i++) {
 249             ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
 250         }
 251         return returnValue;
 252     }
 253 
 254     /**
 255      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
 256      *
 257      * @return the value obtained from the first UI, which is
 258      * the UI obtained from the default <code>LookAndFeel</code>
 259      */
 260     public Dimension getMaximumSize(JComponent a) {
 261         Dimension returnValue =
 262             ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
 263         for (int i = 1; i < uis.size(); i++) {
 264             ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
 265         }
 266         return returnValue;
 267     }
 268 
 269     /**
 270      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
 271      *
 272      * @return the value obtained from the first UI, which is
 273      * the UI obtained from the default <code>LookAndFeel</code>
 274      */
 275     public int getAccessibleChildrenCount(JComponent a) {
 276         int returnValue =
 277             ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
 278         for (int i = 1; i < uis.size(); i++) {
 279             ((ComponentUI) (uis.elementAt(i))).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 =
 292             ((ComponentUI) (uis.elementAt(0))).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 }