Revision: 4061
Author:   [email protected]
Date:     Mon May 27 11:21:55 2013
Log: Fixed bug # 2766. Undoing move of a column shows each step of the move cursor. Resolved this issue by changing/storing insertion point only after column dropped/moved. No need to store it while user still dragging/moving column.
http://code.google.com/p/power-architect/source/detail?r=4061

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Wed Dec 1 09:21:10 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Mon May 27 11:21:55 2013
@@ -155,6 +155,8 @@
        protected SQLColumn draggingColumn;

     private boolean fullyQualifiedNameInHeader = false;
+
+    private boolean isDragging = false;

     SPListener columnListener = new ColumnListener();

@@ -432,8 +434,10 @@
                int old = insertionPoint;
                this.insertionPoint = ip;
                if (ip != old) {
- firePropertyChange("insertionPoint", new Integer(old), new Integer(insertionPoint)); //$NON-NLS-1$
-                       repaint();
+                   if(!isDragging()) {
+ firePropertyChange("insertionPoint", new Integer(old), new Integer(insertionPoint)); //$NON-NLS-1$
+                   }
+                   repaint();
                }
        }

@@ -698,6 +702,7 @@
         if (logger.isDebugEnabled()) {
             logger.debug("DragEnter event on "+getName()); //$NON-NLS-1$
         }
+        setDragging(true);
     }

     /**
@@ -714,6 +719,7 @@
         if (logger.isDebugEnabled()) {
             logger.debug("DragExit event on "+getName()); //$NON-NLS-1$
         }
+        setDragging(false);
         setInsertionPoint(ITEM_INDEX_NONE);
     }

@@ -728,6 +734,7 @@
      * will be of the PlayPen.
      */
     public void dragOver(DropTargetDragEvent dtde) {
+        setDragging(true);
         if (logger.isDebugEnabled()) {
logger.debug("DragOver event on "+getName()+": "+dtde); //$NON-NLS-1$ //$NON-NLS-2$ logger.debug("Drop Action = "+dtde.getDropAction()); //$NON-NLS-1$
@@ -748,6 +755,7 @@
         } else {
             logger.debug("Unsuccesful drop"); //$NON-NLS-1$
         }
+        setDragging(false);
     }

     /**
@@ -797,6 +805,7 @@
             } finally {
                 setInsertionPoint(ITEM_INDEX_NONE);
                 pp.endCompoundEdit("Ending drag and drop");
+                setDragging(false);
             }
         }
     }
@@ -1293,4 +1302,20 @@
return new SQLObjectSelection(new ArrayList<SQLObject>(getSelectedItems()));
         }
     }
+
+    /**
+     * @return the isDragging
+     */
+    @NonBound
+    public boolean isDragging() {
+        return isDragging;
+    }
+
+    /**
+     * @param isDragging the isDragging to set
+     */
+    @NonBound
+    public void setDragging(boolean isDragging) {
+        this.isDragging = isDragging;
+    }
 }

--

--- You received this message because you are subscribed to the Google Groups "Architect Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to