Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org> Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139
This commit is contained in:
parent
abab460491
commit
ac1ed908de
1294 changed files with 99479 additions and 35933 deletions
|
@ -45,6 +45,7 @@ import java.awt.Insets;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.Serializable;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
|
@ -117,6 +118,87 @@ public class UIManager implements Serializable
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A UIDefaults subclass that multiplexes between itself and a 'fallback'
|
||||
* UIDefaults instance. This is used to protect the L&F UIDefaults from beeing
|
||||
* overwritten by applications.
|
||||
*/
|
||||
private static class MultiplexUIDefaults
|
||||
extends UIDefaults
|
||||
{
|
||||
private class MultiplexEnumeration
|
||||
implements Enumeration
|
||||
{
|
||||
Enumeration[] enums;
|
||||
int i;
|
||||
MultiplexEnumeration(Enumeration e1, Enumeration e2)
|
||||
{
|
||||
enums = new Enumeration[]{ e1, e2 };
|
||||
i = 0;
|
||||
}
|
||||
|
||||
public boolean hasMoreElements()
|
||||
{
|
||||
return enums[i].hasMoreElements() || i < enums.length - 1;
|
||||
}
|
||||
|
||||
public Object nextElement()
|
||||
{
|
||||
Object val = enums[i].nextElement();
|
||||
if (! enums[i].hasMoreElements() && i < enums.length - 1)
|
||||
i++;
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UIDefaults fallback;
|
||||
|
||||
MultiplexUIDefaults(UIDefaults d)
|
||||
{
|
||||
fallback = d;
|
||||
}
|
||||
|
||||
public Object get(Object key)
|
||||
{
|
||||
Object val = super.get(key);
|
||||
if (val == null)
|
||||
val = fallback.get(key);
|
||||
return val;
|
||||
}
|
||||
|
||||
public Object get(Object key, Locale l)
|
||||
{
|
||||
Object val = super.get(key, l);
|
||||
if (val == null)
|
||||
val = fallback.get(key, l);
|
||||
return val;
|
||||
}
|
||||
|
||||
public Object remove(Object key)
|
||||
{
|
||||
Object val = super.remove(key);
|
||||
if (val == null)
|
||||
val = fallback.remove(key);
|
||||
return val;
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return super.size() + fallback.size();
|
||||
}
|
||||
|
||||
public Enumeration keys()
|
||||
{
|
||||
return new MultiplexEnumeration(super.keys(), fallback.keys());
|
||||
}
|
||||
|
||||
public Enumeration elements()
|
||||
{
|
||||
return new MultiplexEnumeration(super.elements(), fallback.elements());
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -5547433830339189365L;
|
||||
|
||||
/** The installed look and feel(s). */
|
||||
|
@ -131,12 +213,9 @@ public class UIManager implements Serializable
|
|||
/** The current look and feel. */
|
||||
static LookAndFeel currentLookAndFeel;
|
||||
|
||||
static UIDefaults currentUIDefaults;
|
||||
static MultiplexUIDefaults currentUIDefaults;
|
||||
|
||||
/**
|
||||
* UIDefaults set by the user.
|
||||
*/
|
||||
static UIDefaults userUIDefaults;
|
||||
static UIDefaults lookAndFeelDefaults;
|
||||
|
||||
/** Property change listener mechanism. */
|
||||
static PropertyChangeSupport listeners
|
||||
|
@ -149,9 +228,7 @@ public class UIManager implements Serializable
|
|||
{
|
||||
if (defaultlaf != null)
|
||||
{
|
||||
Class lafClass = Class.forName(defaultlaf);
|
||||
LookAndFeel laf = (LookAndFeel) lafClass.newInstance();
|
||||
setLookAndFeel(laf);
|
||||
setLookAndFeel(defaultlaf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -162,6 +239,7 @@ public class UIManager implements Serializable
|
|||
{
|
||||
System.err.println("cannot initialize Look and Feel: " + defaultlaf);
|
||||
System.err.println("error: " + ex.toString());
|
||||
ex.printStackTrace();
|
||||
System.err.println("falling back to Metal Look and Feel");
|
||||
try
|
||||
{
|
||||
|
@ -312,12 +390,7 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static Object get(Object key)
|
||||
{
|
||||
Object val = null;
|
||||
if (userUIDefaults != null)
|
||||
val = userUIDefaults.get(key);
|
||||
if (val == null)
|
||||
val = getLookAndFeelDefaults().get(key);
|
||||
return val;
|
||||
return getDefaults().get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,12 +403,7 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static Object get(Object key, Locale locale)
|
||||
{
|
||||
Object val = null;
|
||||
if (userUIDefaults != null)
|
||||
val = userUIDefaults.get(key, locale);
|
||||
if (val == null)
|
||||
val = getLookAndFeelDefaults().get(key, locale);
|
||||
return val;
|
||||
return getDefaults().get(key, locale);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,6 +482,8 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static UIDefaults getDefaults()
|
||||
{
|
||||
if (currentUIDefaults == null)
|
||||
currentUIDefaults = new MultiplexUIDefaults(null);
|
||||
return currentUIDefaults;
|
||||
}
|
||||
|
||||
|
@ -546,7 +616,7 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static UIDefaults getLookAndFeelDefaults()
|
||||
{
|
||||
return currentUIDefaults;
|
||||
return lookAndFeelDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -587,13 +657,7 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static ComponentUI getUI(JComponent target)
|
||||
{
|
||||
ComponentUI ui = null;
|
||||
if (userUIDefaults != null
|
||||
&& userUIDefaults.get(target.getUIClassID()) != null)
|
||||
ui = userUIDefaults.getUI(target);
|
||||
if (ui == null)
|
||||
ui = currentUIDefaults.getUI(target);
|
||||
return ui;
|
||||
return getDefaults().getUI(target);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -625,11 +689,7 @@ public class UIManager implements Serializable
|
|||
*/
|
||||
public static Object put(Object key, Object value)
|
||||
{
|
||||
Object old = get(key);
|
||||
if (userUIDefaults == null)
|
||||
userUIDefaults = new UIDefaults();
|
||||
userUIDefaults.put(key, value);
|
||||
return old;
|
||||
return getDefaults().put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -654,7 +714,8 @@ public class UIManager implements Serializable
|
|||
throws UnsupportedLookAndFeelException
|
||||
{
|
||||
if (newLookAndFeel != null && ! newLookAndFeel.isSupportedLookAndFeel())
|
||||
throw new UnsupportedLookAndFeelException(newLookAndFeel.getName());
|
||||
throw new UnsupportedLookAndFeelException(newLookAndFeel.getName()
|
||||
+ " not supported on this platform");
|
||||
LookAndFeel oldLookAndFeel = currentLookAndFeel;
|
||||
if (oldLookAndFeel != null)
|
||||
oldLookAndFeel.uninitialize();
|
||||
|
@ -664,7 +725,12 @@ public class UIManager implements Serializable
|
|||
if (newLookAndFeel != null)
|
||||
{
|
||||
newLookAndFeel.initialize();
|
||||
currentUIDefaults = newLookAndFeel.getDefaults();
|
||||
lookAndFeelDefaults = newLookAndFeel.getDefaults();
|
||||
if (currentUIDefaults == null)
|
||||
currentUIDefaults =
|
||||
new MultiplexUIDefaults(lookAndFeelDefaults);
|
||||
else
|
||||
currentUIDefaults.fallback = lookAndFeelDefaults;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -689,7 +755,8 @@ public class UIManager implements Serializable
|
|||
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
|
||||
UnsupportedLookAndFeelException
|
||||
{
|
||||
Class c = Class.forName(className);
|
||||
Class c = Class.forName(className, true,
|
||||
Thread.currentThread().getContextClassLoader());
|
||||
LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception
|
||||
setLookAndFeel(a);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue