KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > multi > MultiTextUI


1 /*
2  * @(#)MultiTextUI.java 1.34 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.plaf.multi;
8
9 import java.util.Vector JavaDoc;
10 import javax.swing.plaf.TextUI JavaDoc;
11 import java.lang.String JavaDoc;
12 import javax.swing.text.JTextComponent JavaDoc;
13 import java.awt.Point JavaDoc;
14 import java.awt.Rectangle JavaDoc;
15 import javax.swing.text.BadLocationException JavaDoc;
16 import javax.swing.text.Position JavaDoc;
17 import javax.swing.text.EditorKit JavaDoc;
18 import javax.swing.text.View JavaDoc;
19 import javax.swing.plaf.ComponentUI JavaDoc;
20 import javax.swing.JComponent JavaDoc;
21 import java.awt.Graphics JavaDoc;
22 import java.awt.Dimension JavaDoc;
23 import javax.accessibility.Accessible JavaDoc;
24
25 /**
26  * A multiplexing UI used to combine <code>TextUI</code>s.
27  *
28  * <p>This file was automatically generated by AutoMulti.
29  *
30  * @version 1.34 12/19/03 17:39:44
31  * @author Otto Multey
32  */

33 public class MultiTextUI extends TextUI JavaDoc {
34
35     /**
36      * The vector containing the real UIs. This is populated
37      * in the call to <code>createUI</code>, and can be obtained by calling
38      * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
39      * obtained from the default look and feel.
40      */

41     protected Vector JavaDoc uis = new Vector JavaDoc();
42
43 ////////////////////
44
// Common UI methods
45
////////////////////
46

47     /**
48      * Returns the list of UIs associated with this multiplexing UI. This
49      * allows processing of the UIs by an application aware of multiplexing
50      * UIs on components.
51      */

52     public ComponentUI JavaDoc[] getUIs() {
53         return MultiLookAndFeel.uisToArray(uis);
54     }
55
56 ////////////////////
57
// TextUI methods
58
////////////////////
59

60     /**
61      * Invokes the <code>getToolTipText</code> method on each UI handled by this object.
62      *
63      * @return the value obtained from the first UI, which is
64      * the UI obtained from the default <code>LookAndFeel</code>
65      */

66     public String JavaDoc getToolTipText(JTextComponent JavaDoc a, Point JavaDoc b) {
67         String JavaDoc returnValue =
68             ((TextUI JavaDoc) (uis.elementAt(0))).getToolTipText(a,b);
69         for (int i = 1; i < uis.size(); i++) {
70             ((TextUI JavaDoc) (uis.elementAt(i))).getToolTipText(a,b);
71         }
72         return returnValue;
73     }
74
75     /**
76      * Invokes the <code>modelToView</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 Rectangle JavaDoc modelToView(JTextComponent JavaDoc a, int b)
82             throws BadLocationException JavaDoc {
83         Rectangle JavaDoc returnValue =
84             ((TextUI JavaDoc) (uis.elementAt(0))).modelToView(a,b);
85         for (int i = 1; i < uis.size(); i++) {
86             ((TextUI JavaDoc) (uis.elementAt(i))).modelToView(a,b);
87         }
88         return returnValue;
89     }
90
91     /**
92      * Invokes the <code>modelToView</code> method on each UI handled by this object.
93      *
94      * @return the value obtained from the first UI, which is
95      * the UI obtained from the default <code>LookAndFeel</code>
96      */

97     public Rectangle JavaDoc modelToView(JTextComponent JavaDoc a, int b, Position.Bias JavaDoc c)
98             throws BadLocationException JavaDoc {
99         Rectangle JavaDoc returnValue =
100             ((TextUI JavaDoc) (uis.elementAt(0))).modelToView(a,b,c);
101         for (int i = 1; i < uis.size(); i++) {
102             ((TextUI JavaDoc) (uis.elementAt(i))).modelToView(a,b,c);
103         }
104         return returnValue;
105     }
106
107     /**
108      * Invokes the <code>viewToModel</code> method on each UI handled by this object.
109      *
110      * @return the value obtained from the first UI, which is
111      * the UI obtained from the default <code>LookAndFeel</code>
112      */

113     public int viewToModel(JTextComponent JavaDoc a, Point JavaDoc b) {
114         int returnValue =
115             ((TextUI JavaDoc) (uis.elementAt(0))).viewToModel(a,b);
116         for (int i = 1; i < uis.size(); i++) {
117             ((TextUI JavaDoc) (uis.elementAt(i))).viewToModel(a,b);
118         }
119         return returnValue;
120     }
121
122     /**
123      * Invokes the <code>viewToModel</code> method on each UI handled by this object.
124      *
125      * @return the value obtained from the first UI, which is
126      * the UI obtained from the default <code>LookAndFeel</code>
127      */

128     public int viewToModel(JTextComponent JavaDoc a, Point JavaDoc b, Position.Bias JavaDoc[] c) {
129         int returnValue =
130             ((TextUI JavaDoc) (uis.elementAt(0))).viewToModel(a,b,c);
131         for (int i = 1; i < uis.size(); i++) {
132             ((TextUI JavaDoc) (uis.elementAt(i))).viewToModel(a,b,c);
133         }
134         return returnValue;
135     }
136
137     /**
138      * Invokes the <code>getNextVisualPositionFrom</code> method on each UI handled by this object.
139      *
140      * @return the value obtained from the first UI, which is
141      * the UI obtained from the default <code>LookAndFeel</code>
142      */

143     public int getNextVisualPositionFrom(JTextComponent JavaDoc a, int b, Position.Bias JavaDoc c, int d, Position.Bias JavaDoc[] e)
144             throws BadLocationException JavaDoc {
145         int returnValue =
146             ((TextUI JavaDoc) (uis.elementAt(0))).getNextVisualPositionFrom(a,b,c,d,e);
147         for (int i = 1; i < uis.size(); i++) {
148             ((TextUI JavaDoc) (uis.elementAt(i))).getNextVisualPositionFrom(a,b,c,d,e);
149         }
150         return returnValue;
151     }
152
153     /**
154      * Invokes the <code>damageRange</code> method on each UI handled by this object.
155      */

156     public void damageRange(JTextComponent JavaDoc a, int b, int c) {
157         for (int i = 0; i < uis.size(); i++) {
158             ((TextUI JavaDoc) (uis.elementAt(i))).damageRange(a,b,c);
159         }
160     }
161
162     /**
163      * Invokes the <code>damageRange</code> method on each UI handled by this object.
164      */

165     public void damageRange(JTextComponent JavaDoc a, int b, int c, Position.Bias JavaDoc d, Position.Bias JavaDoc e) {
166         for (int i = 0; i < uis.size(); i++) {
167             ((TextUI JavaDoc) (uis.elementAt(i))).damageRange(a,b,c,d,e);
168         }
169     }
170
171     /**
172      * Invokes the <code>getEditorKit</code> method on each UI handled by this object.
173      *
174      * @return the value obtained from the first UI, which is
175      * the UI obtained from the default <code>LookAndFeel</code>
176      */

177     public EditorKit JavaDoc getEditorKit(JTextComponent JavaDoc a) {
178         EditorKit JavaDoc returnValue =
179             ((TextUI JavaDoc) (uis.elementAt(0))).getEditorKit(a);
180         for (int i = 1; i < uis.size(); i++) {
181             ((TextUI JavaDoc) (uis.elementAt(i))).getEditorKit(a);
182         }
183         return returnValue;
184     }
185
186     /**
187      * Invokes the <code>getRootView</code> method on each UI handled by this object.
188      *
189      * @return the value obtained from the first UI, which is
190      * the UI obtained from the default <code>LookAndFeel</code>
191      */

192     public View JavaDoc getRootView(JTextComponent JavaDoc a) {
193         View JavaDoc returnValue =
194             ((TextUI JavaDoc) (uis.elementAt(0))).getRootView(a);
195         for (int i = 1; i < uis.size(); i++) {
196             ((TextUI JavaDoc) (uis.elementAt(i))).getRootView(a);
197         }
198         return returnValue;
199     }
200
201 ////////////////////
202
// ComponentUI methods
203
////////////////////
204

205     /**
206      * Invokes the <code>contains</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 boolean contains(JComponent JavaDoc a, int b, int c) {
212         boolean returnValue =
213             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
214         for (int i = 1; i < uis.size(); i++) {
215             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
216         }
217         return returnValue;
218     }
219
220     /**
221      * Invokes the <code>update</code> method on each UI handled by this object.
222      */

223     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
224         for (int i = 0; i < uis.size(); i++) {
225             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
226         }
227     }
228
229     /**
230      * Returns a multiplexing UI instance if any of the auxiliary
231      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
232      * UI object obtained from the default <code>LookAndFeel</code>.
233      */

234     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
235         ComponentUI JavaDoc mui = new MultiTextUI JavaDoc();
236         return MultiLookAndFeel.createUIs(mui,
237                                           ((MultiTextUI JavaDoc) mui).uis,
238                                           a);
239     }
240
241     /**
242      * Invokes the <code>installUI</code> method on each UI handled by this object.
243      */

244     public void installUI(JComponent JavaDoc a) {
245         for (int i = 0; i < uis.size(); i++) {
246             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
247         }
248     }
249
250     /**
251      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
252      */

253     public void uninstallUI(JComponent JavaDoc a) {
254         for (int i = 0; i < uis.size(); i++) {
255             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
256         }
257     }
258
259     /**
260      * Invokes the <code>paint</code> method on each UI handled by this object.
261      */

262     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
263         for (int i = 0; i < uis.size(); i++) {
264             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
265         }
266     }
267
268     /**
269      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
270      *
271      * @return the value obtained from the first UI, which is
272      * the UI obtained from the default <code>LookAndFeel</code>
273      */

274     public Dimension JavaDoc getPreferredSize(JComponent JavaDoc a) {
275         Dimension JavaDoc returnValue =
276             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
277         for (int i = 1; i < uis.size(); i++) {
278             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
279         }
280         return returnValue;
281     }
282
283     /**
284      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
285      *
286      * @return the value obtained from the first UI, which is
287      * the UI obtained from the default <code>LookAndFeel</code>
288      */

289     public Dimension JavaDoc getMinimumSize(JComponent JavaDoc a) {
290         Dimension JavaDoc returnValue =
291             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
292         for (int i = 1; i < uis.size(); i++) {
293             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
294         }
295         return returnValue;
296     }
297
298     /**
299      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
300      *
301      * @return the value obtained from the first UI, which is
302      * the UI obtained from the default <code>LookAndFeel</code>
303      */

304     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
305         Dimension JavaDoc returnValue =
306             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
307         for (int i = 1; i < uis.size(); i++) {
308             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
309         }
310         return returnValue;
311     }
312
313     /**
314      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
315      *
316      * @return the value obtained from the first UI, which is
317      * the UI obtained from the default <code>LookAndFeel</code>
318      */

319     public int getAccessibleChildrenCount(JComponent JavaDoc a) {
320         int returnValue =
321             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
322         for (int i = 1; i < uis.size(); i++) {
323             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
324         }
325         return returnValue;
326     }
327
328     /**
329      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
330      *
331      * @return the value obtained from the first UI, which is
332      * the UI obtained from the default <code>LookAndFeel</code>
333      */

334     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
335         Accessible JavaDoc returnValue =
336             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
337         for (int i = 1; i < uis.size(); i++) {
338             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
339         }
340         return returnValue;
341     }
342 }
343
Popular Tags