source: trunk/gcc/libjava/javax/swing/UIDefaults.java

Last change on this file was 1389, checked in by bird, 21 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.3 KB
Line 
1/* UIDefaults.java -- database for all settings and interface bindings.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package javax.swing;
39
40import java.awt.Color;
41import java.awt.Dimension;
42import java.awt.Font;
43import java.awt.Insets;
44import java.beans.PropertyChangeListener;
45import java.util.Hashtable;
46import java.util.Locale;
47import javax.swing.border.Border;
48import javax.swing.plaf.ComponentUI;
49
50/**
51 * UIDefaults is a database where all settings and interface bindings are
52 * stored into. An PLAF implementation fills one of these (see for example
53 * plaf/basic/BasicDefaults.java) with "JButton" -> new BasicButtonUI().
54 *
55 * @author Ronald Veldema (rveldema@cs.vu.nl)
56 */
57public class UIDefaults extends Hashtable
58{
59 public interface ActiveValue
60 {
61 Object createValue(UIDefaults table);
62 } // interface ActiveValue
63
64 public static class LazyInputMap implements LazyValue
65 {
66 public LazyInputMap(Object[] bindings)
67 {
68 }
69 public Object createValue(UIDefaults table)
70 {
71 throw new Error("not implemented");
72 }
73 } // class LazyInputMap
74
75 public interface LazyValue
76 {
77 Object createValue(UIDefaults table);
78 } // interface LazyValue
79
80 public static class ProxyLazyValue
81 {
82 public ProxyLazyValue(String s)
83 {
84 throw new Error("not implemented");
85 }
86 public ProxyLazyValue(String c, String m)
87 {
88 throw new Error("not implemented");
89 }
90 public ProxyLazyValue(String c, Object[] o)
91 {
92 throw new Error("not implemented");
93 }
94 public ProxyLazyValue(String c, String m, Object[] o)
95 {
96 throw new Error("not implemented");
97 }
98 public Object createValue(UIDefaults table)
99 {
100 throw new Error("not implemented");
101 }
102 } // class ProxyLazyValue
103
104 public UIDefaults()
105 {
106 }
107
108 public UIDefaults(Object[] entries)
109 {
110 // XXX
111 }
112
113 public Object get(Object key)
114 {
115 // XXX Obey 1.4 specs
116 return super.get(key);
117 }
118
119 public Object get(Object key, Locale l)
120 {
121 throw new Error("not implemented");
122 }
123
124 public Object put(Object key, Object value)
125 {
126 throw new Error("not implemented");
127 }
128
129 public void putDefaults(Object[] list)
130 {
131 throw new Error("not implemented");
132 }
133
134 public Font getFont(Object key)
135 {
136 Object o = get(key);
137 return o instanceof Font ? (Font) o : null;
138 }
139
140 public Font getFont(Object key, Locale l)
141 {
142 Object o = get(key, l);
143 return o instanceof Font ? (Font) o : null;
144 }
145
146 public Color getColor(Object key)
147 {
148 Object o = get(key);
149 return o instanceof Color ? (Color) o : null;
150 }
151
152 public Color getColor(Object key, Locale l)
153 {
154 Object o = get(key, l);
155 return o instanceof Color ? (Color) o : null;
156 }
157
158 public Icon getIcon(Object key)
159 {
160 Object o = get(key);
161 return o instanceof Icon ? (Icon) o : null;
162 }
163
164 public Icon getIcon(Object key, Locale l)
165 {
166 Object o = get(key, l);
167 return o instanceof Icon ? (Icon) o : null;
168 }
169
170 public Border getBorder(Object key)
171 {
172 Object o = get(key);
173 return o instanceof Border ? (Border) o : null;
174 }
175
176 public Border getBorder(Object key, Locale l)
177 {
178 Object o = get(key, l);
179 return o instanceof Border ? (Border) o : null;
180 }
181
182 public String getString(Object key)
183 {
184 Object o = get(key);
185 return o instanceof String ? (String) o : null;
186 }
187
188 public String getString(Object key, Locale l)
189 {
190 Object o = get(key, l);
191 return o instanceof String ? (String) o : null;
192 }
193
194 public int getInt(Object key)
195 {
196 Object o = get(key);
197 return o instanceof Integer ? ((Integer) o).intValue() : 0;
198 }
199
200 public int getInt(Object key, Locale l)
201 {
202 Object o = get(key, l);
203 return o instanceof Integer ? ((Integer) o).intValue() : 0;
204 }
205
206 public boolean getBoolean(Object key)
207 {
208 return Boolean.TRUE.equals(get(key));
209 }
210
211 public boolean getBoolean(Object key, Locale l)
212 {
213 return Boolean.TRUE.equals(get(key, l));
214 }
215
216 public Insets getInsets(Object key)
217 {
218 Object o = get(key);
219 return o instanceof Insets ? (Insets) o : null;
220 }
221
222 public Insets getInsets(Object key, Locale l)
223 {
224 Object o = get(key, l);
225 return o instanceof Insets ? (Insets) o : null;
226 }
227
228 public Dimension getDimension(Object key)
229 {
230 Object o = get(key);
231 return o instanceof Dimension ? (Dimension) o : null;
232 }
233
234 public Dimension getDimension(Object key, Locale l)
235 {
236 Object o = get(key, l);
237 return o instanceof Dimension ? (Dimension) o : null;
238 }
239
240 public Class getUIClass(String id, ClassLoader loader)
241 {
242 throw new Error("not implemented");
243 }
244
245 public Class getUIClass(String id)
246 {
247 throw new Error("not implemented");
248 }
249
250 protected void getUIError(String msg)
251 {
252 // Does nothing unless overridden.
253 }
254
255 public ComponentUI getUI(JComponent a)
256 {
257 String pp = a.getUIClassID();
258 ComponentUI p = (ComponentUI) get(pp);
259 if (p == null)
260 getUIError("failed to locate UI:" + pp);
261 return p;
262 }
263
264 public void addPropertyChangeListener(PropertyChangeListener l)
265 {
266 throw new Error("not implemented");
267 }
268
269 public void removePropertyChangeListener(PropertyChangeListener l)
270 {
271 throw new Error("not implemented");
272 }
273
274 public PropertyChangeListener[] getPropertyChangeListeners()
275 {
276 throw new Error("not implemented");
277 }
278
279 protected void firePropertyChange(String property, Object o, Object n)
280 {
281 throw new Error("not implemented");
282 }
283
284 public void addResourceBundle(String name)
285 {
286 throw new Error("not implemented");
287 }
288
289 public void removeResourceBundle(String name)
290 {
291 throw new Error("not implemented");
292 }
293
294 public void setDefaultLocale(Locale l)
295 {
296 throw new Error("not implemented");
297 }
298
299 public Locale getDefaultLocale()
300 {
301 throw new Error("not implemented");
302 }
303} // class UIDefaults
Note: See TracBrowser for help on using the repository browser.