1. /*
  2. * @(#)MultiFileChooserUI.java 1.25 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.multi;
  8. import java.util.Vector;
  9. import javax.swing.plaf.FileChooserUI;
  10. import javax.swing.filechooser.FileFilter;
  11. import javax.swing.JFileChooser;
  12. import javax.swing.filechooser.FileView;
  13. import java.lang.String;
  14. import java.io.File;
  15. import javax.swing.plaf.ComponentUI;
  16. import javax.swing.JComponent;
  17. import java.awt.Graphics;
  18. import java.awt.Dimension;
  19. import javax.accessibility.Accessible;
  20. /**
  21. * A multiplexing UI used to combine <code>FileChooserUI</code>s.
  22. *
  23. * <p>This file was automatically generated by AutoMulti.
  24. *
  25. * @version 1.25 01/23/03 13:24:05
  26. * @author Otto Multey
  27. */
  28. public class MultiFileChooserUI extends FileChooserUI {
  29. /**
  30. * The vector containing the real UIs. This is populated
  31. * in the call to <code>createUI</code>, and can be obtained by calling
  32. * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
  33. * obtained from the default look and feel.
  34. */
  35. protected Vector uis = new Vector();
  36. ////////////////////
  37. // Common UI methods
  38. ////////////////////
  39. /**
  40. * Returns the list of UIs associated with this multiplexing UI. This
  41. * allows processing of the UIs by an application aware of multiplexing
  42. * UIs on components.
  43. */
  44. public ComponentUI[] getUIs() {
  45. return MultiLookAndFeel.uisToArray(uis);
  46. }
  47. ////////////////////
  48. // FileChooserUI methods
  49. ////////////////////
  50. /**
  51. * Invokes the <code>getAcceptAllFileFilter</code> method on each UI handled by this object.
  52. *
  53. * @return the value obtained from the first UI, which is
  54. * the UI obtained from the default <code>LookAndFeel</code>
  55. */
  56. public FileFilter getAcceptAllFileFilter(JFileChooser a) {
  57. FileFilter returnValue =
  58. ((FileChooserUI) (uis.elementAt(0))).getAcceptAllFileFilter(a);
  59. for (int i = 1; i < uis.size(); i++) {
  60. ((FileChooserUI) (uis.elementAt(i))).getAcceptAllFileFilter(a);
  61. }
  62. return returnValue;
  63. }
  64. /**
  65. * Invokes the <code>getFileView</code> method on each UI handled by this object.
  66. *
  67. * @return the value obtained from the first UI, which is
  68. * the UI obtained from the default <code>LookAndFeel</code>
  69. */
  70. public FileView getFileView(JFileChooser a) {
  71. FileView returnValue =
  72. ((FileChooserUI) (uis.elementAt(0))).getFileView(a);
  73. for (int i = 1; i < uis.size(); i++) {
  74. ((FileChooserUI) (uis.elementAt(i))).getFileView(a);
  75. }
  76. return returnValue;
  77. }
  78. /**
  79. * Invokes the <code>getApproveButtonText</code> method on each UI handled by this object.
  80. *
  81. * @return the value obtained from the first UI, which is
  82. * the UI obtained from the default <code>LookAndFeel</code>
  83. */
  84. public String getApproveButtonText(JFileChooser a) {
  85. String returnValue =
  86. ((FileChooserUI) (uis.elementAt(0))).getApproveButtonText(a);
  87. for (int i = 1; i < uis.size(); i++) {
  88. ((FileChooserUI) (uis.elementAt(i))).getApproveButtonText(a);
  89. }
  90. return returnValue;
  91. }
  92. /**
  93. * Invokes the <code>getDialogTitle</code> method on each UI handled by this object.
  94. *
  95. * @return the value obtained from the first UI, which is
  96. * the UI obtained from the default <code>LookAndFeel</code>
  97. */
  98. public String getDialogTitle(JFileChooser a) {
  99. String returnValue =
  100. ((FileChooserUI) (uis.elementAt(0))).getDialogTitle(a);
  101. for (int i = 1; i < uis.size(); i++) {
  102. ((FileChooserUI) (uis.elementAt(i))).getDialogTitle(a);
  103. }
  104. return returnValue;
  105. }
  106. /**
  107. * Invokes the <code>rescanCurrentDirectory</code> method on each UI handled by this object.
  108. */
  109. public void rescanCurrentDirectory(JFileChooser a) {
  110. for (int i = 0; i < uis.size(); i++) {
  111. ((FileChooserUI) (uis.elementAt(i))).rescanCurrentDirectory(a);
  112. }
  113. }
  114. /**
  115. * Invokes the <code>ensureFileIsVisible</code> method on each UI handled by this object.
  116. */
  117. public void ensureFileIsVisible(JFileChooser a, File b) {
  118. for (int i = 0; i < uis.size(); i++) {
  119. ((FileChooserUI) (uis.elementAt(i))).ensureFileIsVisible(a,b);
  120. }
  121. }
  122. ////////////////////
  123. // ComponentUI methods
  124. ////////////////////
  125. /**
  126. * Invokes the <code>contains</code> method on each UI handled by this object.
  127. *
  128. * @return the value obtained from the first UI, which is
  129. * the UI obtained from the default <code>LookAndFeel</code>
  130. */
  131. public boolean contains(JComponent a, int b, int c) {
  132. boolean returnValue =
  133. ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
  134. for (int i = 1; i < uis.size(); i++) {
  135. ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
  136. }
  137. return returnValue;
  138. }
  139. /**
  140. * Invokes the <code>update</code> method on each UI handled by this object.
  141. */
  142. public void update(Graphics a, JComponent b) {
  143. for (int i = 0; i < uis.size(); i++) {
  144. ((ComponentUI) (uis.elementAt(i))).update(a,b);
  145. }
  146. }
  147. /**
  148. * Returns a multiplexing UI instance if any of the auxiliary
  149. * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
  150. * UI object obtained from the default <code>LookAndFeel</code>.
  151. */
  152. public static ComponentUI createUI(JComponent a) {
  153. ComponentUI mui = new MultiFileChooserUI();
  154. return MultiLookAndFeel.createUIs(mui,
  155. ((MultiFileChooserUI) mui).uis,
  156. a);
  157. }
  158. /**
  159. * Invokes the <code>installUI</code> method on each UI handled by this object.
  160. */
  161. public void installUI(JComponent a) {
  162. for (int i = 0; i < uis.size(); i++) {
  163. ((ComponentUI) (uis.elementAt(i))).installUI(a);
  164. }
  165. }
  166. /**
  167. * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
  168. */
  169. public void uninstallUI(JComponent a) {
  170. for (int i = 0; i < uis.size(); i++) {
  171. ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
  172. }
  173. }
  174. /**
  175. * Invokes the <code>paint</code> method on each UI handled by this object.
  176. */
  177. public void paint(Graphics a, JComponent b) {
  178. for (int i = 0; i < uis.size(); i++) {
  179. ((ComponentUI) (uis.elementAt(i))).paint(a,b);
  180. }
  181. }
  182. /**
  183. * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
  184. *
  185. * @return the value obtained from the first UI, which is
  186. * the UI obtained from the default <code>LookAndFeel</code>
  187. */
  188. public Dimension getPreferredSize(JComponent a) {
  189. Dimension returnValue =
  190. ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
  191. for (int i = 1; i < uis.size(); i++) {
  192. ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
  193. }
  194. return returnValue;
  195. }
  196. /**
  197. * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
  198. *
  199. * @return the value obtained from the first UI, which is
  200. * the UI obtained from the default <code>LookAndFeel</code>
  201. */
  202. public Dimension getMinimumSize(JComponent a) {
  203. Dimension returnValue =
  204. ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
  205. for (int i = 1; i < uis.size(); i++) {
  206. ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
  207. }
  208. return returnValue;
  209. }
  210. /**
  211. * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
  212. *
  213. * @return the value obtained from the first UI, which is
  214. * the UI obtained from the default <code>LookAndFeel</code>
  215. */
  216. public Dimension getMaximumSize(JComponent a) {
  217. Dimension returnValue =
  218. ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
  219. for (int i = 1; i < uis.size(); i++) {
  220. ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
  221. }
  222. return returnValue;
  223. }
  224. /**
  225. * Invokes the <code>getAccessibleChildrenCount</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 int getAccessibleChildrenCount(JComponent a) {
  231. int returnValue =
  232. ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
  233. for (int i = 1; i < uis.size(); i++) {
  234. ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
  235. }
  236. return returnValue;
  237. }
  238. /**
  239. * Invokes the <code>getAccessibleChild</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 Accessible getAccessibleChild(JComponent a, int b) {
  245. Accessible returnValue =
  246. ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
  247. for (int i = 1; i < uis.size(); i++) {
  248. ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
  249. }
  250. return returnValue;
  251. }
  252. }