Java Code Examples for javafx.scene.control.TreeItem#isExpanded()

The following examples show how to use javafx.scene.control.TreeItem#isExpanded() . 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: ScanCommandTree.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private void reveal(final TreeItem<ScanCommand> item)
{
    // Expand tree up to parent because 'getRow' will
    // only find items that are expanded
    TreeItem<ScanCommand> parent = item.getParent();
    while (parent != null)
    {
        if (! parent.isExpanded())
            parent.setExpanded(true);
        parent = parent.getParent();
    }

    // Scroll to the active command
    final int row = getRow(active_item);
    if (row >= 0)
    {
        // Try to show one command above the desired one to get some context
        if (row > 1)
            scrollTo(row-1);
        else
            scrollTo(row);
    }
}
 
Example 2
Source File: CObjectTreeArray.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
private void extractDataFromTree(
		ArrayList<ObjectInStructure> treedata,
		TreeItem<ObjectDataElt> nodetoprocess,
		int leveltouse,
		String cascadetouse,
		int circuitbreaker) {
	if (circuitbreaker > CObjectTreeArray.TREE_NAVIGATION_CIRCUITBREAKER)
		throw new RuntimeException("Circuit Breaker on too deep recursive structure");
	String currentnodecascade = cascadetouse;
	int levelforchildren = leveltouse;

	if (nodetoprocess.getValue() != null) {
		currentnodecascade = (cascadetouse.length() > 0 ? cascadetouse : "1");
		boolean leaf = true;
		if (nodetoprocess.getChildren().size() > 0)
			leaf = false;
		treedata.add(new ObjectInStructure(nodetoprocess.getValue(), currentnodecascade, leveltouse, leaf));
		levelforchildren++;
	}
	if (nodetoprocess.isExpanded()) {
		Iterator<TreeItem<ObjectDataElt>> childreniterator = nodetoprocess.getChildren().iterator();
		int childindex = 0;
		while (childreniterator.hasNext()) {
			childindex++;
			TreeItem<ObjectDataElt> thischild = childreniterator.next();
			String childcascade = currentnodecascade + (currentnodecascade.length() > 0 ? "." : "") + childindex;
			extractDataFromTree(treedata, thischild, levelforchildren, childcascade, circuitbreaker + 1);
		}
	}
}
 
Example 3
Source File: FileTreeView.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ObservableList<TreeItem<File>> getLoadedChildren(TreeItem<File> item) {
	return (item instanceof FileTreeItem && !item.isExpanded())
		? ((FileTreeItem)item).getLoadedChildren()
		: item.getChildren();
}