1. /*
  2. * @(#)MultiSeparatorUI.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.SeparatorUI;
  13. import javax.swing.plaf.ComponentUI;
  14. import javax.swing.JComponent;
  15. import java.awt.Graphics;
  16. import java.awt.Dimension;
  17. import javax.accessibility.Accessible;
  18. /**
  19. * MultiSeparatorUI implementation
  20. *
  21. * <p>This file was automatically generated by AutoMulti.
  22. *
  23. * @version 1.22 02/02/00 18:15:45
  24. * @author Otto Multey
  25. */
  26. public class MultiSeparatorUI extends SeparatorUI {
  27. /**
  28. * The Vector containing the real UI's. This is populated
  29. * in the call to createUI, and can be obtained by calling
  30. * getUIs. The first element is guaranteed to the real UI
  31. * obtained from the default look and feel.
  32. */
  33. protected Vector uis = new Vector();
  34. ////////////////////
  35. // Common UI methods
  36. ////////////////////
  37. /**
  38. * Return the list of UI's associated with this multiplexing UI. This
  39. * allows processing of the UI's by an application aware of multiplexing
  40. * UI's on components.
  41. */
  42. public ComponentUI[] getUIs() {
  43. return MultiLookAndFeel.uisToArray(uis);
  44. }
  45. ////////////////////
  46. // SeparatorUI methods
  47. ////////////////////
  48. ////////////////////
  49. // ComponentUI methods
  50. ////////////////////
  51. /**
  52. * Call installUI on each UI handled by this MultiUI.
  53. */
  54. public void installUI(JComponent a) {
  55. for (int i = 0; i < uis.size(); i++) {
  56. ((ComponentUI) (uis.elementAt(i))).installUI(a);
  57. }
  58. }
  59. /**
  60. * Call uninstallUI on each UI handled by this MultiUI.
  61. */
  62. public void uninstallUI(JComponent a) {
  63. for (int i = 0; i < uis.size(); i++) {
  64. ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
  65. }
  66. }
  67. /**
  68. * Call paint on each UI handled by this MultiUI.
  69. */
  70. public void paint(Graphics a, JComponent b) {
  71. for (int i = 0; i < uis.size(); i++) {
  72. ((ComponentUI) (uis.elementAt(i))).paint(a,b);
  73. }
  74. }
  75. /**
  76. * Call update on each UI handled by this MultiUI.
  77. */
  78. public void update(Graphics a, JComponent b) {
  79. for (int i = 0; i < uis.size(); i++) {
  80. ((ComponentUI) (uis.elementAt(i))).update(a,b);
  81. }
  82. }
  83. /**
  84. * Call getPreferredSize on each UI handled by this MultiUI.
  85. * Return only the value obtained from the first UI, which is
  86. * the UI obtained from the default LookAndFeel.
  87. */
  88. public Dimension getPreferredSize(JComponent a) {
  89. Dimension returnValue =
  90. ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
  91. for (int i = 1; i < uis.size(); i++) {
  92. ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
  93. }
  94. return returnValue;
  95. }
  96. /**
  97. * Call getMinimumSize on each UI handled by this MultiUI.
  98. * Return only the value obtained from the first UI, which is
  99. * the UI obtained from the default LookAndFeel.
  100. */
  101. public Dimension getMinimumSize(JComponent a) {
  102. Dimension returnValue =
  103. ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
  104. for (int i = 1; i < uis.size(); i++) {
  105. ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
  106. }
  107. return returnValue;
  108. }
  109. /**
  110. * Call getMaximumSize on each UI handled by this MultiUI.
  111. * Return only the value obtained from the first UI, which is
  112. * the UI obtained from the default LookAndFeel.
  113. */
  114. public Dimension getMaximumSize(JComponent a) {
  115. Dimension returnValue =
  116. ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
  117. for (int i = 1; i < uis.size(); i++) {
  118. ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
  119. }
  120. return returnValue;
  121. }
  122. /**
  123. * Call contains on each UI handled by this MultiUI.
  124. * Return only the value obtained from the first UI, which is
  125. * the UI obtained from the default LookAndFeel.
  126. */
  127. public boolean contains(JComponent a, int b, int c) {
  128. boolean returnValue =
  129. ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
  130. for (int i = 1; i < uis.size(); i++) {
  131. ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
  132. }
  133. return returnValue;
  134. }
  135. /**
  136. * Return a multiplexing UI instance if any of the auxiliary
  137. * LookAndFeels support this UI. Otherwise, just return a
  138. * UI obtained using the normal methods.
  139. */
  140. public static ComponentUI createUI(JComponent a) {
  141. ComponentUI mui = new MultiSeparatorUI();
  142. return MultiLookAndFeel.createUIs(mui,
  143. ((MultiSeparatorUI) mui).uis,
  144. a);
  145. }
  146. /**
  147. * Call getAccessibleChildrenCount on each UI handled by this MultiUI.
  148. * Return only the value obtained from the first UI, which is
  149. * the UI obtained from the default LookAndFeel.
  150. */
  151. public int getAccessibleChildrenCount(JComponent a) {
  152. int returnValue =
  153. ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
  154. for (int i = 1; i < uis.size(); i++) {
  155. ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
  156. }
  157. return returnValue;
  158. }
  159. /**
  160. * Call getAccessibleChild on each UI handled by this MultiUI.
  161. * Return only the value obtained from the first UI, which is
  162. * the UI obtained from the default LookAndFeel.
  163. */
  164. public Accessible getAccessibleChild(JComponent a, int b) {
  165. Accessible returnValue =
  166. ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
  167. for (int i = 1; i < uis.size(); i++) {
  168. ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
  169. }
  170. return returnValue;
  171. }
  172. }