Imported Classpath 0.18.

* sources.am, Makefile.in: Updated.
	* Makefile.am (nat_source_files): Removed natProxy.cc.
	* java/lang/reflect/natProxy.cc: Removed.
	* gnu/classpath/jdwp/VMFrame.java,
	gnu/classpath/jdwp/VMIdManager.java,
	gnu/classpath/jdwp/VMVirtualMachine.java,
	java/lang/reflect/VMProxy.java: New files.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC
	list.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/net/DefaultContentHandlerFactory.java (getContent):
	Remove ClasspathToolkit references.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/awt/xlib/XCanvasPeer.java: Add new peer methods.
	* gnu/awt/xlib/XFramePeer.java: Likewise.
	* gnu/awt/xlib/XGraphicsConfiguration.java: Likewise.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c.  Add
	classpath/native/jawt/jawt.c.
	* Makefile.in: Regenerate.
	* jawt.c: Remove file.
	* include/Makefile.am (tool_include__HEADERS): Remove jawt.h and
	jawt_md.h.  Add ../classpath/include/jawt.h and
	../classpath/include/jawt_md.h.
	* include/Makefile.in: Regenerate.
	* include/jawt.h: Regenerate.
	* include/jawt_md.h: Regenerate.

From-SVN: r104586
This commit is contained in:
Tom Tromey 2005-09-23 21:31:04 +00:00
parent 9b044d1951
commit 1ea63ef8be
544 changed files with 34724 additions and 14512 deletions

View file

@ -47,15 +47,31 @@ import java.io.Serializable;
import java.util.Locale;
import javax.swing.border.Border;
import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* Manages the current {@link LookAndFeel} and any auxiliary {@link LookAndFeel}
* instances.
*/
public class UIManager implements Serializable
{
/**
* Represents the basic information about a {@link LookAndFeel} (LAF), so
* that a list of installed LAFs can be presented without actually loading
* the LAF class(es).
*/
public static class LookAndFeelInfo
{
String name, clazz;
/**
* Creates a new instance.
*
* @param name the look and feel name.
* @param clazz the look and feel class name.
*/
public LookAndFeelInfo(String name,
String clazz)
{
@ -63,11 +79,21 @@ public class UIManager implements Serializable
this.clazz = clazz;
}
/**
* Returns the name of the look and feel.
*
* @return The name of the look and feel.
*/
public String getName()
{
return name;
}
/**
* Returns the fully qualified class name for the {@link LookAndFeel}.
*
* @return The fully qualified class name for the {@link LookAndFeel}.
*/
public String getClassName()
{
return clazz;
@ -93,13 +119,22 @@ public class UIManager implements Serializable
private static final long serialVersionUID = -5547433830339189365L;
/** The installed look and feel(s). */
static LookAndFeelInfo [] installed = {
new LookAndFeelInfo ("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
new LookAndFeelInfo("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
};
static LookAndFeel[] aux_installed;
/** The installed auxiliary look and feels. */
static LookAndFeel[] auxLookAndFeels;
static LookAndFeel look_and_feel = new MetalLookAndFeel();
/** The current look and feel. */
static LookAndFeel currentLookAndFeel;
static UIDefaults currentUIDefaults;
/** Property change listener mechanism. */
static SwingPropertyChangeSupport listeners
= new SwingPropertyChangeSupport(UIManager.class);
static
{
@ -115,11 +150,19 @@ public class UIManager implements Serializable
catch (Exception ex)
{
System.err.println("cannot initialize Look and Feel: " + defaultlaf);
System.err.println("errot: " + ex.getMessage());
System.err.println("error: " + ex.getMessage());
System.err.println("falling back to Metal Look and Feel");
}
}
currentLookAndFeel = new MetalLookAndFeel();
currentLookAndFeel.initialize();
currentUIDefaults = currentLookAndFeel.getDefaults();
}
/**
* Creates a new instance of the <code>UIManager</code>. There is no need
* to construct an instance of this class, since all methods are static.
*/
public UIManager()
{
// Do nothing here.
@ -132,7 +175,7 @@ public class UIManager implements Serializable
*/
public static void addPropertyChangeListener(PropertyChangeListener listener)
{
// FIXME
listeners.addPropertyChangeListener(listener);
}
/**
@ -140,9 +183,10 @@ public class UIManager implements Serializable
*
* @param listener the listener to remove
*/
public static void removePropertyChangeListener(PropertyChangeListener listener)
public static void removePropertyChangeListener(PropertyChangeListener
listener)
{
// FIXME
listeners.removePropertyChangeListener(listener);
}
/**
@ -154,60 +198,117 @@ public class UIManager implements Serializable
*/
public static PropertyChangeListener[] getPropertyChangeListeners()
{
// FIXME
throw new Error ("Not implemented");
return listeners.getPropertyChangeListeners();
}
/**
* Add a LookAndFeel to the list of auxiliary look and feels.
* Add a {@link LookAndFeel} to the list of auxiliary look and feels.
*
* @param laf the auxiliary look and feel (<code>null</code> not permitted).
*
* @throws NullPointerException if <code>laf</code> is <code>null</code>.
*
* @see #getAuxiliaryLookAndFeels()
*/
public static void addAuxiliaryLookAndFeel (LookAndFeel l)
public static void addAuxiliaryLookAndFeel(LookAndFeel laf)
{
if (aux_installed == null)
if (laf == null)
throw new NullPointerException("Null 'laf' argument.");
if (auxLookAndFeels == null)
{
aux_installed = new LookAndFeel[1];
aux_installed[0] = l;
auxLookAndFeels = new LookAndFeel[1];
auxLookAndFeels[0] = laf;
return;
}
LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ];
System.arraycopy(aux_installed, 0, T, 0, aux_installed.length);
aux_installed = T;
aux_installed[aux_installed.length-1] = l;
LookAndFeel[] temp = new LookAndFeel[auxLookAndFeels.length + 1];
System.arraycopy(auxLookAndFeels, 0, temp, 0, auxLookAndFeels.length);
auxLookAndFeels = temp;
auxLookAndFeels[auxLookAndFeels.length - 1] = laf;
}
/**
* Removes a {@link LookAndFeel} (LAF) from the list of auxiliary LAFs.
*
* @param laf the LAF to remove.
*
* @return <code>true</code> if the LAF was removed, and <code>false</code>
* otherwise.
*/
public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
{
if (aux_installed == null)
if (auxLookAndFeels == null)
return false;
for (int i=0;i<aux_installed.length;i++)
int count = auxLookAndFeels.length;
if (count == 1 && auxLookAndFeels[0] == laf)
{
if (aux_installed[i] == laf)
auxLookAndFeels = null;
return true;
}
for (int i = 0; i < count; i++)
{
if (auxLookAndFeels[i] == laf)
{
aux_installed[ i ] = aux_installed[aux_installed.length-1];
LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ];
System.arraycopy (aux_installed, 0, T, 0, aux_installed.length-1);
aux_installed = T;
LookAndFeel[] temp = new LookAndFeel[auxLookAndFeels.length - 1];
if (i == 0)
{
System.arraycopy(auxLookAndFeels, 1, temp, 0, count - 1);
}
else if (i == count - 1)
{
System.arraycopy(auxLookAndFeels, 0, temp, 0, count - 1);
}
else
{
System.arraycopy(auxLookAndFeels, 0, temp, 0, i);
System.arraycopy(auxLookAndFeels, i + 1, temp, i,
count - i - 1);
}
auxLookAndFeels = temp;
return true;
}
}
return false;
}
public static LookAndFeel[] getAuxiliaryLookAndFeels()
/**
* Returns an array (possibly <code>null</code>) containing the auxiliary
* {@link LookAndFeel}s that are in use. These are used by the
* {@link javax.swing.plaf.multi.MultiLookAndFeel} class.
*
* @return The auxiliary look and feels (possibly <code>null</code>).
*
* @see #addAuxiliaryLookAndFeel(LookAndFeel)
*/
public static LookAndFeel[] getAuxiliaryLookAndFeels()
{
return aux_installed;
return auxLookAndFeels;
}
public static Object get(Object key)
/**
* Returns an object from the {@link UIDefaults} table for the current
* {@link LookAndFeel}.
*
* @param key the key.
*
* @return The object.
*/
public static Object get(Object key)
{
return getLookAndFeel().getDefaults().get(key);
return getLookAndFeelDefaults().get(key);
}
public static Object get(Object key, Locale locale)
/**
* Returns an object from the {@link UIDefaults} table for the current
* {@link LookAndFeel}.
*
* @param key the key.
*
* @return The object.
*/
public static Object get(Object key, Locale locale)
{
return getLookAndFeel().getDefaults().get(key ,locale);
return getLookAndFeelDefaults().get(key ,locale);
}
/**
@ -218,7 +319,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key)
{
Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key);
Boolean value = (Boolean) getLookAndFeelDefaults().get(key);
return value != null ? value.booleanValue() : false;
}
@ -230,7 +331,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key, Locale locale)
{
Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale);
Boolean value = (Boolean) getLookAndFeelDefaults().get(key, locale);
return value != null ? value.booleanValue() : false;
}
@ -239,7 +340,7 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key)
{
return (Border) getLookAndFeel().getDefaults().get(key);
return (Border) getLookAndFeelDefaults().get(key);
}
/**
@ -249,39 +350,44 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key, Locale locale)
{
return (Border) getLookAndFeel().getDefaults().get(key, locale);
return (Border) getLookAndFeelDefaults().get(key, locale);
}
/**
* Returns a drawing color from the defaults table.
*/
public static Color getColor(Object key)
public static Color getColor(Object key)
{
return (Color) getLookAndFeel().getDefaults().get(key);
return (Color) getLookAndFeelDefaults().get(key);
}
/**
* Returns a drawing color from the defaults table.
*/
public static Color getColor(Object key, Locale locale)
public static Color getColor(Object key, Locale locale)
{
return (Color) getLookAndFeel().getDefaults().get(key);
return (Color) getLookAndFeelDefaults().get(key);
}
/**
* this string can be passed to Class.forName()
* The fully qualified class name of the cross platform (Metal) look and feel.
* This string can be passed to Class.forName()
*
* @return <code>"javax.swing.plaf.metal.MetalLookAndFeel"</code>
*/
public static String getCrossPlatformLookAndFeelClassName()
public static String getCrossPlatformLookAndFeelClassName()
{
return "javax.swing.plaf.metal.MetalLookAndFeel";
}
/**
* Returns the default values for this look and feel.
*
* @return The {@link UIDefaults} for the current {@link LookAndFeel}.
*/
public static UIDefaults getDefaults()
{
return getLookAndFeel().getDefaults();
return currentUIDefaults;
}
/**
@ -289,7 +395,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key)
{
return (Dimension) getLookAndFeel().getDefaults().get(key);
return (Dimension) getLookAndFeelDefaults().get(key);
}
/**
@ -297,7 +403,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key, Locale locale)
{
return (Dimension) getLookAndFeel().getDefaults().get(key, locale);
return (Dimension) getLookAndFeelDefaults().get(key, locale);
}
/**
@ -310,7 +416,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key)
{
return (Font) getLookAndFeel().getDefaults().get(key);
return (Font) getLookAndFeelDefaults().get(key);
}
/**
@ -323,7 +429,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key, Locale locale)
{
return (Font) getLookAndFeel().getDefaults().get(key ,locale);
return (Font) getLookAndFeelDefaults().get(key ,locale);
}
/**
@ -331,7 +437,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key)
{
return (Icon) getLookAndFeel().getDefaults().get(key);
return (Icon) getLookAndFeelDefaults().get(key);
}
/**
@ -339,7 +445,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key, Locale locale)
{
return (Icon) getLookAndFeel().getDefaults().get(key, locale);
return (Icon) getLookAndFeelDefaults().get(key, locale);
}
/**
@ -347,7 +453,7 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key)
{
return (Insets) getLookAndFeel().getDefaults().getInsets(key);
return getLookAndFeelDefaults().getInsets(key);
}
/**
@ -355,9 +461,15 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key, Locale locale)
{
return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale);
return getLookAndFeelDefaults().getInsets(key, locale);
}
/**
* Returns an array containing information about the {@link LookAndFeel}s
* that are installed.
*
* @return A list of the look and feels that are available (installed).
*/
public static LookAndFeelInfo[] getInstalledLookAndFeels()
{
return installed;
@ -365,7 +477,7 @@ public class UIManager implements Serializable
public static int getInt(Object key)
{
Integer x = (Integer) getLookAndFeel().getDefaults().get(key);
Integer x = (Integer) getLookAndFeelDefaults().get(key);
if (x == null)
return 0;
return x.intValue();
@ -373,24 +485,33 @@ public class UIManager implements Serializable
public static int getInt(Object key, Locale locale)
{
Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale);
Integer x = (Integer) getLookAndFeelDefaults().get(key, locale);
if (x == null)
return 0;
return x.intValue();
}
/**
* Returns the current look and feel (which may be <code>null</code>).
*
* @return The current look and feel.
*
* @see #setLookAndFeel(LookAndFeel)
*/
public static LookAndFeel getLookAndFeel()
{
return look_and_feel;
return currentLookAndFeel;
}
/**
* Returns the <code>UIDefaults</code> table of the currently active
* look and feel.
*
* @return The {@link UIDefaults} for the current {@link LookAndFeel}.
*/
public static UIDefaults getLookAndFeelDefaults()
{
return getLookAndFeel().getDefaults();
return currentUIDefaults;
}
/**
@ -398,7 +519,7 @@ public class UIManager implements Serializable
*/
public static String getString(Object key)
{
return (String) getLookAndFeel().getDefaults().get(key);
return (String) getLookAndFeelDefaults().get(key);
}
/**
@ -406,13 +527,17 @@ public class UIManager implements Serializable
*/
public static String getString(Object key, Locale locale)
{
return (String) getLookAndFeel().getDefaults().get(key, locale);
return (String) getLookAndFeelDefaults().get(key, locale);
}
/**
* Returns the name of the LookAndFeel class that implements the
* Returns the name of the {@link LookAndFeel} class that implements the
* native systems look and feel if there is one, otherwise the name
* of the default cross platform LookAndFeel class.
*
* @return The fully qualified class name for the system look and feel.
*
* @see #getCrossPlatformLookAndFeelClassName()
*/
public static String getSystemLookAndFeelClassName()
{
@ -420,18 +545,26 @@ public class UIManager implements Serializable
}
/**
* Returns the Look and Feel object that renders the target component.
* Returns UI delegate from the current {@link LookAndFeel} that renders the
* target component.
*
* @param target the target component.
*/
public static ComponentUI getUI(JComponent target)
{
return getDefaults().getUI(target);
return getLookAndFeelDefaults().getUI(target);
}
/**
* Creates a new look and feel and adds it to the current array.
*
* @param name the look and feel name.
* @param className the fully qualified name of the class that implements the
* look and feel.
*/
public static void installLookAndFeel(String name, String className)
{
installLookAndFeel(new LookAndFeelInfo(name, className));
}
/**
@ -440,6 +573,7 @@ public class UIManager implements Serializable
*/
public static void installLookAndFeel(LookAndFeelInfo info)
{
// FIXME: not yet implemented
}
/**
@ -447,7 +581,7 @@ public class UIManager implements Serializable
*/
public static Object put(Object key, Object value)
{
return getLookAndFeel().getDefaults().put(key,value);
return getLookAndFeelDefaults().put(key,value);
}
/**
@ -455,32 +589,56 @@ public class UIManager implements Serializable
*/
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
{
// FIXME: not yet implemented.
}
/**
* Set the current default look.
* Sets the current {@link LookAndFeel}.
*
* @param newLookAndFeel the new look and feel (<code>null</code> permitted).
*
* @throws UnsupportedLookAndFeelException if the look and feel is not
* supported on the current platform.
*
* @see LookAndFeel#isSupportedLookAndFeel()
*/
public static void setLookAndFeel(LookAndFeel newLookAndFeel)
throws UnsupportedLookAndFeelException
{
if (! newLookAndFeel.isSupportedLookAndFeel())
if (newLookAndFeel != null && ! newLookAndFeel.isSupportedLookAndFeel())
throw new UnsupportedLookAndFeelException(newLookAndFeel.getName());
if (look_and_feel != null)
look_and_feel.uninitialize();
LookAndFeel oldLookAndFeel = currentLookAndFeel;
if (oldLookAndFeel != null)
oldLookAndFeel.uninitialize();
// Set the current default look and feel using a LookAndFeel object.
look_and_feel = newLookAndFeel;
look_and_feel.initialize();
currentLookAndFeel = newLookAndFeel;
if (newLookAndFeel != null)
{
newLookAndFeel.initialize();
currentUIDefaults = newLookAndFeel.getDefaults();
}
else
{
currentUIDefaults = null;
}
listeners.firePropertyChange("lookAndFeel", oldLookAndFeel, newLookAndFeel);
//revalidate();
//repaint();
}
/**
* Set the current default look and feel using a class name.
*
* @param className the look and feel class name.
*
* @throws UnsupportedLookAndFeelException if the look and feel is not
* supported on the current platform.
*
* @see LookAndFeel#isSupportedLookAndFeel()
*/
public static void setLookAndFeel (String className)
public static void setLookAndFeel(String className)
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
UnsupportedLookAndFeelException
{