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