Author: mes
Date: 2010-11-21 10:50:24 -0800 (Sun, 21 Nov 2010)
New Revision: 22970

Modified:
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
Log:
updated to support editing

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
   2010-11-21 18:49:57 UTC (rev 22969)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
   2010-11-21 18:50:24 UTC (rev 22970)
@@ -1269,13 +1269,19 @@
 
                Transferable t = dte.getTransferable();
 
-               Point pt = dte.getLocation();
+               Point rawPt = dte.getLocation();
+               double[] loc = new double[2];
+               loc[0] = rawPt.getX();
+               loc[1] = rawPt.getY();
+               m_view.xformComponentToNodeCoords(loc);
+               Point xformPt = new Point();
+               xformPt.setLocation(loc[0],loc[1]); 
 
-               NodeView nview = m_view.getPickedNodeView(pt);
+               NodeView nview = m_view.getPickedNodeView(rawPt);
                if ( nview != null )
-                       popup.createDropNodeViewMenu(nview,pt,t);
+                       popup.createDropNodeViewMenu(nview,rawPt,xformPt,t);
                else 
-                       popup.createDropEmptySpaceMenu(pt,t); 
+                       popup.createDropEmptySpaceMenu(rawPt,xformPt,t); 
 
                dte.dropComplete(true);
        }

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
       2010-11-21 18:49:57 UTC (rev 22969)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
       2010-11-21 18:50:24 UTC (rev 22970)
@@ -113,7 +113,7 @@
        /**
         * Creates a menu based on a drop event on a NodeView.
         */
-       void createDropNodeViewMenu(NodeView nview, Point p, Transferable t) {
+       void createDropNodeViewMenu(NodeView nview, Point rawPt, Point xformPt, 
Transferable t) {
                if (nview != null ) {
                        Collection<DropNodeViewTaskFactory> usableTFs = 
getPreferredActions(m_view.dropNodeViewTFs,null);
                        View<CyNode> nv = nview.getNodeViewModel();
@@ -126,17 +126,17 @@
 
                                for ( DropNodeViewTaskFactory nvtf : usableTFs 
) {
                                        
nvtf.setNodeView(nv,m_view.cyNetworkView);
-                                       nvtf.setDropInformation(t,p);
+                                       
nvtf.setDropInformation(t,rawPt,xformPt);
                                        createMenuItem(menu, nvtf, tracker, 
m_view.dropNodeViewTFs.get( nvtf ));
                                }
 
-                               menu.show(invoker, new 
Double(p.getX()).intValue(), new Double(p.getY()).intValue());
+                               menu.show(invoker, (int)(rawPt.getX()), 
(int)(rawPt.getY()));
 
                        // execute the task directly if only one factory exists 
                        } else if ( usableTFs.size() == 1) {
                                DropNodeViewTaskFactory tf  = 
usableTFs.iterator().next();
                                tf.setNodeView(nv,m_view.cyNetworkView);
-                               tf.setDropInformation(t,p);
+                               tf.setDropInformation(t,rawPt,xformPt);
                                executeTask(tf);
                        }
                }
@@ -175,7 +175,7 @@
        /**
         * Creates a menu based on the NetworkView.
         */
-       void createDropEmptySpaceMenu(Point p, Transferable t) {
+       void createDropEmptySpaceMenu(Point rawPt, Point xformPt, Transferable 
t) {
                // build a menu of actions if more than factory exists
                Collection<DropNetworkViewTaskFactory> usableTFs = 
getPreferredActions(m_view.dropEmptySpaceTFs,null);
                if ( usableTFs.size() > 1 ) {
@@ -183,15 +183,15 @@
                        JMenuTracker tracker = new JMenuTracker(menu);
                        for ( DropNetworkViewTaskFactory nvtf : usableTFs ) {
                                nvtf.setNetworkView(m_view.cyNetworkView);
-                               nvtf.setDropInformation(t,p);
+                               nvtf.setDropInformation(t,rawPt,xformPt);
                                createMenuItem(menu, nvtf, tracker, 
m_view.dropEmptySpaceTFs.get( nvtf ) );
                        }
-                       menu.show(invoker, new Double(p.getX()).intValue(), new 
Double(p.getY()).intValue());
+                       menu.show(invoker, (int)(rawPt.getX()), 
(int)(rawPt.getY()));
                // execute the task directly if only one factory exists 
                } else if ( usableTFs.size() == 1) {
                        DropNetworkViewTaskFactory tf = 
usableTFs.iterator().next();
                        tf.setNetworkView(m_view.cyNetworkView);
-                       tf.setDropInformation(t,p);
+                       tf.setDropInformation(t,rawPt,xformPt);
                        executeTask(tf);
                }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to