gcc/libjava/java/awt/Toolkit.java
Tom Tromey 3bd483f2a1 Start of AWT merge with Classpath:
* Makefile.in: Rebuilt.
	* Makefile.am (awt_java_source_files): Reference files in
	gnu/java/awt, not gnu/gcj/awt.
	* java/awt/image/BufferedImage.java: Updated copyright.
	* java/awt/image/ComponentColorModel.java: Updated copyright.
	* java/awt/image/ComponentSampleModel.java: Updated copyright.
	* java/awt/image/DataBuffer.java: Updated copyright.
	* java/awt/image/DataBufferByte.java: Updated copyright.
	* java/awt/image/DataBufferInt.java: Updated copyright.
	* java/awt/image/DataBufferUShort.java: Updated copyright.
	* java/awt/image/IndexColorModel.java: Updated copyright.
	* java/awt/image/PackedColorModel.java: Updated copyright.
	* java/awt/image/Raster.java: Updated copyright.
	* java/awt/image/RasterOp.java: Updated copyright.
	* java/awt/image/SampleModel.java: Updated copyright.
	* java/awt/image/SinglePixelPackedSampleModel.java: Updated copyright.
	* java/awt/image/WritableRaster.java: Updated copyright.
	* java/awt/color/ColorSpace.java: Updated copyright.
	* java/awt/color/ICC_ColorSpace.java: Updated copyright
	* java/awt/color/ICC_Profile.java: Updated copyright.
	* java/awt/event/HierarchyBoundsAdapter.java: Updated copyright.
	* java/awt/event/HierarchyBoundsListener.java: Updated copyright.
	* java/awt/event/HierarchyEvent.java: Updated copyright.
	* java/awt/event/HierarchyListener.java: Updated copyright.
	* java/awt/geom/AffineTransform.java: Updated copyright.
	* java/awt/geom/Dimension2D.java: Updated copyright.
	* java/awt/geom/Ellipse2D.java: Updated copyright.
	* java/awt/geom/IllegalPathStateException.java: Updated copyright.
	* java/awt/geom/Line2D.java: Updated copyright.
	* java/awt/geom/NoninvertibleTransformException.java: Updated
	copyright.
	* java/awt/geom/PathIterator.java: Updated copyright.
	* java/awt/geom/Point2D.java: Updated copyright.
	* java/awt/geom/Rectangle2D.java: Updated copyright.
	* java/awt/geom/RectangularShape.java: Updated copyright.
	* java/awt/geom/RoundRectangle2D.java: Updated copyright.
	* java/awt/Toolkit.java: Updated import for file moves.
	* java/awt/Rectangle.java: Updated copyright; added javadoc from
	Classpath.
	(hashCode): New method from Classpath.
	* java/awt/Graphics2D.java: Updated copyright.
	* java/awt/Transparency.java: Updated copyright.
	* java/awt/Paint.java: Updated copyright.
	* java/awt/Graphics.java: New version from Classpath.
	* java/awt/EventDispatchThread.java: Updated copyright.
	* java/awt/CardLayout.java (layoutContainer): Don't skip invisible
	children.
	(gotoComponent): Wrap around on next/previous.
	* gnu/gcj/awt/BitMaskExtent.java: Removed.
	* gnu/gcj/awt/Buffers.java: Removed.
	* gnu/gcj/awt/ComponentDataBlitOp.java: Removed.
	* gnu/gcj/awt/GLightweightPeer.java: Removed.
	* gnu/java/awt/BitMaskExtent.java: Added.
	* gnu/java/awt/Buffers.java: Added.
	* gnu/java/awt/ComponentDataBlitOp.java: Added.
	* gnu/java/awt/GLightweightPeer.java: Added.
	* java/awt/geom/Line2D.java (clone): Ignore
	CloneNotSupportedException.
	* gnu/gcj/awt/GLightweightPeer.java (getColorModel): New method.
	* java/awt/Frame.java: Merged with Classpath.
	* java/awt/RenderingHints.java: Copyright update.
	* java/awt/Paint.java: Copyright update.
	* java/awt/image/DirectColorModel.java: Merged with Classpath.
	* java/awt/image/ColorModel.java: Merged with Classpath.
	* java/awt/Window.java (show): New Implementation from Classpath.
	(isShowing): Use super.isShowing().
	* java/awt/EventQueue.java: Merged with Classpath.
	* java/awt/AWTEventMulticaster.java (save): Throw
	RuntimeException.
	(saveInternal): Likewise.
	* java/awt/AWTEvent.java: Now implements Serializable.
	* java/awt/Event.java: Copyright update.
	* java/awt/peer/ComponentPeer.java: Merged with Classpath.
	* java/awt/image/BufferedImage.java: Copyright update.
	* java/awt/GraphicsConfiguration.java: Copyright update.
	* java/awt/Component.java: (addNotify): Don't call
	addNotifyContainerChildren().
	(addNotifyContainerChildren): Removed.
	(setPeer): New method from Classpath.
	(setTreeLock): Likewise.
	(setVisible): Rewrote.
	(show): Use it.
	(hide): Likewise.
	(validate): Set `valid'.
	(checkImage(Image,ImageObserver)): Implementation from Classpath.
	(createImage(ImageProducer)): Likewise.
	(prepareImage): Likewise.
	* java/awt/Container.java (addImpl): Handle case where constraint
	is not a String.  Post event via system event queue.
	(remove): Post event via system event queue.
	(validateTree): Only validate child if it is invalid.
	(getAlignmentX): Call super method as default.
	(getAlignmentY): Likewise.
	(addContainerListener): Now synchronized.
	(removeContainerListener): Likewise.
	(addNotifyContainerChildren): Now private.
	* java/awt/ComponentOrientation.java: Updated copyright.  Added
	@author.
	* java/awt/FlowLayout.java (serialVersionUID): New field.
	(setAlignment): Better exception message.
	(layoutContainer): Don't compute component's preferred size unless
	we're going to use it.
	* java/awt/BorderLayout.java (AFTER_LAST_LINE, AFTER_LINE_ENDS,
	BEFORE_FIRST_LINE, BEFORE_LINE_BEGINS): New constants.
	(firstLine, lastLine, firstItem, lastItem): New fields.
	(addLayoutComponent): Handle case where constraints is null.
	Also, handle relative locations.
	(removeLayoutComponent): Handle relative locations.
	(MIN, MAX, PREF): New constants.
	(calcCompSize): New method.
	(calcSize): New method.
	(minimumLayoutSize): Use it.
	(preferredLayoutSize): Likewise.
	(maximumLayoutSize): Likewise.
	(toString): Include more information.
	(setBounds): New method.
	(layoutContainer): Use libgcj implementation; extended to handle
	relative locations.

From-SVN: r48896
2002-01-16 04:21:35 +00:00

264 lines
7.5 KiB
Java

/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
package java.awt;
import java.awt.peer.*;
import java.awt.event.*;
import java.net.URL;
import java.beans.*;
import java.awt.image.*;
import java.awt.datatransfer.Clipboard;
import java.util.Hashtable;
import gnu.java.awt.GLightweightPeer;
/* A very incomplete placeholder. */
public abstract class Toolkit
{
static Toolkit defaultToolkit;
PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
Hashtable desktopProperties = new Hashtable();
public static Toolkit getDefaultToolkit()
{
if (defaultToolkit != null)
return defaultToolkit;
Class toolkit_class;
String tk_class_name = System.getProperty("awt.toolkit");
if (tk_class_name == null)
tk_class_name = "gnu.awt.gtk.GtkToolkit";
try
{
toolkit_class = Class.forName(tk_class_name);
defaultToolkit = (Toolkit) toolkit_class.newInstance();
}
catch (Exception x)
{
throw new AWTError("Toolkit class " + tk_class_name +
" could not be initialized:\n " + x);
}
return defaultToolkit;
}
protected abstract ButtonPeer createButton(Button target);
protected abstract TextFieldPeer createTextField(TextField target);
protected abstract LabelPeer createLabel(Label target);
protected abstract ListPeer createList(List target);
protected abstract CheckboxPeer createCheckbox(Checkbox target);
protected abstract ScrollbarPeer createScrollbar(Scrollbar target);
protected abstract ScrollPanePeer createScrollPane(ScrollPane target);
protected abstract TextAreaPeer createTextArea(TextArea target);
protected abstract ChoicePeer createChoice(Choice target);
protected abstract FramePeer createFrame(Frame target);
protected abstract CanvasPeer createCanvas(Canvas target);
protected abstract PanelPeer createPanel(Panel target);
protected abstract WindowPeer createWindow(Window target);
protected abstract DialogPeer createDialog(Dialog target);
protected abstract MenuBarPeer createMenuBar(MenuBar target);
protected abstract MenuPeer createMenu(Menu target);
protected abstract PopupMenuPeer createPopupMenu(PopupMenu target);
protected abstract MenuItemPeer createMenuItem(MenuItem target);
protected abstract FileDialogPeer createFileDialog(FileDialog target);
protected abstract CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target);
protected LightweightPeer createComponent(Component target)
{
return GLightweightPeer.INSTANCE;
}
/* @deprecated Use GraphicsEnvironment.getAllFonts() */
protected abstract java.awt.peer.FontPeer getFontPeer(String name, int style);
/*
public abstract DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)
throws InvalidDnDOperationException;
*/
protected void loadSystemColors(int[] systemColors)
{
// FIXME
}
public abstract Dimension getScreenSize();
public abstract int getScreenResolution();
public abstract ColorModel getColorModel();
/* @deprecated Use GraphicsEnvironment.getAvailableFontFamilyNames() */
public abstract String[] getFontList();
public abstract FontMetrics getFontMetrics(Font font);
public abstract void sync();
public abstract Image getImage(String filename);
public abstract Image getImage(URL url);
public abstract Image createImage(String filename);
public abstract Image createImage(URL url);
public abstract boolean prepareImage(Image image, int width, int height,
ImageObserver observer);
public abstract int checkImage(Image image, int width, int height,
ImageObserver observer);
public abstract Image createImage(ImageProducer producer);
public Image createImage(byte[] imagedata)
{
return createImage (imagedata, 0, imagedata.length);
}
public abstract Image createImage(byte[] imagedata, int imageoffset,
int imagelength);
/*
public abstract PrintJob getPrintJob(Frame frame, String jobtitle,
Properties props);
public PrintJob getPrintJob(Frame frame, String jobtitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes)
{
}
*/
public abstract void beep();
public abstract Clipboard getSystemClipboard();
public int getMenuShortcutKeyMask()
{
return InputEvent.CTRL_MASK;
}
public boolean getLockingKeyState(int keyCode)
{
if (keyCode != KeyEvent.VK_CAPS_LOCK
&& keyCode != KeyEvent.VK_NUM_LOCK
&& keyCode != KeyEvent.VK_SCROLL_LOCK)
throw new IllegalArgumentException();
throw new UnsupportedOperationException();
}
public void setLockingKeyState(int keyCode, boolean on)
{
if (keyCode != KeyEvent.VK_CAPS_LOCK
&& keyCode != KeyEvent.VK_NUM_LOCK
&& keyCode != KeyEvent.VK_SCROLL_LOCK)
throw new IllegalArgumentException();
throw new UnsupportedOperationException();
}
protected static Container getNativeContainer(Component c)
{
while (c != null)
{
if (!c.isLightweight ())
return (Container) c;
c = c.getParent();
}
return null;
}
public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
throws IndexOutOfBoundsException
{
// Presumably the only reason this isn't abstract is for backwards
// compatibility? FIXME?
return null;
}
public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
{
return new Dimension (0,0);
}
public int getMaximumCursorColors()
{
return 0;
}
public static String getProperty(String key, String defaultValue)
{
// FIXME
return defaultValue;
}
public final EventQueue getSystemEventQueue()
{
return getSystemEventQueueImpl();
}
protected abstract EventQueue getSystemEventQueueImpl();
/*
public DragGestureRecognizer
createDragGestureRecognizer(Class abstractRecognizerClass, DragSource ds,
Component c, int srcActions,
DragGestureListener dgl)
{
// err... FIXME
return null;
}
*/
public final Object getDesktopProperty(String propertyName)
{
return desktopProperties.get(propertyName);
}
protected final void setDesktopProperty(String name, Object newValue)
{
Object oldValue = getDesktopProperty(name);
desktopProperties.put(name, newValue);
changeSupport.firePropertyChange(name, oldValue, newValue);
}
protected Object lazilyLoadDesktopProperty(String name)
{
// FIXME - what is this??
return null;
}
protected void initializeDesktopProperties()
{
// Overridden by toolkit implementation?
}
public void addPropertyChangeListener(String name,
PropertyChangeListener pcl)
{
changeSupport.addPropertyChangeListener(name, pcl);
}
public void removePropertyChangeListener(String name,
PropertyChangeListener pcl)
{
changeSupport.removePropertyChangeListener(name, pcl);
}
public void addAWTEventListener(AWTEventListener listener, long eventMask)
{
// SecurityManager s = System.getSecurityManager();
// if (s != null)
// s.checkPermission(AWTPermission("listenToAllAWTEvents"));
// FIXME
}
public void removeAWTEventListener(AWTEventListener listener)
{
// FIXME
}
/*
public abstract Map mapInputMethodHighlight(InputMethodHighlight highlight)
{
}
*/
}