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