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