001 /*
002 * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.swing.plaf.multi;
026
027 import java.util.Vector;
028 import javax.swing.plaf.OptionPaneUI;
029 import javax.swing.JOptionPane;
030 import javax.swing.plaf.ComponentUI;
031 import javax.swing.JComponent;
032 import java.awt.Graphics;
033 import java.awt.Dimension;
034 import javax.accessibility.Accessible;
035
036 /**
037 * A multiplexing UI used to combine <code>OptionPaneUI</code>s.
038 *
039 * <p>This file was automatically generated by AutoMulti.
040 *
041 * @version 1.32 05/05/07 17:20:40
042 * @author Otto Multey
043 */
044 public class MultiOptionPaneUI extends OptionPaneUI {
045
046 /**
047 * The vector containing the real UIs. This is populated
048 * in the call to <code>createUI</code>, and can be obtained by calling
049 * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
050 * obtained from the default look and feel.
051 */
052 protected Vector uis = new Vector();
053
054 ////////////////////
055 // Common UI methods
056 ////////////////////
057
058 /**
059 * Returns the list of UIs associated with this multiplexing UI. This
060 * allows processing of the UIs by an application aware of multiplexing
061 * UIs on components.
062 */
063 public ComponentUI[] getUIs() {
064 return MultiLookAndFeel.uisToArray(uis);
065 }
066
067 ////////////////////
068 // OptionPaneUI methods
069 ////////////////////
070
071 /**
072 * Invokes the <code>selectInitialValue</code> method on each UI handled by this object.
073 */
074 public void selectInitialValue(JOptionPane a) {
075 for (int i = 0; i < uis.size(); i++) {
076 ((OptionPaneUI) (uis.elementAt(i))).selectInitialValue(a);
077 }
078 }
079
080 /**
081 * Invokes the <code>containsCustomComponents</code> method on each UI handled by this object.
082 *
083 * @return the value obtained from the first UI, which is
084 * the UI obtained from the default <code>LookAndFeel</code>
085 */
086 public boolean containsCustomComponents(JOptionPane a) {
087 boolean returnValue = ((OptionPaneUI) (uis.elementAt(0)))
088 .containsCustomComponents(a);
089 for (int i = 1; i < uis.size(); i++) {
090 ((OptionPaneUI) (uis.elementAt(i)))
091 .containsCustomComponents(a);
092 }
093 return returnValue;
094 }
095
096 ////////////////////
097 // ComponentUI methods
098 ////////////////////
099
100 /**
101 * Invokes the <code>contains</code> method on each UI handled by this object.
102 *
103 * @return the value obtained from the first UI, which is
104 * the UI obtained from the default <code>LookAndFeel</code>
105 */
106 public boolean contains(JComponent a, int b, int c) {
107 boolean returnValue = ((ComponentUI) (uis.elementAt(0)))
108 .contains(a, b, c);
109 for (int i = 1; i < uis.size(); i++) {
110 ((ComponentUI) (uis.elementAt(i))).contains(a, b, c);
111 }
112 return returnValue;
113 }
114
115 /**
116 * Invokes the <code>update</code> method on each UI handled by this object.
117 */
118 public void update(Graphics a, JComponent b) {
119 for (int i = 0; i < uis.size(); i++) {
120 ((ComponentUI) (uis.elementAt(i))).update(a, b);
121 }
122 }
123
124 /**
125 * Returns a multiplexing UI instance if any of the auxiliary
126 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
127 * UI object obtained from the default <code>LookAndFeel</code>.
128 */
129 public static ComponentUI createUI(JComponent a) {
130 ComponentUI mui = new MultiOptionPaneUI();
131 return MultiLookAndFeel.createUIs(mui,
132 ((MultiOptionPaneUI) mui).uis, a);
133 }
134
135 /**
136 * Invokes the <code>installUI</code> method on each UI handled by this object.
137 */
138 public void installUI(JComponent a) {
139 for (int i = 0; i < uis.size(); i++) {
140 ((ComponentUI) (uis.elementAt(i))).installUI(a);
141 }
142 }
143
144 /**
145 * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
146 */
147 public void uninstallUI(JComponent a) {
148 for (int i = 0; i < uis.size(); i++) {
149 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
150 }
151 }
152
153 /**
154 * Invokes the <code>paint</code> method on each UI handled by this object.
155 */
156 public void paint(Graphics a, JComponent b) {
157 for (int i = 0; i < uis.size(); i++) {
158 ((ComponentUI) (uis.elementAt(i))).paint(a, b);
159 }
160 }
161
162 /**
163 * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
164 *
165 * @return the value obtained from the first UI, which is
166 * the UI obtained from the default <code>LookAndFeel</code>
167 */
168 public Dimension getPreferredSize(JComponent a) {
169 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
170 .getPreferredSize(a);
171 for (int i = 1; i < uis.size(); i++) {
172 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
173 }
174 return returnValue;
175 }
176
177 /**
178 * Invokes the <code>getMinimumSize</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 getMinimumSize(JComponent a) {
184 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
185 .getMinimumSize(a);
186 for (int i = 1; i < uis.size(); i++) {
187 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
188 }
189 return returnValue;
190 }
191
192 /**
193 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
194 *
195 * @return the value obtained from the first UI, which is
196 * the UI obtained from the default <code>LookAndFeel</code>
197 */
198 public Dimension getMaximumSize(JComponent a) {
199 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
200 .getMaximumSize(a);
201 for (int i = 1; i < uis.size(); i++) {
202 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
203 }
204 return returnValue;
205 }
206
207 /**
208 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
209 *
210 * @return the value obtained from the first UI, which is
211 * the UI obtained from the default <code>LookAndFeel</code>
212 */
213 public int getAccessibleChildrenCount(JComponent a) {
214 int returnValue = ((ComponentUI) (uis.elementAt(0)))
215 .getAccessibleChildrenCount(a);
216 for (int i = 1; i < uis.size(); i++) {
217 ((ComponentUI) (uis.elementAt(i)))
218 .getAccessibleChildrenCount(a);
219 }
220 return returnValue;
221 }
222
223 /**
224 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
225 *
226 * @return the value obtained from the first UI, which is
227 * the UI obtained from the default <code>LookAndFeel</code>
228 */
229 public Accessible getAccessibleChild(JComponent a, int b) {
230 Accessible returnValue = ((ComponentUI) (uis.elementAt(0)))
231 .getAccessibleChild(a, b);
232 for (int i = 1; i < uis.size(); i++) {
233 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a, b);
234 }
235 return returnValue;
236 }
237 }
|