本文整理匯總了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);
}