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