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