Skip to content

Commit d2dac77

Browse files
author
brunomnsilva
committed
Fix: labels for vertices and edges are now updated during calls to
update() or updateAndWait().
1 parent 3958ea9 commit d2dac77

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

releases/JavaFXSmartGraph-0.9.jar

270 Bytes
Binary file not shown.

releases/JavaFXSmartGraph-0.9.zip

-867 Bytes
Binary file not shown.

src/com/brunomnsilva/smartgraph/graphview/SmartGraphPanel.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ public Boolean call() throws Exception {
344344
private synchronized void updateNodes() {
345345
removeNodes();
346346
insertNodes();
347+
updateLabels();
347348
}
348349

349350
/*
@@ -669,6 +670,25 @@ private void removeVertice(SmartGraphVertexNode v) {
669670
}
670671
}
671672

673+
/**
674+
* Updates node's labels
675+
*/
676+
private void updateLabels() {
677+
theGraph.vertices().forEach((v) -> {
678+
SmartGraphVertexNode<V> vertexNode = vertexNodes.get(v);
679+
if (vertexNode != null) {
680+
vertexNode.getAttachedLabel().setText(v.toString());
681+
}
682+
});
683+
684+
for (Edge<E, V> e : theGraph.edges()) {
685+
SmartGraphEdgeBase edgeNode = edgeNodes.get(e);
686+
if(edgeNode != null) {
687+
edgeNode.getAttachedLabel().setText(e.toString());
688+
}
689+
}
690+
}
691+
672692
/**
673693
* Computes the bounding box from all displayed vertices.
674694
*

0 commit comments

Comments
 (0)