List of usage examples for javafx.scene.control TreeTableRow getTreeItem
public final TreeItem<T> getTreeItem()
From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeTableOperationContext.java
/** * Gets the rendered text of a TreeTableCell * //from w ww . j a v a2 s.c om * @param node * this can be a cell or a tree item * @param col * if node is a tree item this parameter is used to find the cell * to get the rendered text from * @return the rendered text */ private String getRenderedTextFromCell(final Object node, final int col) { if (node instanceof TreeItem<?>) { scrollNodeToVisible(node); } String result = EventThreadQueuerJavaFXImpl.invokeAndWait("getRenderedText", new Callable<String>() { //$NON-NLS-1$ @Override public String call() throws Exception { if (node instanceof TreeTableCell) { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node; return cell.getText(); } else if (node instanceof TreeItem) { TreeItem<?> item = (TreeItem<?>) node; TreeTableView<?> treeTable = getTree(); List<TreeTableCell> cells = new NodeTraverseHelper<TreeTableCell>().getInstancesOf(treeTable, TreeTableCell.class); for (TreeTableCell<?, ?> cell : cells) { // Nullchecks because of the virtual flow cells // are created which might not be associated // with a row or an item TreeTableRow<?> ttRow = cell.getTreeTableRow(); if (ttRow == null) { continue; } TreeItem<?> checkItem = ttRow.getTreeItem(); if (checkItem == null) { continue; } if (item != null && checkItem.equals(item) && treeTable.getColumns().indexOf(cell.getTableColumn()) == col) { return cell.getText(); } } } return null; } }); return result; }
From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeTableOperationContext.java
@Override public void expandNode(final Object node) { scrollNodeToVisible(node);/*from ww w . j a v a2s.co m*/ Object result = EventThreadQueuerJavaFXImpl.invokeAndWait("expandNode", //$NON-NLS-1$ new Callable<Object>() { @Override public Object call() throws Exception { TreeItem<?> item = (TreeItem<?>) node; TreeTableView<?> treeTable = getTree(); List<TreeTableCell> cells = new NodeTraverseHelper<TreeTableCell>() .getInstancesOf(treeTable, TreeTableCell.class); for (TreeTableCell<?, ?> treeTableCell : cells) { // Nullchecks because of the virtual flow cells // are created which might not be associated // with a row or an item TreeTableRow<?> ttRow = treeTableCell.getTreeTableRow(); if (ttRow == null) { continue; } TreeItem<?> checkItem = ttRow.getTreeItem(); if (checkItem == null) { continue; } if (item != null && checkItem.equals(item) && !item.isExpanded()) { return treeTableCell.getTreeTableRow().getDisclosureNode(); } } return null; } }); if (result != null) { getRobot().click(result, null, ClickOptions.create().setClickCount(1).setMouseButton(1)); } EventThreadQueuerJavaFXImpl.invokeAndWait("expandNodeCheckIfExpanded", //$NON-NLS-1$ new Callable<Void>() { @Override public Void call() throws Exception { TreeItem<?> item = (TreeItem<?>) node; if (!getTree().isDisabled() && !item.isExpanded()) { log.warn("Expand node fallback used for: " //$NON-NLS-1$ + item.getValue()); item.setExpanded(true); } return null; } }); }
From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeTableOperationContext.java
@Override public void collapseNode(final Object node) { scrollNodeToVisible(node);/* ww w .j av a2 s . c o m*/ Object result = EventThreadQueuerJavaFXImpl.invokeAndWait("collapseNode", //$NON-NLS-1$ new Callable<Object>() { @Override public Object call() throws Exception { TreeItem<?> item = (TreeItem<?>) node; TreeTableView<?> treeTable = getTree(); List<TreeTableCell> cells = new NodeTraverseHelper<TreeTableCell>() .getInstancesOf(treeTable, TreeTableCell.class); for (TreeTableCell<?, ?> treeTableCell : cells) { // Nullchecks because of the virtual flow cells // are created which might not be associated // with a row or an item TreeTableRow<?> ttRow = treeTableCell.getTreeTableRow(); if (ttRow == null) { continue; } TreeItem<?> checkItem = ttRow.getTreeItem(); if (checkItem == null) { continue; } if (item != null && checkItem.equals(item) && item.isExpanded()) { return treeTableCell.getTreeTableRow().getDisclosureNode(); } } return null; } }); if (result != null) { getRobot().click(result, null, ClickOptions.create().setClickCount(1).setMouseButton(1)); } EventThreadQueuerJavaFXImpl.invokeAndWait("collapseNodeCheckIfExpanded", //$NON-NLS-1$ new Callable<Void>() { @Override public Void call() throws Exception { TreeItem<?> item = (TreeItem<?>) node; if (!getTree().isDisabled() && item.isExpanded()) { log.warn("Expand node fallback used for: " //$NON-NLS-1$ + item.getValue()); item.setExpanded(true); } return null; } }); }
From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeTableOperationContext.java
@Override public Rectangle getNodeBounds(final Object node) { scrollNodeToVisible(node);//from www. j av a 2s . co m return EventThreadQueuerJavaFXImpl.invokeAndWait("getNodeBounds", new Callable<Rectangle>() { //$NON-NLS-1$ @Override public Rectangle call() throws Exception { TreeTableView<?> treeTable = getTree(); treeTable.layout(); TreeItem<?> item = (TreeItem<?>) node; List<TreeTableCell> cells = new NodeTraverseHelper<TreeTableCell>().getInstancesOf(treeTable, TreeTableCell.class); for (TreeTableCell<?, ?> cell : cells) { // Nullchecks because of the virtual flow cells // are created which might not be associated // with a row or an item TreeTableRow<?> ttRow = cell.getTreeTableRow(); if (ttRow == null) { continue; } TreeItem<?> checkItem = ttRow.getTreeItem(); if (checkItem == null) { continue; } if (item != null && checkItem.equals(item) && treeTable.getColumns().indexOf(cell.getTableColumn()) == m_column) { Rectangle b = NodeBounds.getAbsoluteBounds(cell); Rectangle treeB = NodeBounds.getAbsoluteBounds(treeTable); return new Rectangle(Math.abs(treeB.x - b.x), Math.abs(treeB.y - b.y), Rounding.round(b.getWidth()), Rounding.round(b.getHeight())); } } return null; } }); }