List of usage examples for javafx.scene.control TreeView localToScreen
public Point2D localToScreen(double localX, double localY)
From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeOperationContext.java
@Override public Rectangle getNodeBounds(final Object node) { Rectangle result = EventThreadQueuerJavaFXImpl.invokeAndWait("getNodeBounds", new Callable<Rectangle>() { //$NON-NLS-1$ @Override/*from www . j a v a 2 s . co m*/ public Rectangle call() throws Exception { List<? extends TreeCell> tCells = ComponentHandler.getAssignableFrom(TreeCell.class); for (TreeCell<?> cell : tCells) { TreeItem<?> item = cell.getTreeItem(); TreeView<?> tree = (TreeView<?>) getTree(); if ((item != null && item.equals(node))) { // Update the layout coordinates otherwise // we would get old position values tree.layout(); Point2D posTree = tree.localToScreen(0, 0); Point2D posCell = cell.localToScreen(0, 0); Bounds b = cell.getBoundsInParent(); Rectangle cBounds = new Rectangle( Math.abs(Rounding.round((posCell.getX() - posTree.getX()))), Math.abs(Rounding.round((posCell.getY() - posTree.getY()))), Rounding.round(b.getWidth()), Rounding.round(b.getHeight())); return cBounds; } } return null; } }); return result; }