2003-02-15 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Sat, 15 Feb 2003 09:21:55 +0000 (09:21 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Sat, 15 Feb 2003 09:21:55 +0000 (09:21 +0000)
* 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

15 files changed:
libjava/ChangeLog
libjava/java/awt/CheckboxMenuItem.java
libjava/java/awt/Choice.java
libjava/java/awt/Container.java
libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
libjava/java/awt/Dialog.java
libjava/java/awt/Font.java
libjava/java/awt/Frame.java
libjava/java/awt/List.java
libjava/java/awt/Menu.java
libjava/java/awt/Scrollbar.java
libjava/java/awt/TextComponent.java
libjava/java/awt/TextField.java
libjava/java/awt/Window.java
libjava/java/awt/datatransfer/DataFlavor.java

index ef7f16021a841255e0eee82aee01c4867436a110..785c9bbae63bed496a12709d1cd3c227de8372a4 100644 (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
index 88218397c3c613dd18b8e0931d4d9d2020545372..4f41568218a5997f1971aa9c60e4914c1beca17f 100644 (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
 
index 4c7b505535cafd088df72e3a050d229e96ab4afd..cb8bb03649179e726a38c7b2cf1649599185498f 100644 (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 
index 9494d8c56aca74df7f4bd24cfb952d6f69a76c59..91804d7f8c95d2f205c7bb2cbd8d40135f8877ab 100644 (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 ();
index e3cf31cb11123ba1da4630ed411fbe6ee2182c9a..71267a579f0645b126ef8f138f69eca25e720999 100644 (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
index 471826c4b1b38ad55a349aa1738b8b4cdeadd3f7..9aa2ea6f346517567dfcabe8a792b16b73f644a4 100644 (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)
 {
index 730a7003e599fc0156566a22fb503ad16be7e4e3..3723a4528ed3ca48312282428e087063c558191d 100644 (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
 {
 
 /*
index a25af9c5546e90ded368a993ffeab9cdfa8b4dd6..8c08a2e9b7b572bd6314f7e8bc679630dfde8955 100644 (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
 {
 
 /*
index d182e56001469e88ef4fbe085d781af7a3dcb5f9..9e59041f781a76da99278842c684b8c5d2f9fd6f 100644 (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
index 326101b76e56601cbd2c849ebac92a0d6ea50a5c..2ca9467e2b167a625bfd3869d47811da9e5924f9 100644 (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 ();
+}
  
 /*************************************************************************/
 
index 76daee3f8bfbe059e95d3524a73a7115e164e3cb..f78f402d3c9f55438e3822c14b7b8225213b8e9a 100644 (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 
 
index 6dc904cc8b1cf16f8d94d1fb1fcb6a25fbcb271d..cbe7dc9169d582182309d53e323b8dbd0704531a 100644 (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
 
index 335edc6d2206680b6854adf55e58a7df3b1c63b3..c2c2be7215e5dde240330d576d950a96cb18e92e 100644 (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
index dbfe92c71b8ab2a542a02f66d8a2bf738f0589c8..805152e5405f2ccdb370e316769540ce5a3f219f 100644 (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
index 86d1f53c1d9af4ad3dad78ec6724c8e388a0bf4f..f542bd89286a9e3406db2b4b03dab81c9a06454d 100644 (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