I'm working on a visualisation tool using JUNG2. I'm trying to put in a simple button that someone can press, that makes the entire graph visible in the pane I'm looking at . I think I'm on the right path, but there's some last little bit that I'm missing. If anyone could advise, I'd greatly appreciate it:
public void makeWholeGraphVisible() {
RenderContext<CKNode, CKEdge> rc = vv.getRenderContext();
BoundingRectangleCollector<CKNode, CKEdge> brc = new BoundingRectangleCollector<CKNode, CKEdge>(rc, layout);
brc.compute();
List<Rectangle2D> rectangles = brc.getRectangles();
if(rectangles.isEmpty()) {
return;
}
Rectangle2D endRect = rectangles.get(0);
for(Rectangle2D rect : rectangles) {
endRect.add(rect);
}
System.out.println(endRect.toString());
// vv.setBounds(endRect.getBounds());
vv.scrollRectToVisible(endRect.getBounds()); // This does nothing ?
}
I'm working on a visualisation tool using JUNG2. I'm trying to put in a simple button that someone can press, that makes the entire graph visible in the pane I'm looking at . I think I'm on the right path, but there's some last little bit that I'm missing. If anyone could advise, I'd greatly appreciate it:
I think this may also be related to this stackoverflow question: http://stackoverflow.com/questions/9666094/jung2-how-to-scale-make-all-vertexes-visible
Thanks,
Gary