Author: mes
Date: 2012-02-17 12:06:47 -0800 (Fri, 17 Feb 2012)
New Revision: 28316
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/FlagAndSelectionHandler.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
Log:
tiny bit of cleanup
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2012-02-17 19:49:37 UTC (rev 28315)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2012-02-17 20:06:47 UTC (rev 28316)
@@ -508,7 +508,10 @@
addEdgeView(ee);
logger.debug("Phase 3: All views created: time = " +
(System.currentTimeMillis() - start));
- new FlagAndSelectionHandler(this, cyEventHelper);
+
+ // Used to synchronize ding's internal selection state with the
rest of Cytoscape.
+ new FlagAndSelectionHandler(this);
+
cyAnnotator = new CyAnnotator(this,annMgr);
logger.debug("Phase 4: Everything created: time = " +
(System.currentTimeMillis() - start));
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/FlagAndSelectionHandler.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/FlagAndSelectionHandler.java
2012-02-17 19:49:37 UTC (rev 28315)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/FlagAndSelectionHandler.java
2012-02-17 20:06:47 UTC (rev 28316)
@@ -40,7 +40,6 @@
import org.cytoscape.ding.GraphViewChangeEvent;
import org.cytoscape.ding.GraphViewChangeListener;
import org.cytoscape.ding.NodeView;
-import org.cytoscape.event.CyEventHelper;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
@@ -61,7 +60,6 @@
private static final Logger logger =
LoggerFactory.getLogger(FlagAndSelectionHandler.class);
private final GraphView view;
- private final CyEventHelper eventHelper;
private final CyNetwork network;
/**
@@ -70,9 +68,8 @@
* and view by turning on flags or selections that are currently on in
one
* of the two objects.
*/
- public FlagAndSelectionHandler(final GraphView view, final
CyEventHelper eventHelper) {
+ public FlagAndSelectionHandler(final GraphView view) {
this.view = view;
- this.eventHelper = eventHelper;
this.network = view.getNetwork();
syncFilterAndView();
@@ -141,11 +138,9 @@
select(selectedEdges, true);
}
- private void select(final Collection<? extends CyTableEntry>
nodesOrEdges,
- final boolean selected) {
+ private void select(final Collection<? extends CyTableEntry>
nodesOrEdges, final boolean selected) {
if (nodesOrEdges.isEmpty())
return;
-
for (final CyTableEntry nodeOrEdge : nodesOrEdges)
network.getRow(nodeOrEdge).set(CyNetwork.SELECTED,
selected);
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
2012-02-17 19:49:37 UTC (rev 28315)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/InnerCanvas.java
2012-02-17 20:06:47 UTC (rev 28316)
@@ -687,16 +687,15 @@
final CyNode nodeObj = graph.getNode(node);
if (!m_view.m_spacial.exists(node,
m_view.m_extentsBuff, 0))
- continue; /* Will happen if e.g. node
was removed. */
+ continue; // Will happen if e.g. node
was removed.
final float nodeX = (m_view.m_extentsBuff[0] +
m_view.m_extentsBuff[2]) / 2;
final float nodeY = (m_view.m_extentsBuff[1] +
m_view.m_extentsBuff[3]) / 2;
final Iterable<CyEdge> touchingEdges =
graph.getAdjacentEdgeIterable(nodeObj, CyEdge.Type.ANY);
for ( CyEdge e : touchingEdges ) {
- final int edge = e.getIndex(); //
Positive.
- final int otherNode = // Positive.
- node ^ e.getSource().getIndex()
^ e.getTarget().getIndex();
+ final int edge = e.getIndex();
+ final int otherNode = node ^
e.getSource().getIndex() ^ e.getTarget().getIndex();
if (m_hash.get(otherNode) < 0) {
m_view.m_spacial.exists(otherNode, m_view.m_extentsBuff, 0);
@@ -1212,11 +1211,18 @@
if
(m_view.m_nodeSelection)
selectedNodes =
setSelectedNodes();
if
(m_view.m_edgeSelection)
- selectedEdges =
setSelectedEdges ();
+ selectedEdges =
setSelectedEdges();
}
}
m_selectionRect = null;
+
+ // Update visual property value (x/y)
+ for (int node : selectedNodes) {
+ final DNodeView dNodeView =
(DNodeView) m_view.getDNodeView(node);
+
dNodeView.setVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION,
dNodeView.getXPosition());
+
dNodeView.setVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION,
dNodeView.getYPosition());
+ }
final GraphViewChangeListener listener
= m_view.m_lis[0];
@@ -1239,17 +1245,6 @@
if (m_undoable_edit != null)
m_undoable_edit.post();
-
- final List<CyNode> selected =
m_view.getSelectedNodes();
- // Update view model if necessary (node location)
- if(selected.size() != 0) {
- for (CyNode node : selected) {
- final DNodeView dNodeView = (DNodeView)
m_view.getDNodeView(node);
- // Update visual property value (x/y)
-
dNodeView.setVisualProperty(MinimalVisualLexicon.NODE_X_LOCATION,
dNodeView.getXPosition());
-
dNodeView.setVisualProperty(MinimalVisualLexicon.NODE_Y_LOCATION,
dNodeView.getYPosition());
- }
- }
}
@Override
--
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.