当前位置: 首页>>代码示例>>Java>>正文


Java TreeItem.getChildren方法代码示例

本文整理汇总了Java中javafx.scene.control.TreeItem.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getChildren方法的具体用法?Java TreeItem.getChildren怎么用?Java TreeItem.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.TreeItem的用法示例。


在下文中一共展示了TreeItem.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTreeItemText

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private String getTreeItemText(TreeItem<?> lastPathComponent) {
    if (lastPathComponent == null || lastPathComponent.getValue() == null) {
        return "";
    }
    String original = lastPathComponent.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        String current = child.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:JavaFXElementPropertyAccessor.java

示例2: getTreeTableItemText

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") private String getTreeTableItemText(TreeTableView<?> treeTableView,
        TreeItem<?> lastPathComponent) {
    @SuppressWarnings("rawtypes")
    TreeTableColumn treeTableColumn = treeTableView.getTreeColumn();
    if (treeTableColumn == null) {
        treeTableColumn = treeTableView.getColumns().get(0);
    }
    ObservableValue<?> cellObservableValue = treeTableColumn.getCellObservableValue(lastPathComponent);
    String original = cellObservableValue.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        cellObservableValue = treeTableColumn.getCellObservableValue(child);
        String current = cellObservableValue.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:JavaFXElementPropertyAccessor.java

示例3: getItem

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public static TreeItem<Path> getItem(TreeItem<Path> root, Path path) {
    if (root.getValue().equals(path))
        return root;

    for (TreeItem<Path> child : root.getChildren()) {
        if (!path.equals(child.getValue())) {
            if (!child.getChildren().isEmpty()) {
                TreeItem<Path> item = getItem(child, path);
                if (item != null)
                    return item;
            }
        } else
            return child;
    }

    return null;
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:18,代码来源:TreeUpdater.java

示例4: LinkToTreeClass

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void LinkToTreeClass(TreeItem<TypeController> tree){
	
	if(tree.getValue() != null && tree.getValue().getType().getName().equals(this.classe.getName())) {
		this.treeClass = tree.getValue();
		this.treeClassTreeItem = tree;
		tree.getValue().getClassNameController().addObserver(this);
		tree.getValue().getClassColorController().addObserver(this);
		tree.getValue().getAddPropertySchemeController().addObserver(this);	
		tree.getValue().getRemovePropertySchemeController().addObserver(this);
		tree.getValue().GetAddPropertySchemeWithValueController().addObserver(this);
		tree.getValue().getAddClassSchemeController().addObserver(this);
		tree.getValue().getRemoveClassSchemeController().addObserver(this);
		return;
	}
	
	if(!tree.isLeaf()) {
		for(TreeItem<TypeController> t : tree.getChildren()) {
			LinkToTreeClass(t);
		}
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:22,代码来源:TypeClassRepresentationController.java

示例5: getGlobalIndexOf

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private int getGlobalIndexOf(TreeItem<String> fileNode)
{
	TreeItem<String> root = projectTreeDisplay.getRoot();
	ObservableList<TreeItem<String>> projectNodes = root.getChildren();
	
	int index = 0;
	for (TreeItem<String> node : projectNodes)
	{
		if (node.equals(fileNode))
			return index;
		
		index++;
		for (TreeItem<String> child : node.getChildren())
		{
			if (child.equals(fileNode))
				return index;
			index++;
		}
	}
	
	throw new IllegalArgumentException(fileNode.getValue() + " not found in tree");
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:23,代码来源:ProjectExplorerTree.java

示例6: droppedOnEmptyTreeItem

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void droppedOnEmptyTreeItem(
		TreeItem<LayerBaseContainer<? extends LayerBase>> currentlyDraggedLayerTreeItem) {

	TreeItem<LayerBaseContainer<? extends LayerBase>> draggedParent = currentlyDraggedLayerTreeItem.getParent();
	ObservableList<TreeItem<LayerBaseContainer<? extends LayerBase>>> draggedParentChildren = draggedParent != null
			? draggedParent.getChildren() : null;
	ObservableList<TreeItem<LayerBaseContainer<? extends LayerBase>>> rootChildren = this.getTreeView().getRoot()
			.getChildren();

	if (draggedParentChildren != null) {
		draggedParentChildren.remove(currentlyDraggedLayerTreeItem);
	} 
	
	DelayedExecuter.execute(100, () -> rootChildren.add(currentlyDraggedLayerTreeItem));

}
 
开发者ID:enoy19,项目名称:keyboard-light-composer,代码行数:17,代码来源:LayerBaseTreeCell.java

示例7: droppedOnTreeItem

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void droppedOnTreeItem(DragEvent event,
		TreeItem<LayerBaseContainer<? extends LayerBase>> currentlyDraggedLayerTreeItem,
		LayerBaseContainer<? extends LayerBase> targetItem) {
	LayerBase targetLayer = targetItem.getLayerBase();

	double y = event.getY();
	double height = getHeight();
	boolean above = y < height / 2;

	TreeItem<LayerBaseContainer<? extends LayerBase>> targetParent = this.getTreeItem().getParent();
	ObservableList<TreeItem<LayerBaseContainer<? extends LayerBase>>> targetParentChildren = targetParent
			.getChildren();

	TreeItem<LayerBaseContainer<? extends LayerBase>> draggedItem = currentlyDraggedLayerTreeItem;
	TreeItem<LayerBaseContainer<? extends LayerBase>> draggedParent = draggedItem.getParent();
	ObservableList<TreeItem<LayerBaseContainer<? extends LayerBase>>> draggedParentChildren = draggedParent != null
			? draggedParent.getChildren() : null;

	if (targetLayer instanceof EffectGroupLayer && (y >= height / 4 && y < height * 3 / 4)) {
		// inside group
		ObservableList<TreeItem<LayerBaseContainer<? extends LayerBase>>> groupChildren = getTreeItem()
				.getChildren();
		if (!groupChildren.equals(draggedParentChildren)) {
			if (draggedParentChildren != null) {
				draggedParentChildren.remove(draggedItem);
			}
			DelayedExecuter.execute(100, () -> groupChildren.add(0, draggedItem));
		}
	} else {
		if (draggedParentChildren != null) {
			ListItemUtil.swapItemsJavaFxThread(draggedParentChildren, targetParentChildren, draggedItem, this.getTreeItem(),
					above);
		} else {
			ListItemUtil.insertItem(targetParentChildren, draggedItem, this.getTreeItem(), above);
		}
	}
}
 
开发者ID:enoy19,项目名称:keyboard-light-composer,代码行数:38,代码来源:LayerBaseTreeCell.java

示例8: fill

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Fill the tree item.
 *
 * @param item the tree item.
 */
@FXThread
private void fill(@NotNull final TreeItem<VirtualResourceElement<?>> item) {

    final VirtualResourceElement<?> element = item.getValue();
    if(!element.hasChildren()) {
        return;
    }

    final ObservableList<TreeItem<VirtualResourceElement<?>>> items = item.getChildren();

    final Array<VirtualResourceElement<?>> children = element.getChildren();
    children.sort(NAME_COMPARATOR);
    children.forEach(child -> items.add(new TreeItem<>(child)));

    items.forEach(this::fill);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:VirtualResourceTree.java

示例9: populateChildren

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void populateChildren(File root, TreeItem<File> rootItem) {
    ObservableList<TreeItem<File>> children = rootItem.getChildren();
    File[] files = root.listFiles();
    if (files != null) {
        for (File file : files) {
            if (!file.getName().contains(".") && file.isDirectory()) {
                TreeItem<File> item = new TreeItem<File>(file);
                children.add(item);
                populateChildren(file, item);
            }
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:MarathonFileChooser.java

示例10: addAllParentTreeItem

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void addAllParentTreeItem(TreeItem<Object> root, List<TreeItem<Object>> parentItems) {
    ObservableList<TreeItem<Object>> children = root.getChildren();
    for (TreeItem<Object> treeItem : children) {
        if (treeItem.getChildren().size() != 0) {
            parentItems.add(treeItem);
        } else {
            addAllParentTreeItem(treeItem, parentItems);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:FunctionStage.java

示例11: expandTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void expandTreeView(TreeItem<Resource> item) {
    if (item != null && !item.isLeaf()) {
        item.setExpanded(true);
        for (TreeItem<Resource> child : item.getChildren()) {
            expandTreeView(child);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:ResourceView.java

示例12: collapseTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void collapseTreeView(TreeItem<?> item) {
    if (item != null && !item.isLeaf()) {
        item.setExpanded(false);
        for (TreeItem<?> child : item.getChildren()) {
            collapseTreeView(child);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:ResourceView.java

示例13: expandTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void expandTreeView(TreeItem<Test> item) {
    if (item != null && !item.isLeaf()) {
        item.setExpanded(true);
        for (TreeItem<Test> child : item.getChildren()) {
            expandTreeView(child);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:TestRunner.java

示例14: writeToParent

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
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));
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:TestRunner.java

示例15: printCell

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void printCell(TreeItem<File> root, String indent) {
    System.out.println(indent + printUsingTreeCell(root));
    ObservableList<TreeItem<File>> children = root.getChildren();
    if (children == null)
        return;
    for (TreeItem<File> object : children) {
        printCell(object, indent + "    ");
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:TreeViewSample.java


注:本文中的javafx.scene.control.TreeItem.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。