本文整理汇总了Java中javafx.scene.control.TreeView.getTreeItem方法的典型用法代码示例。如果您正苦于以下问题:Java TreeView.getTreeItem方法的具体用法?Java TreeView.getTreeItem怎么用?Java TreeView.getTreeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TreeView
的用法示例。
在下文中一共展示了TreeView.getTreeItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectTreeItemCheckBoxSelectedSelected
import javafx.scene.control.TreeView; //导入方法依赖的package包/类
@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");
}
};
}
示例2: selectTreeItemCheckBoxSelectedNotSelected
import javafx.scene.control.TreeView; //导入方法依赖的package包/类
@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");
}
};
}
示例3: rowToPath
import javafx.scene.control.TreeView; //导入方法依赖的package包/类
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);
}