blob: 5a3882e00b6851712a42451c22d7cc2c588fba3f [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25package javax.swing.plaf.multi;
26
27import java.util.Vector;
28import javax.swing.plaf.TextUI;
29import java.lang.String;
30import javax.swing.text.JTextComponent;
31import java.awt.Point;
32import java.awt.Rectangle;
33import javax.swing.text.BadLocationException;
34import javax.swing.text.Position;
35import javax.swing.text.EditorKit;
36import javax.swing.text.View;
37import javax.swing.plaf.ComponentUI;
38import javax.swing.JComponent;
39import java.awt.Graphics;
40import java.awt.Dimension;
41import javax.accessibility.Accessible;
42
43/**
44 * A multiplexing UI used to combine <code>TextUI</code>s.
45 *
46 * <p>This file was automatically generated by AutoMulti.
47 *
48 * @author Otto Multey
49 */
50public class MultiTextUI extends TextUI {
51
52 /**
53 * The vector containing the real UIs. This is populated
54 * in the call to <code>createUI</code>, and can be obtained by calling
55 * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
56 * obtained from the default look and feel.
57 */
58 protected Vector uis = new Vector();
59
60////////////////////
61// Common UI methods
62////////////////////
63
64 /**
65 * Returns the list of UIs associated with this multiplexing UI. This
66 * allows processing of the UIs by an application aware of multiplexing
67 * UIs on components.
68 */
69 public ComponentUI[] getUIs() {
70 return MultiLookAndFeel.uisToArray(uis);
71 }
72
73////////////////////
74// TextUI methods
75////////////////////
76
77 /**
78 * Invokes the <code>getToolTipText</code> method on each UI handled by this object.
79 *
80 * @return the value obtained from the first UI, which is
81 * the UI obtained from the default <code>LookAndFeel</code>
82 * @since 1.4
83 */
84 public String getToolTipText(JTextComponent a, Point b) {
85 String returnValue =
86 ((TextUI) (uis.elementAt(0))).getToolTipText(a,b);
87 for (int i = 1; i < uis.size(); i++) {
88 ((TextUI) (uis.elementAt(i))).getToolTipText(a,b);
89 }
90 return returnValue;
91 }
92
93 /**
94 * Invokes the <code>modelToView</code> method on each UI handled by this object.
95 *
96 * @return the value obtained from the first UI, which is
97 * the UI obtained from the default <code>LookAndFeel</code>
98 */
99 public Rectangle modelToView(JTextComponent a, int b)
100 throws BadLocationException {
101 Rectangle returnValue =
102 ((TextUI) (uis.elementAt(0))).modelToView(a,b);
103 for (int i = 1; i < uis.size(); i++) {
104 ((TextUI) (uis.elementAt(i))).modelToView(a,b);
105 }
106 return returnValue;
107 }
108
109 /**
110 * Invokes the <code>modelToView</code> method on each UI handled by this object.
111 *
112 * @return the value obtained from the first UI, which is
113 * the UI obtained from the default <code>LookAndFeel</code>
114 */
115 public Rectangle modelToView(JTextComponent a, int b, Position.Bias c)
116 throws BadLocationException {
117 Rectangle returnValue =
118 ((TextUI) (uis.elementAt(0))).modelToView(a,b,c);
119 for (int i = 1; i < uis.size(); i++) {
120 ((TextUI) (uis.elementAt(i))).modelToView(a,b,c);
121 }
122 return returnValue;
123 }
124
125 /**
126 * Invokes the <code>viewToModel</code> method on each UI handled by this object.
127 *
128 * @return the value obtained from the first UI, which is
129 * the UI obtained from the default <code>LookAndFeel</code>
130 */
131 public int viewToModel(JTextComponent a, Point b) {
132 int returnValue =
133 ((TextUI) (uis.elementAt(0))).viewToModel(a,b);
134 for (int i = 1; i < uis.size(); i++) {
135 ((TextUI) (uis.elementAt(i))).viewToModel(a,b);
136 }
137 return returnValue;
138 }
139
140 /**
141 * Invokes the <code>viewToModel</code> method on each UI handled by this object.
142 *
143 * @return the value obtained from the first UI, which is
144 * the UI obtained from the default <code>LookAndFeel</code>
145 */
146 public int viewToModel(JTextComponent a, Point b, Position.Bias[] c) {
147 int returnValue =
148 ((TextUI) (uis.elementAt(0))).viewToModel(a,b,c);
149 for (int i = 1; i < uis.size(); i++) {
150 ((TextUI) (uis.elementAt(i))).viewToModel(a,b,c);
151 }
152 return returnValue;
153 }
154
155 /**
156 * Invokes the <code>getNextVisualPositionFrom</code> method on each UI handled by this object.
157 *
158 * @return the value obtained from the first UI, which is
159 * the UI obtained from the default <code>LookAndFeel</code>
160 */
161 public int getNextVisualPositionFrom(JTextComponent a, int b, Position.Bias c, int d, Position.Bias[] e)
162 throws BadLocationException {
163 int returnValue =
164 ((TextUI) (uis.elementAt(0))).getNextVisualPositionFrom(a,b,c,d,e);
165 for (int i = 1; i < uis.size(); i++) {
166 ((TextUI) (uis.elementAt(i))).getNextVisualPositionFrom(a,b,c,d,e);
167 }
168 return returnValue;
169 }
170
171 /**
172 * Invokes the <code>damageRange</code> method on each UI handled by this object.
173 */
174 public void damageRange(JTextComponent a, int b, int c) {
175 for (int i = 0; i < uis.size(); i++) {
176 ((TextUI) (uis.elementAt(i))).damageRange(a,b,c);
177 }
178 }
179
180 /**
181 * Invokes the <code>damageRange</code> method on each UI handled by this object.
182 */
183 public void damageRange(JTextComponent a, int b, int c, Position.Bias d, Position.Bias e) {
184 for (int i = 0; i < uis.size(); i++) {
185 ((TextUI) (uis.elementAt(i))).damageRange(a,b,c,d,e);
186 }
187 }
188
189 /**
190 * Invokes the <code>getEditorKit</code> method on each UI handled by this object.
191 *
192 * @return the value obtained from the first UI, which is
193 * the UI obtained from the default <code>LookAndFeel</code>
194 */
195 public EditorKit getEditorKit(JTextComponent a) {
196 EditorKit returnValue =
197 ((TextUI) (uis.elementAt(0))).getEditorKit(a);
198 for (int i = 1; i < uis.size(); i++) {
199 ((TextUI) (uis.elementAt(i))).getEditorKit(a);
200 }
201 return returnValue;
202 }
203
204 /**
205 * Invokes the <code>getRootView</code> method on each UI handled by this object.
206 *
207 * @return the value obtained from the first UI, which is
208 * the UI obtained from the default <code>LookAndFeel</code>
209 */
210 public View getRootView(JTextComponent a) {
211 View returnValue =
212 ((TextUI) (uis.elementAt(0))).getRootView(a);
213 for (int i = 1; i < uis.size(); i++) {
214 ((TextUI) (uis.elementAt(i))).getRootView(a);
215 }
216 return returnValue;
217 }
218
219////////////////////
220// ComponentUI methods
221////////////////////
222
223 /**
224 * Invokes the <code>contains</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 boolean contains(JComponent a, int b, int c) {
230 boolean returnValue =
231 ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
232 for (int i = 1; i < uis.size(); i++) {
233 ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
234 }
235 return returnValue;
236 }
237
238 /**
239 * Invokes the <code>update</code> method on each UI handled by this object.
240 */
241 public void update(Graphics a, JComponent b) {
242 for (int i = 0; i < uis.size(); i++) {
243 ((ComponentUI) (uis.elementAt(i))).update(a,b);
244 }
245 }
246
247 /**
248 * Returns a multiplexing UI instance if any of the auxiliary
249 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
250 * UI object obtained from the default <code>LookAndFeel</code>.
251 */
252 public static ComponentUI createUI(JComponent a) {
253 ComponentUI mui = new MultiTextUI();
254 return MultiLookAndFeel.createUIs(mui,
255 ((MultiTextUI) mui).uis,
256 a);
257 }
258
259 /**
260 * Invokes the <code>installUI</code> method on each UI handled by this object.
261 */
262 public void installUI(JComponent a) {
263 for (int i = 0; i < uis.size(); i++) {
264 ((ComponentUI) (uis.elementAt(i))).installUI(a);
265 }
266 }
267
268 /**
269 * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
270 */
271 public void uninstallUI(JComponent a) {
272 for (int i = 0; i < uis.size(); i++) {
273 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
274 }
275 }
276
277 /**
278 * Invokes the <code>paint</code> method on each UI handled by this object.
279 */
280 public void paint(Graphics a, JComponent b) {
281 for (int i = 0; i < uis.size(); i++) {
282 ((ComponentUI) (uis.elementAt(i))).paint(a,b);
283 }
284 }
285
286 /**
287 * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
288 *
289 * @return the value obtained from the first UI, which is
290 * the UI obtained from the default <code>LookAndFeel</code>
291 */
292 public Dimension getPreferredSize(JComponent a) {
293 Dimension returnValue =
294 ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
295 for (int i = 1; i < uis.size(); i++) {
296 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
297 }
298 return returnValue;
299 }
300
301 /**
302 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
303 *
304 * @return the value obtained from the first UI, which is
305 * the UI obtained from the default <code>LookAndFeel</code>
306 */
307 public Dimension getMinimumSize(JComponent a) {
308 Dimension returnValue =
309 ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
310 for (int i = 1; i < uis.size(); i++) {
311 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
312 }
313 return returnValue;
314 }
315
316 /**
317 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
318 *
319 * @return the value obtained from the first UI, which is
320 * the UI obtained from the default <code>LookAndFeel</code>
321 */
322 public Dimension getMaximumSize(JComponent a) {
323 Dimension returnValue =
324 ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
325 for (int i = 1; i < uis.size(); i++) {
326 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
327 }
328 return returnValue;
329 }
330
331 /**
332 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
333 *
334 * @return the value obtained from the first UI, which is
335 * the UI obtained from the default <code>LookAndFeel</code>
336 */
337 public int getAccessibleChildrenCount(JComponent a) {
338 int returnValue =
339 ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
340 for (int i = 1; i < uis.size(); i++) {
341 ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
342 }
343 return returnValue;
344 }
345
346 /**
347 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
348 *
349 * @return the value obtained from the first UI, which is
350 * the UI obtained from the default <code>LookAndFeel</code>
351 */
352 public Accessible getAccessibleChild(JComponent a, int b) {
353 Accessible returnValue =
354 ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
355 for (int i = 1; i < uis.size(); i++) {
356 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
357 }
358 return returnValue;
359 }
360}