I committed several mauve tests for DragSource and DropTargets. I fixed
all the errors found from running those tests.

2006-08-02  Lillian Angel  <[EMAIL PROTECTED]>

        * java/awt/dnd/DragSource.java
        (isDragImageSupported): Implemented.
        (getDragThreshold): Changed default value.
        * java/awt/dnd/DropTarget.java
        (DropTarget): Default action is changed to ACTION_COPY_OR_MOVE.
        (DropTarget): Likewise.
        (DropTarget): If FlavorMap passed in is null, we should use the 
        system default.
        (addDropTargetListener): Added check to determine if new 
        DropTargetListener is this class. If so, an 
        IllegalArgumentException is thrown. If 
        the new listener is null, nothing happens.

Index: java/awt/dnd/DragSource.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragSource.java,v
retrieving revision 1.12
diff -u -r1.12 DragSource.java
--- java/awt/dnd/DragSource.java	28 Jul 2006 15:52:06 -0000	1.12
+++ java/awt/dnd/DragSource.java	2 Aug 2006 19:49:05 -0000
@@ -112,9 +112,8 @@
   }
 
   public static boolean isDragImageSupported()
-    throws NotImplementedException
   {
-    // FIXME: Implement this
+    // In all cases, Sun returns false here.
     return false;
   }
 
@@ -313,7 +312,7 @@
   
   /**
    * TODO
-   * @return
+   * @return TODO
    * 
    * @since 1.5
    */
@@ -321,6 +320,6 @@
     throws NotImplementedException
   {
     // FIXME: Not implemented.
-    return 4;
+    return 8;
   }
 } // class DragSource
Index: java/awt/dnd/DropTarget.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DropTarget.java,v
retrieving revision 1.15
diff -u -r1.15 DropTarget.java
--- java/awt/dnd/DropTarget.java	17 Jul 2006 18:37:19 -0000	1.15
+++ java/awt/dnd/DropTarget.java	2 Aug 2006 19:49:05 -0000
@@ -45,6 +45,7 @@
 import java.awt.HeadlessException;
 import java.awt.Point;
 import java.awt.datatransfer.FlavorMap;
+import java.awt.datatransfer.SystemFlavorMap;
 import java.awt.dnd.peer.DropTargetPeer;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -113,7 +114,7 @@
    */
   public DropTarget ()
   {
-    this (null, 0, null, true, null);
+    this (null, DnDConstants.ACTION_COPY_OR_MOVE, null, true, null);
   }
   
   /**
@@ -124,7 +125,7 @@
    */
   public DropTarget (Component c, DropTargetListener dtl)
   {
-    this (c, 0, dtl, true, null);
+    this (c, DnDConstants.ACTION_COPY_OR_MOVE, dtl, true, null);
   }
   
   /**
@@ -164,7 +165,11 @@
     setComponent(c);
     setDefaultActions(i);
     dropTargetListener = dtl;
-    flavorMap = fm;
+    
+    if (fm == null)
+      flavorMap = SystemFlavorMap.getDefaultFlavorMap();
+    else
+      flavorMap = fm;
     
     setActive (b);
     
@@ -225,8 +230,14 @@
   public void addDropTargetListener (DropTargetListener dtl)
     throws TooManyListenersException
   {
+    if (dtl == null)
+      return;
+    
+    if (dtl.equals(this))
+      throw new IllegalArgumentException();
+    
     if (dropTargetListener != null)
-      throw new TooManyListenersException ();
+      throw new TooManyListenersException();
     
     dropTargetListener = dtl;
   }

Reply via email to