DnDEventMulticaster.java: New file.
authorMichael Koch <konqueror@gmx.de>
Sun, 2 Mar 2003 14:24:48 +0000 (14:24 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Sun, 2 Mar 2003 14:24:48 +0000 (14:24 +0000)
2003-03-02  Michael Koch  <konqueror@gmx.de>

* java/awt/dnd/DnDEventMulticaster.java: New file.
* java/awt/dnd/DragSource.java
(flavorMap): New member variable.
(dragSourceListener): New member variable.
(dragSourceMotionListener): New member variable.
(getFlavorMap): Implemented.
(createDragGestureRecognizer): Implemented.
(addDragSourceListener): Implemented.
(removeDragSourceListener): Implemented.
(getDragSourceListeners): Implemented.
(addDragSourceMotionListener): Implemented.
(removeDragSourceMotionListener): Implemented.
(getDragSourceMotionListeners): Implemented.
(getListeners): Implemented.
* java/awt/dnd/DragSourceContext.java
(peer): New member variable.
(cursor): New member variable.
(transferable): New member variable.
(trigger): New member variable.
(dragSourceListener): New member variable.
(image): New member variable.
(offset): New member variable.
(DragSourceContext): Implemented.
(getDragSource): Implemented.
(getComponent): Implemented.
(getTrigger): Implemented.
(getSourceActions): Implemented.
(setCursor): Implemented.
(getCursor): Implemented.
(addDragSourceListener): Implemented.
(removeDragSourceListener): Implemented.
(getTransferable): Implemented.
* java/awt/dnd/DropTarget.java
(DropTargetAutoScroller.component): New member variable.
(DropTargetAutoScroller.point): New member variable.
(DropTargetAutoScroller.DropTargetAutoScroller): Implemented.
(DropTargetAutoScroller.updateLocation): Implemented.
(active): Renamed from isActive, defaults to true now.
(component): New member variable.
(flavorMap): New member variable.
(actions): New member variable.
(dropTargetContext): New member variable.
(dropTargetListener): New member variable.
(DropTarget): Implemented.
(getComponent): Implemented.
(setComponent): Implemented.
(setDefaultActions): Implemented.
(getDefaultActions): Implemented.
(setActive): Use active instead of isActive.
(isActive): Use active instead of isActive.
(addDropTargetListener): Implemented.
(removeDropTargetListener): Implemented.
(getFlavorMap): Implemented.
(setFlavorMap): Implemented.
(getDropTargetContext): Implemented.
(createDropTargetContext): Implemented.
(createDropTargetAutoScroller): Implemented.
* java/awt/dnd/DropTargetContext.java
(TransferableProxy.getTransferDataFlavors): Implemented.
(TransferableProxy.isDataFlavorSupported): Implemented.
(TransferableProxy.getTransferData): Implemented.
(dropTarget):  New member variable.
(dtcp): New member variable.
(DropTargetContext): New package private constructor.
(getDropTarget): Implemented.
(getComponent): Implemented.
(addNotify): Implemented.
(removeNotify): Implemented.
(getCurrentDataFlavorsAsList): Implemented.
(isDataFlavorSupported): Implemented.
* java/awt/dnd/MouseDragGestureRecognizer.java
(registerListeners): Implemented.
(unregisterListeners): Implemented.
* Makefile.am
(awt_java_source_files): Added java/awt/dnd/DnDEventMulticaster.java.
* Makefile.in: Regenerated.

From-SVN: r63665

libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/java/awt/dnd/DnDEventMulticaster.java [new file with mode: 0644]
libjava/java/awt/dnd/DragSource.java
libjava/java/awt/dnd/DragSourceContext.java
libjava/java/awt/dnd/DropTarget.java
libjava/java/awt/dnd/DropTargetContext.java
libjava/java/awt/dnd/MouseDragGestureRecognizer.java

index 6ac880bc938ede2f075a139bbbaf0c0418c67016..3416b9ba9548c27b98746eeace3ddb934641809c 100644 (file)
@@ -1,3 +1,82 @@
+2003-03-02  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/dnd/DnDEventMulticaster.java: New file.
+       * java/awt/dnd/DragSource.java
+       (flavorMap): New member variable.
+       (dragSourceListener): New member variable.
+       (dragSourceMotionListener): New member variable.
+       (getFlavorMap): Implemented.
+       (createDragGestureRecognizer): Implemented.
+       (addDragSourceListener): Implemented.
+       (removeDragSourceListener): Implemented.
+       (getDragSourceListeners): Implemented.
+       (addDragSourceMotionListener): Implemented.
+       (removeDragSourceMotionListener): Implemented.
+       (getDragSourceMotionListeners): Implemented.
+       (getListeners): Implemented.
+       * java/awt/dnd/DragSourceContext.java
+       (peer): New member variable.
+       (cursor): New member variable.
+       (transferable): New member variable.
+       (trigger): New member variable.
+       (dragSourceListener): New member variable.
+       (image): New member variable.
+       (offset): New member variable.
+       (DragSourceContext): Implemented.
+       (getDragSource): Implemented.
+       (getComponent): Implemented.
+       (getTrigger): Implemented.
+       (getSourceActions): Implemented.
+       (setCursor): Implemented.
+       (getCursor): Implemented.
+       (addDragSourceListener): Implemented.
+       (removeDragSourceListener): Implemented.
+       (getTransferable): Implemented.
+       * java/awt/dnd/DropTarget.java
+       (DropTargetAutoScroller.component): New member variable.
+       (DropTargetAutoScroller.point): New member variable.
+       (DropTargetAutoScroller.DropTargetAutoScroller): Implemented.
+       (DropTargetAutoScroller.updateLocation): Implemented.
+       (active): Renamed from isActive, defaults to true now.
+       (component): New member variable.
+       (flavorMap): New member variable.
+       (actions): New member variable.
+       (dropTargetContext): New member variable.
+       (dropTargetListener): New member variable.
+       (DropTarget): Implemented.
+       (getComponent): Implemented.
+       (setComponent): Implemented.
+       (setDefaultActions): Implemented.
+       (getDefaultActions): Implemented.
+       (setActive): Use active instead of isActive.
+       (isActive): Use active instead of isActive.
+       (addDropTargetListener): Implemented.
+       (removeDropTargetListener): Implemented.
+       (getFlavorMap): Implemented.
+       (setFlavorMap): Implemented.
+       (getDropTargetContext): Implemented.
+       (createDropTargetContext): Implemented.
+       (createDropTargetAutoScroller): Implemented.
+       * java/awt/dnd/DropTargetContext.java
+       (TransferableProxy.getTransferDataFlavors): Implemented.
+       (TransferableProxy.isDataFlavorSupported): Implemented.
+       (TransferableProxy.getTransferData): Implemented.
+       (dropTarget):  New member variable.
+       (dtcp): New member variable.
+       (DropTargetContext): New package private constructor.
+       (getDropTarget): Implemented.
+       (getComponent): Implemented.
+       (addNotify): Implemented.
+       (removeNotify): Implemented.
+       (getCurrentDataFlavorsAsList): Implemented.
+       (isDataFlavorSupported): Implemented.
+       * java/awt/dnd/MouseDragGestureRecognizer.java
+       (registerListeners): Implemented.
+       (unregisterListeners): Implemented.
+       * Makefile.am
+       (awt_java_source_files): Added java/awt/dnd/DnDEventMulticaster.java.
+       * Makefile.in: Regenerated.
+
 2003-03-02  Michael Koch  <konqueror@gmx.de>
 
        * java/awt/Component.java
index d6054ccbb0b7c3511e0213a77c031aac82d10e6d..e5f849fcce2fcfd37fd3f641ca601b762f0fc5c3 100644 (file)
@@ -1037,6 +1037,7 @@ java/awt/dnd/peer/DragSourceContextPeer.java \
 java/awt/dnd/peer/DropTargetContextPeer.java \
 java/awt/dnd/peer/DropTargetPeer.java \
 java/awt/dnd/DnDConstants.java \
+java/awt/dnd/DnDEventMulticaster.java \
 java/awt/dnd/DragGestureEvent.java \
 java/awt/dnd/DragGestureListener.java \
 java/awt/dnd/DragGestureRecognizer.java        \
index d07f68d31af541aae91d212930bf574743651232..589605c7f3f0d91401ba096c8f207f0300963ec5 100644 (file)
@@ -805,6 +805,7 @@ java/awt/dnd/peer/DragSourceContextPeer.java \
 java/awt/dnd/peer/DropTargetContextPeer.java \
 java/awt/dnd/peer/DropTargetPeer.java \
 java/awt/dnd/DnDConstants.java \
+java/awt/dnd/DnDEventMulticaster.java \
 java/awt/dnd/DragGestureEvent.java \
 java/awt/dnd/DragGestureListener.java \
 java/awt/dnd/DragGestureRecognizer.java        \
@@ -3042,6 +3043,7 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/java/awt/datatransfer/Transferable.P \
 .deps/java/awt/datatransfer/UnsupportedFlavorException.P \
 .deps/java/awt/dnd/Autoscroll.P .deps/java/awt/dnd/DnDConstants.P \
+.deps/java/awt/dnd/DnDEventMulticaster.P \
 .deps/java/awt/dnd/DragGestureEvent.P \
 .deps/java/awt/dnd/DragGestureListener.P \
 .deps/java/awt/dnd/DragGestureRecognizer.P \
diff --git a/libjava/java/awt/dnd/DnDEventMulticaster.java b/libjava/java/awt/dnd/DnDEventMulticaster.java
new file mode 100644 (file)
index 0000000..0241e37
--- /dev/null
@@ -0,0 +1,74 @@
+/* DnDEventMulticaster.java -- helper class for listener chains in java.awt.dnd
+   Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.awt.dnd;
+
+import java.awt.AWTEventMulticaster;
+import java.util.EventListener;
+
+class DnDEventMulticaster extends AWTEventMulticaster
+{
+  protected DnDEventMulticaster (EventListener a, EventListener b)
+  {
+    super (a, b);
+  }
+  
+  public static DragSourceListener add (DragSourceListener a,
+                                        DragSourceListener b)
+  {
+    return (DragSourceListener) addInternal (a, b);
+  }
+
+  public static DragSourceMotionListener add (DragSourceMotionListener a,
+                                              DragSourceMotionListener b)
+  {
+    return (DragSourceMotionListener) addInternal (a, b);
+  }
+  
+  public static DragSourceListener remove (DragSourceListener a,
+                                           DragSourceListener b)
+  {
+    return (DragSourceListener) removeInternal (a, b);
+  }
+
+  public static DragSourceMotionListener remove (DragSourceMotionListener a,
+                                                 DragSourceMotionListener b)
+  {
+    return (DragSourceMotionListener) removeInternal (a, b);
+  }
+}
index 740235ac83c07233f7effa03ee6e67e3b31c5dee..f6083f674f60fa16b2d2bcf3dfe9849296f2fad0 100644 (file)
@@ -44,12 +44,20 @@ import java.awt.GraphicsEnvironment;
 import java.awt.HeadlessException;
 import java.awt.Image;
 import java.awt.Point;
+import java.awt.Toolkit;
 import java.awt.datatransfer.FlavorMap;
+import java.awt.datatransfer.SystemFlavorMap;
 import java.awt.datatransfer.Transferable;
 import java.awt.dnd.peer.DragSourceContextPeer;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.EventListener;
 
+/**
+ * @since 1.2
+ */
 public class DragSource implements Serializable
 {
   /**
@@ -64,6 +72,11 @@ public class DragSource implements Serializable
   public static final Cursor DefaultMoveNoDrop = null;
   public static final Cursor DefaultLinkNoDrop = null;
 
+  private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
+
+  private transient DragSourceListener dragSourceListener;
+  private transient DragSourceMotionListener dragSourceMotionListener;
+
   /**
    * Initializes the drag source.
    *
@@ -159,51 +172,89 @@ public class DragSource implements Serializable
 
   public FlavorMap getFlavorMap()
   {
-    return null;
+    return flavorMap;
   }
 
   public DragGestureRecognizer
     createDragGestureRecognizer(Class recognizer, Component c, int actions,
                                 DragGestureListener dgl)
   {
-    return null;
+    return Toolkit.getDefaultToolkit ()
+                  .createDragGestureRecognizer (recognizer, this, c, actions,
+                                                dgl);
   }
 
   public DragGestureRecognizer
     createDefaultDragGestureRecognizer(Component c, int actions,
                                        DragGestureListener dgl)
   {
-    return null;
+    return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c,
+                                        actions, dgl);
   }
 
+  /**
+   * @since 1.4
+   */
   public void addDragSourceListener(DragSourceListener l)
   {
+    DnDEventMulticaster.add (dragSourceListener, l);
   }
 
+  /**
+   * @since 1.4
+   */
   public void removeDragSourceListener(DragSourceListener l)
   {
+    DnDEventMulticaster.remove (dragSourceListener, l);
   }
 
+  /**
+   * @since 1.4
+   */
   public DragSourceListener[] getDragSourceListeners()
   {
-    return null;
+    return (DragSourceListener[]) getListeners (DragSourceListener.class);
   }
 
+  /**
+   * @since 1.4
+   */
   public void addDragSourceMotionListener(DragSourceMotionListener l)
   {
+    DnDEventMulticaster.add (dragSourceMotionListener, l);
   }
 
+  /**
+   * @since 1.4
+   */
   public void removeDragSourceMotionListener(DragSourceMotionListener l)
   {
+    DnDEventMulticaster.remove (dragSourceMotionListener, l);
   }
 
-  public DragSourceMotionListener[] getDragSourceMotionListeners()
+  /**
+   * @since 1.4
+   */
+  public DragSourceMotionListener[] getDragSourceMotionListeners ()
   {
-    return null;
+    return (DragSourceMotionListener[]) getListeners
+                                         (DragSourceMotionListener.class);
   }
 
-  public EventListener[] getListeners(Class type)
+  /**
+   * @since 1.4
+   */
+  public EventListener[] getListeners (Class listenerType)
   {
-    return null;
+    if (listenerType == DragSourceListener.class)
+      return DnDEventMulticaster.getListeners (dragSourceListener,
+                                               listenerType);
+
+    if (listenerType == DragSourceMotionListener.class)
+      return DnDEventMulticaster.getListeners (dragSourceMotionListener,
+                                               listenerType);
+
+    // Return an empty EventListener array.
+    return new EventListener [0];
   }
 } // class DragSource
index 45191d24365634f3970c93090a570bf90f78ec57..1760cd02065b692f49498790bdcaff636b9b6042 100644 (file)
@@ -44,12 +44,21 @@ import java.awt.Image;
 import java.awt.Point;
 import java.awt.datatransfer.Transferable;
 import java.awt.dnd.peer.DragSourceContextPeer;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.TooManyListenersException;
 
+/**
+ * @since 1.2
+ */
 public class DragSourceContext
   implements DragSourceListener, DragSourceMotionListener, Serializable
 {
+  /**
+   * Compatible with JDK 1.2+
+   */
   static final long serialVersionUID = -115407898692194719L;
 
   protected static final int DEFAULT = 0;
@@ -57,39 +66,81 @@ public class DragSourceContext
   protected static final int OVER = 2;
   protected static final int CHANGED = 3;
 
-  public DragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
-                           Cursor cursor, Image image, Point offset,
-                           Transferable trans, DragSourceListener dsl)
-  {
+  private DragSourceContextPeer peer;
+  private Cursor cursor;
+  private Transferable transferable;
+  private DragGestureEvent trigger;
+  private DragSourceListener dragSourceListener;
+  private boolean useCustomCursor; // FIXME: currently unused but needed for serialization.
+  private int sourceActions; // FIXME: currently unused but needed for serialization.
+  private Image image;
+  private Point offset;
+  
+  /**
+   * Initializes a drag source context.
+   *
+   * @exception IllegalArgumentException If Component or DragSource of trigger
+   * are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
+   * or if the source actions for the DragGestureRecognizer associated with the
+   * trigger event are equal to DnDConstants.ACTION_NONE.
+   * @exception NullPointerException If peer or trigger is null.
+   */
+  public DragSourceContext (DragSourceContextPeer peer,
+                            DragGestureEvent trigger, Cursor cursor,
+                            Image image, Point offset, Transferable trans,
+                            DragSourceListener dsl)
+  {
+    if (peer == null
+        || trigger == null)
+      throw new NullPointerException ();
+
+    if (trigger.getComponent () == null
+        || trigger.getDragSource () == null
+        || trigger.getDragAction () == DnDConstants.ACTION_NONE
+        || trigger.getSourceAsDragGestureRecognizer ()
+              .getSourceActions () == DnDConstants.ACTION_NONE)
+      throw new IllegalArgumentException ();
+
+    this.peer = peer;
+    this.trigger = trigger;
+    this.cursor = cursor;
+    this.image = image;
+    this.offset = offset;
+    this.transferable = trans;
+    this.dragSourceListener = dsl;
+    
+    throw new Error ("not implemented");
   }
 
   public DragSource getDragSource()
   {
-    return null;
+    return trigger.getDragSource ();
   }
 
   public Component getComponent()
   {
-    return null;
+    return trigger.getComponent ();
   }
 
   public DragGestureEvent getTrigger()
   {
-    return null;
+    return trigger;
   }
 
   public int getSourceActions()
   {
-    return 0;
+    return trigger.getSourceAsDragGestureRecognizer ().getSourceActions ();
   }
 
-  public void setCursor(Cursor c)
+  public void setCursor (Cursor cursor)
   {
+    this.cursor = cursor;
+    // FIXME: Check if we need to do more here
   }
 
   public Cursor getCursor()
   {
-    return null;
+    return cursor;
   }
 
   /**
@@ -101,10 +152,16 @@ public class DragSourceContext
   public void addDragSourceListener (DragSourceListener dsl)
     throws TooManyListenersException
   {
+    if (dragSourceListener != null)
+      throw new TooManyListenersException ();
+
+    dragSourceListener = dsl;
   }
 
-  public void removeDragSourceListener(DragSourceListener l)
+  public void removeDragSourceListener (DragSourceListener dsl)
   {
+    if (dragSourceListener == dsl)
+      dragSourceListener = null;
   }
 
   public void transferablesFlavorsChanged()
@@ -137,7 +194,7 @@ public class DragSourceContext
 
   public Transferable getTransferable()
   {
-    return null;
+    return transferable;
   }
 
   protected void updateCurrentCursor(int dropOp, int targetAct, int status)
index 09c642cf54f68f3a3509d7707bdab8692521ff6c..3be2786a5a9c636e039c7413a0e3b372a799901e 100644 (file)
@@ -39,6 +39,8 @@ package java.awt.dnd;
 
 import java.awt.Point;
 import java.awt.Component;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
 import java.awt.datatransfer.FlavorMap;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -46,7 +48,10 @@ import java.io.Serializable;
 import java.util.EventListener;
 import java.util.TooManyListenersException;
 
-/** STUB CLASS ONLY */
+/**
+ * @author Michael Koch
+ * @since 1.2
+ */
 public class DropTarget
   implements DropTargetListener, EventListener, Serializable
 {
@@ -58,12 +63,18 @@ public class DropTarget
   protected static class DropTargetAutoScroller
     implements ActionListener
   {
+    private Component component;
+    private Point point;
+    
     protected DropTargetAutoScroller (Component c, Point p)
     {
+      component = c;
+      point = p;
     }
 
     protected void updateLocation (Point newLocn)
     {
+      point = newLocn;
     }
 
     protected void stop ()
@@ -74,9 +85,13 @@ public class DropTarget
     {
     }
   }
-  
-  // FIXME: check the correctness of default value.
-  private boolean isActive = false;
+
+  private Component component;
+  private FlavorMap flavorMap;
+  private int actions;
+  private DropTargetContext dropTargetContext;
+  private DropTargetListener dropTargetListener;
+  private boolean active = true;
     
   /**
    * Creates a <code>DropTarget</code> object.
@@ -131,6 +146,15 @@ public class DropTarget
   public DropTarget (Component c, int i, DropTargetListener dtl, boolean b,
                      FlavorMap fm)
   {
+    if (GraphicsEnvironment.isHeadless ())
+      throw new HeadlessException ();
+
+    component = c;
+    actions = i;
+    dropTargetListener = dtl;
+    flavorMap = fm;
+    
+    setActive (b);
   }
 
   /**
@@ -138,6 +162,7 @@ public class DropTarget
    */
   public void setComponent (Component c)
   {
+    component = c;
   }
 
   /**
@@ -145,7 +170,7 @@ public class DropTarget
    */
   public Component getComponent ()
   {
-    return null;
+    return component;
   }
 
   /**
@@ -153,6 +178,7 @@ public class DropTarget
    */
   public void setDefaultActions (int ops)
   {
+    actions = ops;
   }
 
   /**
@@ -160,17 +186,17 @@ public class DropTarget
    */
   public int getDefaultActions ()
   {
-    return 0;
+    return actions;
   }
 
-  public void setActive(boolean isActive)
+  public void setActive (boolean active)
   {
-    this.isActive = isActive;
+    this.active = active;
   }
 
   public boolean isActive()
   {
-    return this.isActive;
+    return active;
   }
 
   /**
@@ -182,10 +208,16 @@ public class DropTarget
   public void addDropTargetListener (DropTargetListener dtl)
     throws TooManyListenersException
   {
+    if (dtl != null)
+      throw new TooManyListenersException ();
+    
+    dropTargetListener = dtl;
   }
 
   public void removeDropTargetListener(DropTargetListener dtl)
   {
+    // FIXME: Do we need to do something with dtl ?
+    dropTargetListener = null;
   }
 
   public void dragEnter(DropTargetDragEvent dtde)
@@ -210,11 +242,12 @@ public class DropTarget
 
   public FlavorMap getFlavorMap()
   {
-    return null;
+    return flavorMap;
   }
 
   public void setFlavorMap(FlavorMap fm)
   {
+    flavorMap = fm;
   }
 
   public void addNotify(java.awt.peer.ComponentPeer peer)
@@ -227,18 +260,21 @@ public class DropTarget
 
   public DropTargetContext getDropTargetContext()
   {
-    return null;
+    if (dropTargetContext == null)
+      dropTargetContext = createDropTargetContext ();
+    
+    return dropTargetContext;
   }
 
   protected DropTargetContext createDropTargetContext()
   {
-    return null;
+    return new DropTargetContext (this);
   }
 
   protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
                                                        (Component c, Point p)
   {
-    return null;
+    return new DropTarget.DropTargetAutoScroller (c, p);
   }
 
   protected void initializeAutoscrolling(Point p)
index eca2f6e3763761a6ac149ec2efe9b9325e1cdd84..4fc1a4428a9b80869193b8084d488cca9b956d5c 100644 (file)
@@ -67,46 +67,49 @@ public class DropTargetContext implements Serializable
     
     public DataFlavor[] getTransferDataFlavors ()
     {
-      // FIXME: implement this
-      return null;
+      return transferable.getTransferDataFlavors ();
     }
 
     public boolean isDataFlavorSupported (DataFlavor flavor)
     {
-      // FIXME: implement this
-      return false;
+      return transferable.isDataFlavorSupported (flavor);
     }
 
     public Object getTransferData (DataFlavor flavor)
       throws UnsupportedFlavorException, IOException
     {
-      // FIXME: implement this
-      return null;
+      return transferable.getTransferData (flavor);
     }
   }
 
+  private DropTarget dropTarget;
   private int targetActions;
+  private java.awt.dnd.peer.DropTargetContextPeer dtcp;
+
+  // package private
+  DropTargetContext (DropTarget dropTarget)
+  {
+    this.dropTarget = dropTarget;
+  }
 
   public DropTarget getDropTarget ()
   {
-    // FIXME: implement this
-    return null;
+    return dropTarget;
   }
 
   public Component getComponent ()
   {
-    // FIXME: implement this
-    return null;
+    return dropTarget.getComponent ();
   }
 
   public void addNotify (java.awt.dnd.peer.DropTargetContextPeer dtcp)
   {
-    // FIXME: implement this
+    this.dtcp = dtcp;
   }
 
   public void removeNotify ()
   {
-    // FIXME: implement this
+    this.dtcp = null;
   }
 
   protected void setTargetActions (int actions)
@@ -157,14 +160,12 @@ public class DropTargetContext implements Serializable
 
   protected List getCurrentDataFlavorsAsList ()
   {
-    // FIXME: implement this
-    return null;
+    return Arrays.asList (getCurrentDataFlavors ());
   }
 
   protected boolean isDataFlavorSupported (DataFlavor flavor)
   {
-    // FIXME: implement this
-    return false;
+    return getCurrentDataFlavorsAsList ().contains (flavor);
   }
 
   /**
index d01032433c019b32155f7b26734bdaa9b4c67d66..a94c82525dc0935f9456d0518d86a3420319d219 100644 (file)
@@ -84,12 +84,14 @@ public abstract class MouseDragGestureRecognizer
 
   protected void registerListeners ()
   {
-    // FIXME: implement this
+    component.addMouseListener (this);
+    component.addMouseMotionListener (this);
   }
 
   protected void unregisterListeners ()
   {
-    // FIXME: implement this
+    component.removeMouseListener (this);
+    component.removeMouseMotionListener (this);
   }
 
   public void mouseClicked (MouseEvent e)