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