Java Code Examples for javafx.scene.control.TreeView#getTreeItem()

The following examples show how to use javafx.scene.control.TreeView#getTreeItem() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaFXTreeViewCheckBoxTreeCellElementTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void selectTreeItemCheckBoxSelectedSelected() {
    TreeView<?> treeViewNode = (TreeView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-view");
    CheckBoxTreeItem<?> treeItem = (CheckBoxTreeItem<?>) treeViewNode.getTreeItem(2);
    treeItem.setSelected(true);
    JSONObject o = new JSONObject();
    o.put("select", "/Root node/Child Node 2");
    IJavaFXElement item = treeView.findElementByCssSelector(".::select-by-properties('" + o.toString() + "')");
    IJavaFXElement cb = item.findElementByCssSelector(".::editor");
    cb.marathon_select("Child Node 2:checked");
    new Wait("Wait for tree item check box to be selected") {
        @Override
        public boolean until() {
            String selected = cb.getAttribute("selected");
            return selected.equals("true");
        }
    };
}
 
Example 2
Source File: JavaFXTreeViewCheckBoxTreeCellElementTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void selectTreeItemCheckBoxSelectedNotSelected() {
    TreeView<?> treeViewNode = (TreeView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-view");
    CheckBoxTreeItem<?> treeItem = (CheckBoxTreeItem<?>) treeViewNode.getTreeItem(2);
    treeItem.setSelected(true);
    JSONObject o = new JSONObject();
    o.put("select", "/Root node/Child Node 2");
    IJavaFXElement item = treeView.findElementByCssSelector(".::select-by-properties('" + o.toString() + "')");
    IJavaFXElement cb = item.findElementByCssSelector(".::editor");
    cb.marathon_select("Child Node 2:unchecked");
    new Wait("Wait for tree item check box to be deselected") {
        @Override
        public boolean until() {
            String selected = cb.getAttribute("selected");
            return selected.equals("false");
        }
    };
}
 
Example 3
Source File: JavaFXElementPropertyAccessor.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public String rowToPath(int row) {
    TreeView<?> treeView = (TreeView<?>) getComponent();
    TreeItem<?> treeItem = treeView.getTreeItem(row);
    if (treeItem == null) {
        throw new RuntimeException("Trying to create a tree item for row " + row + " which is invalid");
    }
    return getTextForNode(treeView, treeItem);
}