2003-02-15 Michael Koch <konqueror@gmx.de>

* java/awt/CheckboxMenuItem.java
	(CheckBoxMenuItem): Dont implement Serializable.
	(getListeners): New method,
	(getItemListeners): New method.
	* java/awt/Choice.java
	(getListeners): New method,
	(getItemListeners): New method.
	* java/awt/Container.java
	(getListeners): Added exception documentation.
	(setFocusTraversalKeys): Throw exceptions, added documentattion.
	(getFocusTraversalKeys): Added documentation.
	(areFocusTraversalKeysSet): Added documentation.
	(applyComponentOrientation): Added documentation.
	* java/awt/ContainerOrderFocusTraversalPolicy.java
	(implicitDownCycleTraversal): Renamed from downCycle for
	serialization.
	(ContainerOrderFocusTraversalPolicy): Added documentation.
	(accept): Reformated.
	* java/awt/Dialog.java
	(Dialog): Dont implement Serializable.
	(Dialog): Added documentation.
	* java/awt/Font.java
	(Font): Dont use absolute class name.
	* java/awt/Frame.java
	(Frame): Font implement Serializable.
	* java/awt/List.java
	(getListeners): New method,
	(getActionListeners): New method.
	(getItemListeners): New method.
	* java/awt/Menu.java
	(countItems): New deprecated method.
	* java/awt/Scrollbar.java
	(getListeners): New method,
	(getAdjustmentListeners): New method,
	* java/awt/TextComponent.java
	(getListeners): New method,
	(getTextListeners): New method,
	* java/awt/TextField.java
	(getListeners): New method,
	(getActionListeners): New method.
	* java/awt/Window.java
	(windowFocusListener): New member variable.
	(windowStateListener): New member variable.
	(getWindowFocusListeners): New method.
	(getWindowStateListeners): New method.
	(addWindowFocusListener): New method.
	(addWindowStateListener): New method.
	(removeWindowFocusListener): New method.
	(removeWindowStateListener): New method.
	* java/awt/datatransfer/DataFlavor.java
	(isRepresentationClassByteBuffer): New method.
	(isRepresentationClassCharBuffer): New method.
	(isRepresentationClassReader): New method.

From-SVN: r62933
This commit is contained in:
Michael Koch 2003-02-15 09:21:55 +00:00 committed by Michael Koch
parent e898926c9d
commit 30df932c23
15 changed files with 462 additions and 14 deletions

View file

@ -1,3 +1,59 @@
2003-02-15 Michael Koch <konqueror@gmx.de>
* java/awt/CheckboxMenuItem.java
(CheckBoxMenuItem): Dont implement Serializable.
(getListeners): New method,
(getItemListeners): New method.
* java/awt/Choice.java
(getListeners): New method,
(getItemListeners): New method.
* java/awt/Container.java
(getListeners): Added exception documentation.
(setFocusTraversalKeys): Throw exceptions, added documentattion.
(getFocusTraversalKeys): Added documentation.
(areFocusTraversalKeysSet): Added documentation.
(applyComponentOrientation): Added documentation.
* java/awt/ContainerOrderFocusTraversalPolicy.java
(implicitDownCycleTraversal): Renamed from downCycle for
serialization.
(ContainerOrderFocusTraversalPolicy): Added documentation.
(accept): Reformated.
* java/awt/Dialog.java
(Dialog): Dont implement Serializable.
(Dialog): Added documentation.
* java/awt/Font.java
(Font): Dont use absolute class name.
* java/awt/Frame.java
(Frame): Font implement Serializable.
* java/awt/List.java
(getListeners): New method,
(getActionListeners): New method.
(getItemListeners): New method.
* java/awt/Menu.java
(countItems): New deprecated method.
* java/awt/Scrollbar.java
(getListeners): New method,
(getAdjustmentListeners): New method,
* java/awt/TextComponent.java
(getListeners): New method,
(getTextListeners): New method,
* java/awt/TextField.java
(getListeners): New method,
(getActionListeners): New method.
* java/awt/Window.java
(windowFocusListener): New member variable.
(windowStateListener): New member variable.
(getWindowFocusListeners): New method.
(getWindowStateListeners): New method.
(addWindowFocusListener): New method.
(addWindowStateListener): New method.
(removeWindowFocusListener): New method.
(removeWindowStateListener): New method.
* java/awt/datatransfer/DataFlavor.java
(isRepresentationClassByteBuffer): New method.
(isRepresentationClassCharBuffer): New method.
(isRepresentationClassReader): New method.
2003-02-14 Mark Wielaard <mark@klomp.org>
* java/math/BigDecimal.java (BigDecimal(String)): Always set scale to

View file

@ -43,6 +43,7 @@ import java.awt.peer.MenuItemPeer;
import java.awt.peer.MenuComponentPeer;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.EventListener;
/**
* This class implements a menu item that has a checkbox on it indicating
@ -51,8 +52,7 @@ import java.awt.event.ItemListener;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@redhat.com>
*/
public class CheckboxMenuItem extends MenuItem implements ItemSelectable,
java.io.Serializable
public class CheckboxMenuItem extends MenuItem implements ItemSelectable
{
/*
@ -296,5 +296,29 @@ paramString()
+ "," + super.paramString());
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this <code>CheckboxMenuItem</code>. FooListeners are registered using
* the addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*/
public EventListener[] getListeners (Class listenerType)
{
if (listenerType == ItemListener.class)
return AWTEventMulticaster.getListeners (item_listeners, listenerType);
return super.getListeners (listenerType);
}
/**
* Returns an aray of all item listeners currently registered to this
* <code>CheckBoxMenuItem</code>.
*/
public ItemListener[] getItemListeners ()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
} // class CheckboxMenuItem

View file

@ -44,6 +44,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.Serializable;
import java.util.Vector;
import java.util.EventListener;
/**
* This class implements a drop down choice list.
@ -474,4 +475,31 @@ paramString()
return ("selectedIndex=" + selectedIndex + "," + super.paramString());
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this Choice. 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)
{
if (listenerType == ItemListener.class)
return AWTEventMulticaster.getListeners (item_listeners, listenerType);
return super.getListeners (listenerType);
}
/**
* Returns all registered item listeners.
*
* @since 1.4
*/
public ItemListener[] getItemListeners ()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
} // class Choice

View file

@ -728,6 +728,9 @@ public class Container extends Component
* upon this Container. FooListeners are registered using the addFooListener
* method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements @see java.util.EventListener.
*
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
@ -994,15 +997,48 @@ public class Container extends Component
}
}
public void setFocusTraversalKeys(int id, Set keys)
/**
* Sets the focus traversal keys for a given traversal operation for this
* Container.
*
* @exception IllegalArgumentException If id is not one of
* KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
* or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS,
* or if keystrokes contains null, or if any Object in keystrokes is not an
* AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, or if any
* keystroke already maps to another focus traversal operation for this
* Container.
*
* @since 1.4
*/
public void setFocusTraversalKeys(int id, Set keystrokes)
{
if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
throw new IllegalArgumentException ();
if (keystrokes == null)
throw new IllegalArgumentException ();
throw new Error ("not implemented");
}
/**
* Returns the Set of focus traversal keys for a given traversal operation for
* this Container.
*
* @exception IllegalArgumentException If id is not one of
* KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
* or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
*
* @since 1.4
*/
public Set getFocusTraversalKeys(int id)
{
if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
@ -1014,6 +1050,20 @@ public class Container extends Component
return null;
}
/**
* Returns whether the Set of focus traversal keys for the given focus
* traversal operation has been explicitly defined for this Container.
* If this method returns false, this Container is inheriting the Set from
* an ancestor, or from the current KeyboardFocusManager.
*
* @exception IllegalArgumentException If id is not one of
* KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
* or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
*
* @since 1.4
*/
public boolean areFocusTraversalKeysSet(int id)
{
if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
@ -1060,8 +1110,16 @@ public class Container extends Component
public void transferFocusDownCycle()
{
}
public void applyComponentOrientation(ComponentOrientation o)
/**
* Sets the ComponentOrientation property of this container and all components
* contained within it.
*
* @exception NullPointerException If orientation is null
*
* @since 1.4
*/
public void applyComponentOrientation (ComponentOrientation orientation)
{
if (orientation == null)
throw new NullPointerException ();

View file

@ -48,8 +48,11 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
{
static final long serialVersionUID = 486933713763926351L;
private boolean downCycle = true;
private boolean implicitDownCycleTraversal = true;
/**
* Creates the <code>ContainerOrderFocusTraversalPolicy</code> object.
*/
public ContainerOrderFocusTraversalPolicy()
{
throw new Error("not implemented");
@ -82,17 +85,19 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
public void setImplicitDownCycleTraversal(boolean value)
{
downCycle = value;
boolean implicitDownCycleTraversal = value;
}
public boolean getImplicitDownCycleTraversal()
{
return downCycle;
return implicitDownCycleTraversal;
}
protected boolean accept(Component current)
{
return current.visible && current.isDisplayable() && current.enabled
&& current.focusable;
return (current.visible
&& current.isDisplayable()
&& current.enabled
&& current.focusable);
}
} // class ContainerOrderFocusTraversalPolicy

View file

@ -49,7 +49,7 @@ import java.awt.peer.ComponentPeer;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@redhat.com>
*/
public class Dialog extends Window implements java.io.Serializable
public class Dialog extends Window
{
/*
@ -92,6 +92,10 @@ private String title;
* parent, that is not resizable and not modal, and which has no title.
*
* @param parent The parent frame of this dialog box.
*
* @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
Dialog(Frame parent)
@ -108,6 +112,10 @@ Dialog(Frame parent)
* @param parent The parent frame of this dialog box.
* @param modal <true> if this dialog box is modal, <code>false</code>
* otherwise.
*
* @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
Dialog(Frame parent, boolean modal)
@ -124,6 +132,10 @@ Dialog(Frame parent, boolean modal)
*
* @param parent The parent frame of this dialog box.
* @param title The title string for this dialog box.
*
* @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
Dialog(Frame parent, String title)
@ -160,12 +172,30 @@ Dialog (Dialog owner)
this (owner, "", false);
}
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent and title, that is not resizable.
*
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
*
* @since 1.2
*/
public
Dialog (Dialog owner, String title)
{
this (owner, title, false);
}
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, title and modality, that is not resizable.
*
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
*
* @since 1.2
*/
public
Dialog (Dialog owner, String title, boolean modal)
{

View file

@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FontPeer;
import java.io.Serializable;
import java.util.StringTokenizer;
/**
@ -47,7 +48,7 @@ import java.util.StringTokenizer;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
*/
public class Font implements java.io.Serializable
public class Font implements Serializable
{
/*

View file

@ -42,7 +42,6 @@ import java.awt.peer.FramePeer;
import java.awt.peer.WindowPeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
@ -52,7 +51,7 @@ import java.util.Vector;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Frame extends Window implements MenuContainer, Serializable
public class Frame extends Window implements MenuContainer
{
/*

View file

@ -45,6 +45,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
import java.awt.peer.ComponentPeer;
import java.util.EventListener;
import java.util.Vector;
import javax.accessibility.Accessible;
@ -1030,4 +1031,38 @@ paramString()
return "multiple=" + multipleMode + ",rows=" + rows + super.paramString();
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this <code>List</code>. FooListeners are registered using the
* addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*/
public EventListener[] getListeners (Class listenerType)
{
if (listenerType == ActionListener.class)
return AWTEventMulticaster.getListeners (action_listeners, listenerType);
if (listenerType == ItemListener.class)
return AWTEventMulticaster.getListeners (item_listeners, listenerType);
return super.getListeners (listenerType);
}
/**
* Returns all action listeners registered to this object.
*/
public ActionListener[] getActionListeners ()
{
return (ActionListener[]) getListeners (ActionListener.class);
}
/**
* Returns all action listeners registered to this object.
*/
public ItemListener[] getItemListeners ()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
} // class List

View file

@ -175,6 +175,18 @@ getItemCount()
{
return(items.size());
}
/**
* Returns the number of items in this menu.
*
* @return The number of items in this menu.
*
* @deprecated As of JDK 1.1, replaced by getItemCount().
*/
public int countItems ()
{
return getItemCount ();
}
/*************************************************************************/

View file

@ -42,6 +42,7 @@ import java.awt.peer.ScrollbarPeer;
import java.awt.peer.ComponentPeer;
import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
import java.util.EventListener;
import javax.accessibility.Accessible;
/**
@ -699,5 +700,29 @@ paramString()
+ super.paramString());
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this <code>Scrollbar</code>. FooListeners are registered using the
* addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*/
public EventListener[] getListeners (Class listenerType)
{
if (listenerType == AdjustmentListener.class)
return AWTEventMulticaster.getListeners (adjustment_listeners,
listenerType);
return super.getListeners (listenerType);
}
/**
* Returns an array of all registered adjustment listeners.
*/
public AdjustmentListener[] getAdjustmentListeners ()
{
return (AdjustmentListener[]) getListeners (AdjustmentListener.class);
}
} // class Scrollbar

View file

@ -42,6 +42,7 @@ import java.awt.event.TextEvent;
import java.awt.event.TextListener;
import java.awt.peer.TextComponentPeer;
import java.awt.peer.ComponentPeer;
import java.util.EventListener;
/**
* This class provides common functionality for widgets than
@ -442,5 +443,28 @@ paramString()
return(getClass().getName() + "(text=" + getText() + ")");
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this <code>TextComponent</code>. FooListeners are registered using
* the addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
*/
public EventListener[] getListeners (Class listenerType)
{
if (listenerType == TextListener.class)
return AWTEventMulticaster.getListeners (textListener, listenerType);
return super.getListeners (listenerType);
}
/**
* Returns all text listeners registered to this object.
*/
public TextListener[] getTextListeners ()
{
return (TextListener[]) getListeners (TextListener.class);
}
} // class TextComponent

View file

@ -43,6 +43,7 @@ import java.awt.event.ActionListener;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.TextComponentPeer;
import java.awt.peer.ComponentPeer;
import java.util.EventListener;
/**
* This class implements a single line text entry field widget
@ -489,4 +490,32 @@ paramString()
getEchoChar());
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this <code>TextField</code>. 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)
{
if (listenerType == ActionListener.class)
return AWTEventMulticaster.getListeners (action_listeners, listenerType);
return super.getListeners (listenerType);
}
/**
* Return all ActionListeners register to this <code>TextField</code> object
* as an array.
*
* @since 1.4
*/
public ActionListener[] getActionListeners ()
{
return (ActionListener[]) getListeners (ActionListener.class);
}
} // class TextField

View file

@ -39,7 +39,9 @@ exception statement from your version. */
package java.awt;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener;
import java.awt.event.WindowStateListener;
import java.awt.peer.WindowPeer;
import java.awt.peer.ComponentPeer;
import java.util.EventListener;
@ -61,6 +63,8 @@ public class Window extends Container
private int windowSerializedDataVersion = 0; // FIXME
private transient WindowListener windowListener;
private transient WindowFocusListener windowFocusListener;
private transient WindowStateListener windowStateListener;
private transient GraphicsConfiguration graphicsConfiguration;
/**
@ -380,6 +384,68 @@ public class Window extends Container
WindowListener.class);
}
/**
* Returns an array of all the window focus listeners registered on this
* window.
*
* @since 1.4
*/
public synchronized WindowFocusListener[] getWindowFocusListeners()
{
return (WindowFocusListener[])
AWTEventMulticaster.getListeners(windowFocusListener,
WindowFocusListener.class);
}
/**
* Returns an array of all the window state listeners registered on this
* window.
*
* @since 1.4
*/
public synchronized WindowStateListener[] getWindowStateListeners()
{
return (WindowStateListener[])
AWTEventMulticaster.getListeners(windowStateListener,
WindowStateListener.class);
}
/**
* Adds the specified listener to this window.
*/
public void addWindowFocusListener (WindowFocusListener wfl)
{
AWTEventMulticaster.add (windowFocusListener, wfl);
}
/**
* Adds the specified listener to this window.
*
* @since 1.4
*/
public void addWindowStateListener (WindowStateListener wsl)
{
AWTEventMulticaster.add (windowStateListener, wsl);
}
/**
* Removes the specified listener from this window.
*/
public void removeWindowFocusListener (WindowFocusListener wfl)
{
AWTEventMulticaster.remove (windowFocusListener, wfl);
}
/**
* Removes the specified listener from this window.
*
* @since 1.4
*/
public void removeWindowStateListener (WindowStateListener wsl)
{
AWTEventMulticaster.remove (windowStateListener, wsl);
}
/**
* Returns an array of all the objects currently registered as FooListeners
* upon this Window. FooListeners are registered using the addFooListener

View file

@ -47,6 +47,8 @@ import java.io.ObjectInput;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
/**
* This class represents a particular data format used for transferring
@ -999,5 +1001,59 @@ public Reader getReaderForText(Transferable transferable)
throw new UnsupportedFlavorException(this);
}
/**
* Returns whether the representation class for this DataFlavor is
* @see java.nio.ByteBuffer or a subclass thereof.
*
* @since 1.4
*/
public boolean isRepresentationClassByteBuffer ()
{
try
{
return ByteBuffer.class.isAssignableFrom (representationClass);
}
catch (ClassNotFoundException e)
{
return false;
}
}
/**
* Returns whether the representation class for this DataFlavor is
* @see java.nio.CharBuffer or a subclass thereof.
*
* @since 1.4
*/
public boolean isRepresentationClassCharBuffer ()
{
try
{
return CharBuffer.class.isAssignableFrom (representationClass);
}
catch (ClassNotFoundException e)
{
return false;
}
}
/**
* Returns whether the representation class for this DataFlavor is
* @see java.io.Reader or a subclass thereof.
*
* @since 1.4
*/
public boolean isRepresentationClassReader ()
{
try
{
return Reader.class.isAssignableFrom (representationClass);
}
catch (ClassNotFoundException e)
{
return false;
}
}
} // class DataFlavor