[Schmitzm-commits] r2166 - 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:40:57 CET 2012


Author: mojays
Date: 2012-12-09 00:40:57 +0100 (Sun, 09 Dec 2012)
New Revision: 2166

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java
Log:
ListingTransferHandler: source/target component handled as Component (instead of LIST_IMPL)

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:17:59 UTC (rev 2165)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/dnd/ListingTransferHandler.java	2012-12-08 23:40:57 UTC (rev 2166)
@@ -80,9 +80,9 @@
   /** Hold the list components between which drag and drop is allowed */ 
   protected ArrayList<LIST_IMPL>  dndListComp = null;
   /** Holds the source component (the drag component) */
-  protected LIST_IMPL dragSourceComp = null;
+  protected Component dragSourceComp = null;
   /** Holds the destination component (the drop component) */
-  protected LIST_IMPL dropTargetComp = null;
+  protected Component dropTargetComp = null;
   /** Indicates whether drag and drop within the same list component is allowed (to
    *  reorder the elements). */
   protected boolean innerListDragAllowed = false;
@@ -195,9 +195,10 @@
                           checkDragDropAllowed(getDragSourceComponent(), (LIST_IMPL)dropComp) &&
                           info.isDrop() && 
                           info.isDataFlavorSupported(localObjectFlavor);
+     // remember target component for easy access
+     this.dropTargetComp = (LIST_IMPL)dropComp;
+
      if ( dndAllowed ) {
-       // remember target component for easy access
-       this.dropTargetComp = (LIST_IMPL)dropComp;
        // set cursor for possible drop
        dropComp.setCursor( DragSource.DefaultMoveDrop );
      } else
@@ -212,7 +213,7 @@
    * This default implementation always returns {@code true}. Sub classes can
    * override this method to implement special rules.
    */
-  protected boolean checkDragDropAllowed(LIST_IMPL fromList, LIST_IMPL toList) {
+  protected boolean checkDragDropAllowed(Component fromList, Component toList) {
     return true;
   }
 
@@ -232,7 +233,7 @@
   @Override
   public boolean importData(TransferHandler.TransferSupport info) {
      LIST_IMPL target = (LIST_IMPL) convertJScrollPane( info.getComponent() );
-     LIST_IMPL source = getDragSourceComponent();
+     LIST_IMPL source = (LIST_IMPL) getDragSourceComponent();
 
      logCompIndex("importData from", source);
      logCompIndex("importData to", target);
@@ -277,7 +278,7 @@
    * Returns the source list component, the drag is performed on.
    * @return {@code null} if no drag and drop action is in progress
    */
-  public LIST_IMPL getDragSourceComponent() {
+  public Component getDragSourceComponent() {
     return this.dragSourceComp;
   }
 
@@ -285,7 +286,7 @@
    * Returns the target list component, the drop is performed on.
    * @return {@code null} if no drag and drop action is in progress
    */
-  public LIST_IMPL getDropTargetComponent() {
+  public Component getDropTargetComponent() {
     return this.dropTargetComp;
   }
 



More information about the Schmitzm-commits mailing list