1 /* UIDefaults.java -- database for all settings and interface bindings.
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
40 import java.awt.Color;
41 import java.awt.Dimension;
43 import java.awt.Insets;
44 import java.beans.PropertyChangeListener;
45 import java.util.Hashtable;
46 import java.util.Locale;
47 import javax.swing.border.Border;
48 import javax.swing.plaf.ComponentUI;
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().
55 * @author Ronald Veldema (rveldema@cs.vu.nl)
57 public class UIDefaults extends Hashtable
61 Object createValue(UIDefaults table);
62 } // interface ActiveValue
64 public static class LazyInputMap implements LazyValue
66 public LazyInputMap(Object[] bindings)
69 public Object createValue(UIDefaults table)
71 throw new Error("not implemented");
73 } // class LazyInputMap
77 Object createValue(UIDefaults table);
78 } // interface LazyValue
80 public static class ProxyLazyValue implements LazyValue
82 public ProxyLazyValue(String s)
84 throw new Error("not implemented");
86 public ProxyLazyValue(String c, String m)
88 throw new Error("not implemented");
90 public ProxyLazyValue(String c, Object[] o)
92 throw new Error("not implemented");
94 public ProxyLazyValue(String c, String m, Object[] o)
96 throw new Error("not implemented");
98 public Object createValue(UIDefaults table)
100 throw new Error("not implemented");
102 } // class ProxyLazyValue
104 private static final long serialVersionUID = 7341222528856548117L;
110 public UIDefaults(Object[] entries)
115 public Object get(Object key)
117 // XXX Obey 1.4 specs
118 return super.get(key);
121 public Object get(Object key, Locale l)
123 throw new Error("not implemented");
126 public Object put(Object key, Object value)
128 throw new Error("not implemented");
131 public void putDefaults(Object[] list)
133 throw new Error("not implemented");
136 public Font getFont(Object key)
139 return o instanceof Font ? (Font) o : null;
142 public Font getFont(Object key, Locale l)
144 Object o = get(key, l);
145 return o instanceof Font ? (Font) o : null;
148 public Color getColor(Object key)
151 return o instanceof Color ? (Color) o : null;
154 public Color getColor(Object key, Locale l)
156 Object o = get(key, l);
157 return o instanceof Color ? (Color) o : null;
160 public Icon getIcon(Object key)
163 return o instanceof Icon ? (Icon) o : null;
166 public Icon getIcon(Object key, Locale l)
168 Object o = get(key, l);
169 return o instanceof Icon ? (Icon) o : null;
172 public Border getBorder(Object key)
175 return o instanceof Border ? (Border) o : null;
178 public Border getBorder(Object key, Locale l)
180 Object o = get(key, l);
181 return o instanceof Border ? (Border) o : null;
184 public String getString(Object key)
187 return o instanceof String ? (String) o : null;
190 public String getString(Object key, Locale l)
192 Object o = get(key, l);
193 return o instanceof String ? (String) o : null;
196 int getInt(Object key)
199 return o instanceof Integer ? ((Integer) o).intValue() : 0;
202 int getInt(Object key, Locale l)
204 Object o = get(key, l);
205 return o instanceof Integer ? ((Integer) o).intValue() : 0;
208 public boolean getBoolean(Object key)
210 return Boolean.TRUE.equals(get(key));
213 public boolean getBoolean(Object key, Locale l)
215 return Boolean.TRUE.equals(get(key, l));
218 public Insets getInsets(Object key)
221 return o instanceof Insets ? (Insets) o : null;
224 public Insets getInsets(Object key, Locale l)
226 Object o = get(key, l);
227 return o instanceof Insets ? (Insets) o : null;
230 public Dimension getDimension(Object key)
233 return o instanceof Dimension ? (Dimension) o : null;
236 public Dimension getDimension(Object key, Locale l)
238 Object o = get(key, l);
239 return o instanceof Dimension ? (Dimension) o : null;
242 public Class getUIClass(String id, ClassLoader loader)
244 throw new Error("not implemented");
247 public Class getUIClass(String id)
249 throw new Error("not implemented");
252 protected void getUIError(String msg)
254 // Does nothing unless overridden.
257 public ComponentUI getUI(JComponent a)
259 String pp = a.getUIClassID();
260 ComponentUI p = (ComponentUI) get(pp);
262 getUIError("failed to locate UI:" + pp);
266 void addPropertyChangeListener(PropertyChangeListener l)
268 throw new Error("not implemented");
271 void removePropertyChangeListener(PropertyChangeListener l)
273 throw new Error("not implemented");
276 public PropertyChangeListener[] getPropertyChangeListeners()
278 throw new Error("not implemented");
281 protected void firePropertyChange(String property, Object o, Object n)
283 throw new Error("not implemented");
286 void addResourceBundle(String name)
288 throw new Error("not implemented");
291 void removeResourceBundle(String name)
293 throw new Error("not implemented");
296 void setDefaultLocale(Locale l)
298 throw new Error("not implemented");
301 public Locale getDefaultLocale()
303 throw new Error("not implemented");
305 } // class UIDefaults