Commit 7365ecf7 by Michael Koch Committed by Michael Koch

2003-01-14 Michael Koch <konqueror@gmx.de>

	* java/awt/Label.java
	(Label): Implements javax.accessibility.Accessible;
	* java/awt/List.java
	(List): Implements javax.accessibility.Accessible;
	* java/awt/ScrollPane.java
	(ScrollPane): Implements javax.accessibility.Accessible;
	* java/awt/Scrollbar.java
	(Scrollbar): Implements javax.accessibility.Accessible;
	* java/awt/TextComponent.java
	(setCaretPosition): Throw exception, documentation added.
	* java/awt/Toolkit.java:
	Added some newlines in method documentations.
	(createButton): Exception documentation added.
	(createTextField): Exception documentation added.
	(createLabel): Exception documentation added.
	(createList): Exception documentation added.
	(createCheckbox): Exception documentation added.
	(createScrollbar): Exception documentation added.
	(createScrollPane): Exception documentation added.
	(createTextArea): Exception documentation added.
	(createChoice): Exception documentation added.
	(createFrame): Exception documentation added.
	(createWindow): Exception documentation added.
	(createDialog): Exception documentation added.
	(createMenuBar): Exception documentation added.
	(createMenu): Exception documentation added.
	(createMenuItem): Exception documentation added.
	(createFileDialog): Exception documentation added.
	(createCheckboxMenuItem): Exception documentation added.
	(loadSystemColors): Exception documentation added.
	(setDynamicLayout): Exception documentation added.
	(isDynamicLayoutSet): Exception documentation added.
	(isDynamicLayoutActive): Exception documentation added.
	(getScreenSize): Exception documentation added.
	(getScreenResolution): Exception documentation added.
	(getScreenInsets): Exception documentation added.
	(getColorModel): Exception documentation added.
	(getSystemClipboard): Exception documentation added.
	(getSystemSelection): Exception documentation added.
	(getMenuShortcutKeyMask): Exception documentation added.
	(getSystemEventQueue): Exception documentation added.
	* java/awt/Window.java:
	Reindented some code.
	(Window): Centralized implementation, documentation added.
	(finalize): Documentation added.
	(hide): Fixed typo in comment.
	(getWindowListeners): Documentation added.
	* java/awt/color/ColorSpace.java
	(toRGB): Documentation added.
	* java/awt/color/ICC_ColorSpace.java
	(ICC_ColorSpace): Documentation added.
	(toRGB): Throw exception, documentation added.
	(fromRGB): Throw exception, documentation added.
	(toCIEXYZ): Documentation added.
	(fromCIEXYZ): Documentation added.
	(getMinValue): Documentation added.
	(getMaxValue): Documentation added.
	* java/awt/geom/Dimension2D.java
	(clone): Documentation added.
	* java/awt/geom/GeneralPath.java
	(clone): Documentation added.
	* java/awt/geom/Line2D.java
	(clone): Documentation added.
	* java/awt/geom/QuadCurve2D.java
	(clone): Documentation added.
	* java/awt/image/ColorModel.java
	(ColorModel): Throw exception, documentation added.
	* java/awt/image/ImageFilter.java
	(clone): Doesnt throw CloneNotSupportedException.

From-SVN: r61303
parent b41621ee
2003-01-14 Michael Koch <konqueror@gmx.de>
* java/awt/Label.java
(Label): Implements javax.accessibility.Accessible;
* java/awt/List.java
(List): Implements javax.accessibility.Accessible;
* java/awt/ScrollPane.java
(ScrollPane): Implements javax.accessibility.Accessible;
* java/awt/Scrollbar.java
(Scrollbar): Implements javax.accessibility.Accessible;
* java/awt/TextComponent.java
(setCaretPosition): Throw exception, documentation added.
* java/awt/Toolkit.java:
Added some newlines in method documentations.
(createButton): Exception documentation added.
(createTextField): Exception documentation added.
(createLabel): Exception documentation added.
(createList): Exception documentation added.
(createCheckbox): Exception documentation added.
(createScrollbar): Exception documentation added.
(createScrollPane): Exception documentation added.
(createTextArea): Exception documentation added.
(createChoice): Exception documentation added.
(createFrame): Exception documentation added.
(createWindow): Exception documentation added.
(createDialog): Exception documentation added.
(createMenuBar): Exception documentation added.
(createMenu): Exception documentation added.
(createMenuItem): Exception documentation added.
(createFileDialog): Exception documentation added.
(createCheckboxMenuItem): Exception documentation added.
(loadSystemColors): Exception documentation added.
(setDynamicLayout): Exception documentation added.
(isDynamicLayoutSet): Exception documentation added.
(isDynamicLayoutActive): Exception documentation added.
(getScreenSize): Exception documentation added.
(getScreenResolution): Exception documentation added.
(getScreenInsets): Exception documentation added.
(getColorModel): Exception documentation added.
(getSystemClipboard): Exception documentation added.
(getSystemSelection): Exception documentation added.
(getMenuShortcutKeyMask): Exception documentation added.
(getSystemEventQueue): Exception documentation added.
* java/awt/Window.java:
Reindented some code.
(Window): Centralized implementation, documentation added.
(finalize): Documentation added.
(hide): Fixed typo in comment.
(getWindowListeners): Documentation added.
* java/awt/color/ColorSpace.java
(toRGB): Documentation added.
* java/awt/color/ICC_ColorSpace.java
(ICC_ColorSpace): Documentation added.
(toRGB): Throw exception, documentation added.
(fromRGB): Throw exception, documentation added.
(toCIEXYZ): Documentation added.
(fromCIEXYZ): Documentation added.
(getMinValue): Documentation added.
(getMaxValue): Documentation added.
* java/awt/geom/Dimension2D.java
(clone): Documentation added.
* java/awt/geom/GeneralPath.java
(clone): Documentation added.
* java/awt/geom/Line2D.java
(clone): Documentation added.
* java/awt/geom/QuadCurve2D.java
(clone): Documentation added.
* java/awt/image/ColorModel.java
(ColorModel): Throw exception, documentation added.
* java/awt/image/ImageFilter.java
(clone): Doesnt throw CloneNotSupportedException.
2003-01-14 Andrew Haley <aph@redhat.com> 2003-01-14 Andrew Haley <aph@redhat.com>
* java/lang/natRuntime.cc (_load): StackTrace access needs to be * java/lang/natRuntime.cc (_load): StackTrace access needs to be
......
...@@ -40,6 +40,8 @@ package java.awt; ...@@ -40,6 +40,8 @@ package java.awt;
import java.awt.peer.LabelPeer; import java.awt.peer.LabelPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.io.Serializable;
import javax.accessibility.Accessible;
/** /**
* This component is used for displaying simple text strings that cannot * This component is used for displaying simple text strings that cannot
...@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer; ...@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer;
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
*/ */
public class Label extends Component implements java.io.Serializable public class Label extends Component implements Serializable, Accessible
{ {
/* /*
......
...@@ -46,13 +46,15 @@ import java.awt.event.ItemListener; ...@@ -46,13 +46,15 @@ import java.awt.event.ItemListener;
import java.awt.peer.ListPeer; import java.awt.peer.ListPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.util.Vector; import java.util.Vector;
import javax.accessibility.Accessible;
/** /**
* Class that implements a listbox widget * Class that implements a listbox widget
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class List extends Component implements ItemSelectable, Serializable public class List extends Component
implements ItemSelectable, Serializable, Accessible
{ {
/* /*
......
...@@ -41,6 +41,8 @@ package java.awt; ...@@ -41,6 +41,8 @@ package java.awt;
import java.awt.peer.ScrollPanePeer; import java.awt.peer.ScrollPanePeer;
import java.awt.peer.ContainerPeer; import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.io.Serializable;
import javax.accessibility.Accessible;
/** /**
* This widget provides a scrollable region that allows a single * This widget provides a scrollable region that allows a single
...@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer; ...@@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer;
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class ScrollPane extends Container implements java.io.Serializable public class ScrollPane extends Container implements Accessible, Serializable
{ {
/* /*
......
...@@ -42,6 +42,8 @@ import java.awt.peer.ScrollbarPeer; ...@@ -42,6 +42,8 @@ import java.awt.peer.ScrollbarPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentEvent;
import java.io.Serializable;
import javax.accessibility.Accessible;
/** /**
* This class implements a scrollbar widget. * This class implements a scrollbar widget.
...@@ -49,8 +51,9 @@ import java.awt.event.AdjustmentEvent; ...@@ -49,8 +51,9 @@ import java.awt.event.AdjustmentEvent;
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
*/ */
public class Scrollbar extends Component implements Adjustable, public class Scrollbar extends Component implements Accessible,
java.io.Serializable Adjustable,
Serializable
{ {
// FIXME: Serialization readObject/writeObject // FIXME: Serialization readObject/writeObject
......
...@@ -291,10 +291,18 @@ getCaretPosition() ...@@ -291,10 +291,18 @@ getCaretPosition()
* Sets the caret position to the specified value. * Sets the caret position to the specified value.
* *
* @param caretPosition The new caret position. * @param caretPosition The new caret position.
*
* @exception IllegalArgumentException If the value supplied for position
* is less than zero.
*
* @since 1.1
*/ */
public synchronized void public synchronized void
setCaretPosition(int caretPosition) setCaretPosition(int caretPosition)
{ {
if (caretPosition < 0)
throw new IllegalArgumentException ();
TextComponentPeer tcp = (TextComponentPeer)getPeer(); TextComponentPeer tcp = (TextComponentPeer)getPeer();
if (tcp != null) if (tcp != null)
tcp.setCaretPosition(caretPosition); tcp.setCaretPosition(caretPosition);
......
...@@ -86,32 +86,56 @@ public class Window extends Container ...@@ -86,32 +86,56 @@ public class Window extends Container
* parent. The window will initially be invisible. * parent. The window will initially be invisible.
* *
* @param parent The owning <code>Frame</code> of this window. * @param parent The owning <code>Frame</code> of this window.
*
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
* is not from a screen device, or if owner is null; this exception is always
* thrown when GraphicsEnvironment.isHeadless returns true.
*/ */
public Window(Frame owner) public Window(Frame owner)
{ {
this((Window) owner); this (owner, owner.getGraphicsConfiguration ());
} }
/** @since 1.2 */ /**
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
*
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
* is not from a screen device, or if owner is null; this exception is always
* thrown when GraphicsEnvironment.isHeadless returns true.
*
* @since 1.2
*/
public Window(Window owner) public Window(Window owner)
{ {
this(); this (owner, owner.getGraphicsConfiguration ());
if (owner == null)
throw new IllegalArgumentException("owner must not be null");
this.parent = owner;
// FIXME: add to owner's "owned window" list
//owner.owned.add(this); // this should be a weak reference
} }
/** @since 1.3 */ /**
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
*
* @exception IllegalArgumentException If owner is null or if gc is not from a
* screen device; this exception is always thrown when
* GraphicsEnvironment.isHeadless returns true.
*
* @since 1.3
*/
public Window(Window owner, GraphicsConfiguration gc) public Window(Window owner, GraphicsConfiguration gc)
{ {
this(owner); this ();
if (owner == null)
throw new IllegalArgumentException ("owner must not be null");
this.parent = owner;
// FIXME: add to owner's "owned window" list
//owner.owned.add(this); // this should be a weak reference
/* FIXME: Security check /* FIXME: Security check
SecurityManager.checkTopLevelWindow(...) SecurityManager.checkTopLevelWindow(...)
*/
if (gc != null if (gc != null
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
...@@ -119,11 +143,10 @@ public class Window extends Container ...@@ -119,11 +143,10 @@ public class Window extends Container
if (gc == null) if (gc == null)
graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice() .getDefaultScreenDevice()
.getDefaultConfiguration(); .getDefaultConfiguration();
else else
*/ graphicsConfiguration = gc;
graphicsConfiguration = gc;
} }
GraphicsConfiguration getGraphicsConfigurationImpl() GraphicsConfiguration getGraphicsConfigurationImpl()
...@@ -134,6 +157,12 @@ public class Window extends Container ...@@ -134,6 +157,12 @@ public class Window extends Container
return super.getGraphicsConfigurationImpl(); return super.getGraphicsConfigurationImpl();
} }
/**
* Disposes of the input methods and context, and removes the WeakReference
* which formerly pointed to this Window from the parent's owned Window list.
*
* @exception Throwable The Exception raised by this method.
*/
protected void finalize() throws Throwable protected void finalize() throws Throwable
{ {
// FIXME: remove from owner's "owned window" list (Weak References) // FIXME: remove from owner's "owned window" list (Weak References)
...@@ -185,7 +214,7 @@ public class Window extends Container ...@@ -185,7 +214,7 @@ public class Window extends Container
public void hide() public void hide()
{ {
// FIXME: call hide() on amy "owned" children here. // FIXME: call hide() on any "owned" children here.
super.hide(); super.hide();
} }
...@@ -233,8 +262,8 @@ public class Window extends Container ...@@ -233,8 +262,8 @@ public class Window extends Container
{ {
if (peer != null) if (peer != null)
{ {
WindowPeer wp = (WindowPeer) peer; WindowPeer wp = (WindowPeer) peer;
wp.toFront(); wp.toFront();
} }
} }
...@@ -265,12 +294,12 @@ public class Window extends Container ...@@ -265,12 +294,12 @@ public class Window extends Container
if (!secure) if (!secure)
{ {
if (warningString != null) if (warningString != null)
return warningString; return warningString;
else else
{ {
String warning = System.getProperty("awt.appletWarning"); String warning = System.getProperty("awt.appletWarning");
return warning; return warning;
} }
} }
return null; return null;
} }
...@@ -338,6 +367,11 @@ public class Window extends Container ...@@ -338,6 +367,11 @@ public class Window extends Container
windowListener = AWTEventMulticaster.remove(windowListener, listener); windowListener = AWTEventMulticaster.remove(windowListener, listener);
} }
/**
* Returns an array of all the window listeners registered on this window.
*
* @since 1.4
*/
public synchronized WindowListener[] getWindowListeners() public synchronized WindowListener[] getWindowListeners()
{ {
return (WindowListener[]) return (WindowListener[])
...@@ -345,7 +379,16 @@ public class Window extends Container ...@@ -345,7 +379,16 @@ public class Window extends Container
WindowListener.class); WindowListener.class);
} }
/** @since 1.3 */ /**
* Returns an array of all the objects currently registered as FooListeners
* upon this Window. FooListeners are registered using the addFooListener
* method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType) public EventListener[] getListeners(Class listenerType)
{ {
if (listenerType == WindowListener.class) if (listenerType == WindowListener.class)
......
...@@ -131,6 +131,13 @@ public abstract class ColorSpace implements Serializable ...@@ -131,6 +131,13 @@ public abstract class ColorSpace implements Serializable
return false; return false;
} }
/**
* Transforms a color value assumed to be in this ColorSpace into a value in
* the default CS_sRGB color space.
*
* @exception ArrayIndexOutOfBoundsException If array length is not at least
* the number of components in this ColorSpace.
*/
public abstract float[] toRGB(float[] colorvalue); public abstract float[] toRGB(float[] colorvalue);
public abstract float[] fromRGB(float[] rgbvalue); public abstract float[] fromRGB(float[] rgbvalue);
......
...@@ -81,6 +81,12 @@ public class ICC_ColorSpace extends ColorSpace ...@@ -81,6 +81,12 @@ public class ICC_ColorSpace extends ColorSpace
*/ */
private boolean needScaleInit; private boolean needScaleInit;
/**
* Constructs a new ICC_ColorSpace from an ICC_Profile object.
*
* @exception IllegalArgumentException If profile is inappropriate for
* representing a ColorSpace.
*/
public ICC_ColorSpace(ICC_Profile profile) public ICC_ColorSpace(ICC_Profile profile)
{ {
super(CS_sRGB, profile.getNumComponents()); super(CS_sRGB, profile.getNumComponents());
...@@ -92,18 +98,45 @@ public class ICC_ColorSpace extends ColorSpace ...@@ -92,18 +98,45 @@ public class ICC_ColorSpace extends ColorSpace
return thisProfile; return thisProfile;
} }
/**
* Transforms a color value assumed to be in this ColorSpace into a value in
* the default CS_sRGB color space.
*
* @exception ArrayIndexOutOfBoundsException If array length is not at least
* the number of components in this ColorSpace.
*/
public float[] toRGB(float[] colorvalue) public float[] toRGB(float[] colorvalue)
{ {
if (colorvalue.length < numComponents)
throw new IllegalArgumentException ();
// FIXME: Always assumes sRGB: // FIXME: Always assumes sRGB:
return colorvalue; return colorvalue;
} }
/**
* Transforms a color value assumed to be in the default CS_sRGB color space
* into this ColorSpace.
*
* @exception ArrayIndexOutOfBoundsException If array length is not at
* least 3.
*/
public float[] fromRGB(float[] rgbvalue) public float[] fromRGB(float[] rgbvalue)
{ {
if (rgbvalue.length < 3)
throw new IllegalArgumentException ();
// FIXME: Always assumes sRGB: // FIXME: Always assumes sRGB:
return rgbvalue; return rgbvalue;
} }
/**
* Transforms a color value assumed to be in this ColorSpace into the
* CS_CIEXYZ conversion color space.
*
* @exception ArrayIndexOutOfBoundsException If array length is not at
* least the number of components in this ColorSpace.
*/
public float[] toCIEXYZ(float[] colorvalue) public float[] toCIEXYZ(float[] colorvalue)
{ {
// FIXME: Not implemented // FIXME: Not implemented
......
...@@ -86,6 +86,7 @@ public abstract class Dimension2D implements Cloneable ...@@ -86,6 +86,7 @@ public abstract class Dimension2D implements Cloneable
* may occur. * may occur.
* *
* @param d the dimension containing the new values * @param d the dimension containing the new values
*
* @throws NullPointerException if d is null * @throws NullPointerException if d is null
*/ */
public void setSize(Dimension2D d) public void setSize(Dimension2D d)
...@@ -98,6 +99,10 @@ public abstract class Dimension2D implements Cloneable ...@@ -98,6 +99,10 @@ public abstract class Dimension2D implements Cloneable
* as this one. * as this one.
* *
* @return the clone * @return the clone
*
* @exception OutOfMemoryError If there is not enough memory available.
*
* @since 1.2
*/ */
public Object clone() public Object clone()
{ {
......
...@@ -338,6 +338,10 @@ public final class GeneralPath implements Shape, Cloneable ...@@ -338,6 +338,10 @@ public final class GeneralPath implements Shape, Cloneable
* this one. * this one.
* *
* @return the clone * @return the clone
*
* @exception OutOfMemoryError If there is not enough memory available.
*
* @since 1.2
*/ */
public Object clone() public Object clone()
{ {
......
...@@ -752,6 +752,10 @@ public abstract class Line2D implements Shape, Cloneable ...@@ -752,6 +752,10 @@ public abstract class Line2D implements Shape, Cloneable
* this one. * this one.
* *
* @return the clone * @return the clone
*
* @exception OutOfMemoryError If there is not enough memory available.
*
* @since 1.2
*/ */
public Object clone() public Object clone()
{ {
......
...@@ -289,6 +289,10 @@ public abstract class QuadCurve2D implements Shape, Cloneable ...@@ -289,6 +289,10 @@ public abstract class QuadCurve2D implements Shape, Cloneable
* this one. * this one.
* *
* @return the clone * @return the clone
*
* @exception OutOfMemoryError If there is not enough memory available.
*
* @since 1.2
*/ */
public Object clone() public Object clone()
{ {
......
...@@ -120,10 +120,32 @@ public abstract class ColorModel implements Transparency ...@@ -120,10 +120,32 @@ public abstract class ColorModel implements Transparency
Buffers.smallestAppropriateTransferType(bits * 4)); Buffers.smallestAppropriateTransferType(bits * 4));
} }
/**
* Constructs a ColorModel that translates pixel values to
* color/alpha components.
*
* @exception IllegalArgumentException If the length of the bit array is less
* than the number of color or alpha components in this ColorModel, or if the
* transparency is not a valid value, or if the sum of the number of bits in
* bits is less than 1 or if any of the elements in bits is less than 0.
*/
protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace, protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
boolean hasAlpha, boolean isAlphaPremultiplied, boolean hasAlpha, boolean isAlphaPremultiplied,
int transparency, int transferType) int transparency, int transferType)
{ {
int bits_sum = 0;
for (int i = 0; i < bits.length; i++)
{
if (bits [i] < 0)
throw new IllegalArgumentException ();
bits_sum |= bits [i];
}
if ((bits.length < cspace.numComponents)
|| (bits_sum < 1))
throw new IllegalArgumentException ();
this.pixel_bits = pixel_bits; this.pixel_bits = pixel_bits;
this.bits = bits; this.bits = bits;
this.cspace = cspace; this.cspace = cspace;
......
...@@ -81,9 +81,18 @@ public class ImageFilter implements ImageConsumer, Cloneable ...@@ -81,9 +81,18 @@ public class ImageFilter implements ImageConsumer, Cloneable
* *
* @see java.lang.Object#clone () * @see java.lang.Object#clone ()
*/ */
public Object clone() throws CloneNotSupportedException public Object clone()
{ {
return (super.clone()); try
{
return super.clone();
}
catch (CloneNotSupportedException e)
{
// This should never happen as this class implements the
// Cloneable interface.
throw new InternalError ();
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment