[Schmitzm-commits] r2165 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sun Dec 9 00:17:59 CET 2012


Author: mojays
Date: 2012-12-09 00:17:59 +0100 (Sun, 09 Dec 2012)
New Revision: 2165

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java	2012-12-08 23:11:25 UTC (rev 2164)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java	2012-12-08 23:17:59 UTC (rev 2165)
@@ -34,6 +34,7 @@
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 import java.awt.dnd.DragSource;
+import java.awt.event.InputEvent;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -160,8 +161,8 @@
      return new DataHandler(getSelectedRow((LIST_IMPL)c), localObjectFlavor.getMimeType());
   }
   
-  /**t
-   * If a {@link JScrollPane} is passed to this method, its underlying lis
+  /**
+   * If a {@link JScrollPane} is passed to this method, its underlying list
    * component is returned. Used to handle drop operations on empty {@link JTable}.
    */
   protected Component convertJScrollPane(Component comp) {
@@ -171,13 +172,22 @@
   }
 
   /**
+   * Sets the {@link #dragSourceComp} component before calling the super
+   * method.
+   */
+  @Override
+  public void exportAsDrag(JComponent comp, InputEvent e, int action) {
+    this.dragSourceComp = (LIST_IMPL)comp;
+    super.exportAsDrag(comp, e, action);
+  }
+  
+  /**
    * Checks whether drop is allowed to component.  
    */
   @Override
   public boolean canImport(TransferSupport info) {
      Component dropComp = info.getComponent();
      dropComp = convertJScrollPane(dropComp);
-
      logCompIndex("canImport", dropComp);
      // Check if drop is allowed to destination component
      boolean dndAllowed = ( isInnerListDragAllowed() || dropComp != getDragSourceComponent() ) &&
@@ -213,7 +223,6 @@
   @Override
   public int getSourceActions(JComponent c) {
     logCompIndex("getSourceAction", c);
-    this.dragSourceComp = (LIST_IMPL)c;
     return TransferHandler.COPY_OR_MOVE;
   }
 



More information about the Schmitzm-commits mailing list