javafx.scene.control.TreeItem#isLeaf ( )源码实例Demo

下面列出了javafx.scene.control.TreeItem#isLeaf ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: OEE-Designer   文件: OpcDaBrowserController.java
private void populateAvailableTags(TreeItem<OpcDaTagTreeBranch> selectedItem) {
	try {
		clearTagData();
		availableTags.clear();

		if (selectedItem != null && selectedItem.isLeaf()) {

			// fill in the possible tags
			OpcDaTagTreeBranch selectedNode = selectedItem.getValue();

			OpcDaTreeBrowser treeBrowser = getApp().getOpcDaClient().getTreeBrowser();

			Collection<OpcDaBrowserLeaf> tags = treeBrowser.getLeaves(selectedNode);

			availableTags.clear();
			for (OpcDaBrowserLeaf tag : tags) {
				if (!monitoredItemIds.contains(tag.getItemId())) {
					availableTags.add(tag);
				}
			}
		}
		lvAvailableTags.refresh();
	} catch (Exception e) {
		AppUtils.showErrorDialog(e);
	}
}
 
源代码2 项目: JFoenix   文件: JFXTreeTableCellSkin.java
private void updateDisclosureNode() {
    Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
    if (disclosureNode != null) {
        TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem();
        final S value = item == null ? null : item.getValue();
        boolean disclosureVisible = value != null
                                    && !item.isLeaf()
                                    && value instanceof RecursiveTreeObject
                                    && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn();
        disclosureNode.setVisible(disclosureVisible);
        if (!disclosureVisible) {
            getChildren().remove(disclosureNode);
        } else if (disclosureNode.getParent() == null) {
            getChildren().add(disclosureNode);
            disclosureNode.toFront();
        } else {
            disclosureNode.toBack();
        }
        if (disclosureNode.getScene() != null) {
            disclosureNode.applyCss();
        }
    }
}
 
源代码3 项目: MyBox   文件: GeographyCodeSelectorController.java
protected void addNode(TreeItem<Text> node, GeographyCode parent, GeographyCode child) {
    if (node == null || parent == null || child == null) {
        return;
    }
    if (node.getValue().getUserData() != null) {
        long current = (long) (node.getValue().getUserData());
        if (current == parent.getGcid()) {
            Text childNode = new Text(child.getName());
            childNode.setOnMouseClicked((MouseEvent event) -> {
                userController.codeSelected(child);
            });
            childNode.setUserData(child.getGcid());
            TreeItem<Text> codeItem = new TreeItem(childNode);
            node.getChildren().add(codeItem);
            node.setExpanded(true);
            return;
        }
    }
    if (node.isLeaf()) {
        return;
    }
    for (TreeItem<Text> subNode : node.getChildren()) {
        addNode(subNode, parent, child);
    }
}
 
源代码4 项目: BetonQuest-Editor   文件: RootController.java
@FXML public void select(MouseEvent event) {
	try {
		TreeItem<String> selected = tree.getSelectionModel().getSelectedItem();
		if (event.getClickCount() != 2 || selected == null || !selected.isLeaf()) {
			return;
		}
		BetonQuestEditor instance = BetonQuestEditor.getInstance();
		PackageSet set = instance.getSet(selected.getParent().getValue());
		if (set == null) {
			return;
		}
		QuestPackage pack = set.getPackage(selected.getValue());
		if (pack == null) {
			return;
		}
		instance.display(pack);
		hide();
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
源代码5 项目: MyBox   文件: ConditionTreeView.java
public void checkExpanded(TreeItem<ConditionNode> item) {
    try {
        if (item == null || item.isLeaf() || !(item instanceof CheckBoxTreeItem)) {
            return;
        }
        CheckBoxTreeItem<ConditionNode> citem = (CheckBoxTreeItem<ConditionNode>) item;
        ConditionNode node = item.getValue();
        if (citem.isExpanded() && !expandedNodes.contains(node.getTitle())) {
            expandedNodes.add(node.getTitle());
        }
        for (TreeItem<ConditionNode> child : item.getChildren()) {
            checkExpanded(child);
        }
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
源代码6 项目: JFoenix   文件: JFXTreeTableCellBehavior.java
@Override
protected boolean handleDisclosureNode(double x, double y) {
    final TreeItem<S> treeItem = getControl().getTreeTableRow().getTreeItem();
    if (!treeItem.isLeaf()) {
        final Node disclosureNode = getControl().getTreeTableRow().getDisclosureNode();
        if (disclosureNode != null) {
            if (disclosureNode.getBoundsInParent().contains(x + disclosureNode.getTranslateX(), y)) {
                if (treeItem != null) {
                    treeItem.setExpanded(!treeItem.isExpanded());
                }
                return true;
            }
        }
    }
    return false;
}
 
源代码7 项目: marathonv5   文件: TestRunner.java
private TestTreeItem findNextFailureInChildren(TestTreeItem parent, boolean findInSibling) {
    TestTreeItem found = null;
    for (TreeItem<Test> child : parent.getChildren()) {
        if (child.isLeaf()
                && (((TestTreeItem) child).getState() == State.FAILURE || ((TestTreeItem) child).getState() == State.ERROR)) {
            found = (TestTreeItem) child;
            break;
        } else {
            found = findNextFailureInChildren((TestTreeItem) child, findInSibling);
            if (found != null) {
                break;
            }
        }
    }
    if (found == null && findInSibling) {
        TestTreeItem sib = (TestTreeItem) parent.nextSibling();
        if (isFailure(sib)) {
            found = sib;
        } else {
            if (sib != null) {
                found = findNextFailureInChildren(sib, true);
            }
        }
    }
    return found;
}
 
源代码8 项目: MyBox   文件: GeographyCodeSelectorController.java
protected boolean loaded(TreeItem<Text> item) {
    if (item == null || item.isLeaf()) {
        return true;
    }
    try {
        TreeItem<Text> dummyItem = (TreeItem<Text>) (item.getChildren().get(0));
        return !"Loading".equals(dummyItem.getValue().getText());
    } catch (Exception e) {
        return true;
    }
}
 
源代码9 项目: MyBox   文件: GeographyCodeSelectorController.java
protected void removeNode(TreeItem<Text> node, GeographyCode code) {
    if (node == null || code == null || node.isLeaf()) {
        return;
    }
    for (TreeItem<Text> subNode : node.getChildren()) {
        if (subNode.getValue().getUserData() != null) {
            long subCode = (long) (subNode.getValue().getUserData());
            if (subCode == code.getGcid()) {
                node.getChildren().remove(subNode);
                return;
            }
        }
        removeNode(subNode, code);
    }
}
 
源代码10 项目: MyBox   文件: ConditionTreeView.java
public void checkSelection(TreeItem<ConditionNode> item) {
    try {
        if (item == null || !(item instanceof CheckBoxTreeItem)) {
            return;
        }
        CheckBoxTreeItem<ConditionNode> citem = (CheckBoxTreeItem<ConditionNode>) item;
        ConditionNode node = item.getValue();
        if (citem.isSelected()) {
            if (finalConditions == null || finalConditions.isBlank()) {
                if (node.getCondition() == null || node.getCondition().isBlank()) {
                    finalConditions = "";
                } else {
                    finalConditions = " ( " + node.getCondition() + ") ";
                }
            } else {
                if (node.getCondition() != null && !node.getCondition().isBlank()) {
                    finalConditions += " OR ( " + node.getCondition() + " ) ";
                }
            }

            if (finalTitle == null || finalTitle.isBlank()) {
                finalTitle = "\"" + node.getTitle() + "\"";
            } else {
                finalTitle += " + \"" + node.getTitle() + "\"";
            }
            if (!selectedTitles.contains(node.getTitle())) {
                selectedTitles.add(node.getTitle());
            }
            return;
        } else if (item.isLeaf() || !citem.isIndeterminate()) {
            return;
        }
        for (TreeItem<ConditionNode> child : item.getChildren()) {
            checkSelection(child);
        }
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
源代码11 项目: MyBox   文件: ConditionTreeView.java
public void expandNode(TreeItem<ConditionNode> item) {
    try {
        if (item == null || item.isLeaf()) {
            return;
        }
        item.setExpanded(true);
        for (TreeItem<ConditionNode> child : item.getChildren()) {
            expandNode(child);
        }
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
源代码12 项目: MyBox   文件: ConditionTreeView.java
public void expandNone(TreeItem<ConditionNode> item) {
    try {
        if (item == null || item.isLeaf()) {
            return;
        }
        item.setExpanded(true);
        for (TreeItem<ConditionNode> child : item.getChildren()) {
            expandNode(child);
        }
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
源代码13 项目: marathonv5   文件: FunctionStage.java
@Override
public void changed(ObservableValue<? extends TreeItem<Object>> observable, TreeItem<Object> oldValue,
        TreeItem<Object> newValue) {
    if (newValue == null) {
        okButton.setDisable(true);
        documentArea.setText("");
        argumentPane.getChildren().clear();
        return;
    }
    TreeItem<Object> item = tree.getSelectionModel().getSelectedItem();
    String doc = "";
    boolean disable = true;
    functionItem = item;
    Object value = item.getValue();
    if (value instanceof Module) {
        doc = ((Module) value).getDocumentation();
    } else {
        doc = ((Function) value).getDocumentation();
        disable = false;
    }
    okButton.setDisable(disable);
    documentArea.setText(doc);
    argumentPane.getChildren().clear();
    if (item.isLeaf()) {
        addArguments(item);
    }
}
 
源代码14 项目: marathonv5   文件: ResourceView.java
private void expandTreeView(TreeItem<Resource> item) {
    if (item != null && !item.isLeaf()) {
        item.setExpanded(true);
        for (TreeItem<Resource> child : item.getChildren()) {
            expandTreeView(child);
        }
    }
}
 
源代码15 项目: pcgen   文件: PreferencesDialog.java
private static <T> void forEachLeaf(TreeItem<? extends T> parent, Consumer<T> func)
{
	if (parent.isLeaf())
	{
		func.accept(parent.getValue());
	}
	else
	{
		parent.getChildren().forEach(child -> forEachLeaf(child, func));
	}
}
 
源代码16 项目: sis   文件: MetadataNode.java
private void expandNodes(TreeItem<TreeTable.Node> root) {
    if (root == null || root.isLeaf()) {
        return;
    }
    root.setExpanded(getExpandNode().test(root.getValue()));
    for (TreeItem<TreeTable.Node> child : root.getChildren()) {
        expandNodes(child);
    }
}
 
源代码17 项目: marathonv5   文件: TestRunner.java
private void writeToParent(TreeItem<Test> parent, JSONObject parentJSON) {
    ObservableList<TreeItem<Test>> children = parent.getChildren();
    for (TreeItem<Test> child : children) {
        if (child.isLeaf()) {
            writeLeafToParent(child, parentJSON);
        } else {
            writeToParent(child, createParentJSONObject(child, parentJSON));
        }
    }
}
 
源代码18 项目: phoebus   文件: AlarmTreeView.java
private void expandAlarms(final TreeItem<AlarmTreeItem<?>> node)
{
    if (node.isLeaf())
        return;

    // Always expand the root, which itself is not visible,
    // but this will show all the top-level elements.
    // In addition, expand those items which are in active alarm.
    final boolean expand = node.getValue().getState().severity.isActive() ||
                           node == tree_view.getRoot();
    node.setExpanded(expand);
    for (TreeItem<AlarmTreeItem<?>> sub : node.getChildren())
        expandAlarms(sub);
}
 
源代码19 项目: phoebus   文件: TreeHelper.java
/** Expand or collapse complete sub tree
 *
 *  @param node Node from which on to expand
 *  @param expand Expand or collapse?
 */
public static void setExpanded(final TreeItem<?> node, final boolean expand)
{
    if (node.isLeaf())
        return;
    node.setExpanded(expand);
    for (TreeItem<?> sub : node.getChildren())
        setExpanded(sub, expand);
}
 
源代码20 项目: pcgen   文件: PreferencesDialog.java
private static <T> void forEachLeaf(TreeItem<? extends T> parent, Consumer<T> func)
{
	if (parent.isLeaf())
	{
		func.accept(parent.getValue());
	}
	else
	{
		parent.getChildren().forEach(child -> forEachLeaf(child, func));
	}
}