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