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.TableUI;
029 import javax.swing.plaf.ComponentUI;
030 import javax.swing.JComponent;
031 import java.awt.Graphics;
032 import java.awt.Dimension;
033 import javax.accessibility.Accessible;
034
035 /**
036 * A multiplexing UI used to combine <code>TableUI</code>s.
037 *
038 * <p>This file was automatically generated by AutoMulti.
039 *
040 * @version 1.31 05/05/07 17:20:41
041 * @author Otto Multey
042 */
043 public class MultiTableUI extends TableUI {
044
045 /**
046 * The vector containing the real UIs. This is populated
047 * in the call to <code>createUI</code>, and can be obtained by calling
048 * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
049 * obtained from the default look and feel.
050 */
051 protected Vector uis = new Vector();
052
053 ////////////////////
054 // Common UI methods
055 ////////////////////
056
057 /**
058 * Returns the list of UIs associated with this multiplexing UI. This
059 * allows processing of the UIs by an application aware of multiplexing
060 * UIs on components.
061 */
062 public ComponentUI[] getUIs() {
063 return MultiLookAndFeel.uisToArray(uis);
064 }
065
066 ////////////////////
067 // TableUI methods
068 ////////////////////
069
070 ////////////////////
071 // ComponentUI methods
072 ////////////////////
073
074 /**
075 * Invokes the <code>contains</code> method on each UI handled by this object.
076 *
077 * @return the value obtained from the first UI, which is
078 * the UI obtained from the default <code>LookAndFeel</code>
079 */
080 public boolean contains(JComponent a, int b, int c) {
081 boolean returnValue = ((ComponentUI) (uis.elementAt(0)))
082 .contains(a, b, c);
083 for (int i = 1; i < uis.size(); i++) {
084 ((ComponentUI) (uis.elementAt(i))).contains(a, b, c);
085 }
086 return returnValue;
087 }
088
089 /**
090 * Invokes the <code>update</code> method on each UI handled by this object.
091 */
092 public void update(Graphics a, JComponent b) {
093 for (int i = 0; i < uis.size(); i++) {
094 ((ComponentUI) (uis.elementAt(i))).update(a, b);
095 }
096 }
097
098 /**
099 * Returns a multiplexing UI instance if any of the auxiliary
100 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
101 * UI object obtained from the default <code>LookAndFeel</code>.
102 */
103 public static ComponentUI createUI(JComponent a) {
104 ComponentUI mui = new MultiTableUI();
105 return MultiLookAndFeel.createUIs(mui,
106 ((MultiTableUI) mui).uis, a);
107 }
108
109 /**
110 * Invokes the <code>installUI</code> method on each UI handled by this object.
111 */
112 public void installUI(JComponent a) {
113 for (int i = 0; i < uis.size(); i++) {
114 ((ComponentUI) (uis.elementAt(i))).installUI(a);
115 }
116 }
117
118 /**
119 * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
120 */
121 public void uninstallUI(JComponent a) {
122 for (int i = 0; i < uis.size(); i++) {
123 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
124 }
125 }
126
127 /**
128 * Invokes the <code>paint</code> method on each UI handled by this object.
129 */
130 public void paint(Graphics a, JComponent b) {
131 for (int i = 0; i < uis.size(); i++) {
132 ((ComponentUI) (uis.elementAt(i))).paint(a, b);
133 }
134 }
135
136 /**
137 * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
138 *
139 * @return the value obtained from the first UI, which is
140 * the UI obtained from the default <code>LookAndFeel</code>
141 */
142 public Dimension getPreferredSize(JComponent a) {
143 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
144 .getPreferredSize(a);
145 for (int i = 1; i < uis.size(); i++) {
146 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
147 }
148 return returnValue;
149 }
150
151 /**
152 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
153 *
154 * @return the value obtained from the first UI, which is
155 * the UI obtained from the default <code>LookAndFeel</code>
156 */
157 public Dimension getMinimumSize(JComponent a) {
158 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
159 .getMinimumSize(a);
160 for (int i = 1; i < uis.size(); i++) {
161 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
162 }
163 return returnValue;
164 }
165
166 /**
167 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
168 *
169 * @return the value obtained from the first UI, which is
170 * the UI obtained from the default <code>LookAndFeel</code>
171 */
172 public Dimension getMaximumSize(JComponent a) {
173 Dimension returnValue = ((ComponentUI) (uis.elementAt(0)))
174 .getMaximumSize(a);
175 for (int i = 1; i < uis.size(); i++) {
176 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
177 }
178 return returnValue;
179 }
180
181 /**
182 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
183 *
184 * @return the value obtained from the first UI, which is
185 * the UI obtained from the default <code>LookAndFeel</code>
186 */
187 public int getAccessibleChildrenCount(JComponent a) {
188 int returnValue = ((ComponentUI) (uis.elementAt(0)))
189 .getAccessibleChildrenCount(a);
190 for (int i = 1; i < uis.size(); i++) {
191 ((ComponentUI) (uis.elementAt(i)))
192 .getAccessibleChildrenCount(a);
193 }
194 return returnValue;
195 }
196
197 /**
198 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
199 *
200 * @return the value obtained from the first UI, which is
201 * the UI obtained from the default <code>LookAndFeel</code>
202 */
203 public Accessible getAccessibleChild(JComponent a, int b) {
204 Accessible returnValue = ((ComponentUI) (uis.elementAt(0)))
205 .getAccessibleChild(a, b);
206 for (int i = 1; i < uis.size(); i++) {
207 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a, b);
208 }
209 return returnValue;
210 }
211 }
|