This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] java.awt


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I have written another java.awt patch. This mostly implements some 
missing methods (getListeners and friends) and removes some unneeded 
"implements Serializable". Please review and comment.

Of course this should go into classpath too.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+TMseWSOgCCdjSDsRAlfbAJ92YR1OzmkGVBVuj8x+qnQLUthGWACfWJF/
hriT09fdv8EjvNHAToTBJp0=
=ZMpw
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1698
diff -u -r1.1698 ChangeLog
--- ChangeLog	13 Feb 2003 19:28:31 -0000	1.1698
+++ ChangeLog	14 Feb 2003 10:11:15 -0000
@@ -1,3 +1,59 @@
+2003-02-14  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-13  Michael Koch  <konqueror@gmx.de>
  
 	* java/awt/Label.java
Index: java/awt/CheckboxMenuItem.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/CheckboxMenuItem.java,v
retrieving revision 1.7
diff -u -r1.7 CheckboxMenuItem.java
--- java/awt/CheckboxMenuItem.java	2 Jan 2003 00:14:22 -0000	1.7
+++ java/awt/CheckboxMenuItem.java	14 Feb 2003 10:11:16 -0000
@@ -43,6 +43,7 @@
 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 @@
   * @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 @@
 	  + "," + 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
 
Index: java/awt/Choice.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Choice.java,v
retrieving revision 1.9
diff -u -r1.9 Choice.java
--- java/awt/Choice.java	2 Jan 2003 00:14:22 -0000	1.9
+++ java/awt/Choice.java	14 Feb 2003 10:11:16 -0000
@@ -44,6 +44,7 @@
 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 @@
   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 
Index: java/awt/Container.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Container.java,v
retrieving revision 1.18
diff -u -r1.18 Container.java
--- java/awt/Container.java	2 Jan 2003 00:14:22 -0000	1.18
+++ java/awt/Container.java	14 Feb 2003 10:11:16 -0000
@@ -728,6 +728,9 @@
    * 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 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 @@
     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 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 ();
Index: java/awt/ContainerOrderFocusTraversalPolicy.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java,v
retrieving revision 1.2
diff -u -r1.2 ContainerOrderFocusTraversalPolicy.java
--- java/awt/ContainerOrderFocusTraversalPolicy.java	10 Nov 2002 00:16:42 -0000	1.2
+++ java/awt/ContainerOrderFocusTraversalPolicy.java	14 Feb 2003 10:11:16 -0000
@@ -48,8 +48,11 @@
 {
   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 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
Index: java/awt/Dialog.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Dialog.java,v
retrieving revision 1.5
diff -u -r1.5 Dialog.java
--- java/awt/Dialog.java	22 Jan 2002 22:58:08 -0000	1.5
+++ java/awt/Dialog.java	14 Feb 2003 10:11:16 -0000
@@ -49,7 +49,7 @@
   * @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 @@
   * 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 @@
   * @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 @@
   *
   * @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 @@
   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)
 {
Index: java/awt/Font.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Font.java,v
retrieving revision 1.9
diff -u -r1.9 Font.java
--- java/awt/Font.java	9 Aug 2002 04:26:14 -0000	1.9
+++ java/awt/Font.java	14 Feb 2003 10:11:16 -0000
@@ -39,6 +39,7 @@
 package java.awt;
 
 import java.awt.peer.FontPeer;
+import java.io.Serializable;
 import java.util.StringTokenizer;
 
 /**
@@ -47,7 +48,7 @@
   * @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
 {
 
 /*
Index: java/awt/Frame.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Frame.java,v
retrieving revision 1.11
diff -u -r1.11 Frame.java
--- java/awt/Frame.java	10 Nov 2002 00:16:42 -0000	1.11
+++ java/awt/Frame.java	14 Feb 2003 10:11:17 -0000
@@ -42,7 +42,6 @@
 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 @@
   *
   * @author Aaron M. Renn (arenn@urbanophile.com)
   */
-public class Frame extends Window implements MenuContainer, Serializable
+public class Frame extends Window implements MenuContainer
 {
 
 /*
Index: java/awt/List.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/List.java,v
retrieving revision 1.11
diff -u -r1.11 List.java
--- java/awt/List.java	13 Feb 2003 19:28:31 -0000	1.11
+++ java/awt/List.java	14 Feb 2003 10:11:17 -0000
@@ -45,6 +45,7 @@
 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 @@
   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
Index: java/awt/Menu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Menu.java,v
retrieving revision 1.10
diff -u -r1.10 Menu.java
--- java/awt/Menu.java	2 Jan 2003 00:14:22 -0000	1.10
+++ java/awt/Menu.java	14 Feb 2003 10:11:17 -0000
@@ -175,6 +175,18 @@
 {
   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 ();
+}
  
 /*************************************************************************/
 
Index: java/awt/Scrollbar.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Scrollbar.java,v
retrieving revision 1.11
diff -u -r1.11 Scrollbar.java
--- java/awt/Scrollbar.java	13 Feb 2003 19:28:31 -0000	1.11
+++ java/awt/Scrollbar.java	14 Feb 2003 10:11:17 -0000
@@ -42,6 +42,7 @@
 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 @@
 	 + 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 
 
Index: java/awt/TextComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/TextComponent.java,v
retrieving revision 1.8
diff -u -r1.8 TextComponent.java
--- java/awt/TextComponent.java	14 Jan 2003 21:21:32 -0000	1.8
+++ java/awt/TextComponent.java	14 Feb 2003 10:11:17 -0000
@@ -42,6 +42,7 @@
 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 @@
   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
 
Index: java/awt/TextField.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/TextField.java,v
retrieving revision 1.5
diff -u -r1.5 TextField.java
--- java/awt/TextField.java	13 Feb 2003 19:28:31 -0000	1.5
+++ java/awt/TextField.java	14 Feb 2003 10:11:17 -0000
@@ -43,6 +43,7 @@
 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 @@
          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
Index: java/awt/Window.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Window.java,v
retrieving revision 1.16
diff -u -r1.16 Window.java
--- java/awt/Window.java	31 Jan 2003 17:54:13 -0000	1.16
+++ java/awt/Window.java	14 Feb 2003 10:11:17 -0000
@@ -39,7 +39,9 @@
 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 @@
   private int windowSerializedDataVersion = 0; // FIXME
 
   private transient WindowListener windowListener;
+  private transient WindowFocusListener windowFocusListener;
+  private transient WindowStateListener windowStateListener;
   private transient GraphicsConfiguration graphicsConfiguration;
 
   /** 
@@ -378,6 +382,68 @@
     return (WindowListener[])
       AWTEventMulticaster.getListeners(windowListener,
                                        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);
   }
 
   /**
Index: java/awt/datatransfer/DataFlavor.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/datatransfer/DataFlavor.java,v
retrieving revision 1.5
diff -u -r1.5 DataFlavor.java
--- java/awt/datatransfer/DataFlavor.java	13 Feb 2003 19:28:32 -0000	1.5
+++ java/awt/datatransfer/DataFlavor.java	14 Feb 2003 10:11:17 -0000
@@ -999,5 +999,62 @@
     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 Class.forName ("java.nio.ByteBuffer")
+                    .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 Class.forName ("java.nio.CharBuffer")
+                    .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 Class.forName ("java.io.Reader")
+                    .isAssignableFrom (representationClass);
+      }
+    catch (ClassNotFoundException e)
+      {
+        return false;
+      }
+  }
+
 } // class DataFlavor
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]