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


Java TreeItem.setExpanded方法代码示例

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


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

示例1: TreeViewSample

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public TreeViewSample() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(
            new TreeItem<String>("Child Node 1"),
            new TreeItem<String>("Child Node 2"),
            new TreeItem<String>("Child Node 3")));

    treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(
            new TreeItem<String>("Child Node 4"),
            new TreeItem<String>("Child Node 5"),
            new TreeItem<String>("Child Node 6"),
            new TreeItem<String>("Child Node 7"),
            new TreeItem<String>("Child Node 8"),
            new TreeItem<String>("Child Node 9"),
            new TreeItem<String>("Child Node 10"),
            new TreeItem<String>("Child Node 11"),
            new TreeItem<String>("Child Node 12")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:TreeViewSample.java

示例2: initTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void initTreeView() {
    parentTreeView.setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
        @Override public TreeCell<File> call(TreeView<File> param) {
            return new ParentFileCell();
        }
    });
    parentTreeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newVlaue) -> {
        TreeItem<File> selectedItem = parentTreeView.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            newFolderButton.setDisable(false);
            fileNameBox.setEditable(true);
            File selectedFile = selectedItem.getValue();
            fillUpChildren(selectedFile);
        } else {
            fileNameBox.setEditable(false);
            newFolderButton.setDisable(true);
            childrenListView.getItems().clear();
        }
    });
    File root = fileChooserInfo.getRoot();
    TreeItem<File> rootItem = new TreeItem<>(root);
    parentTreeView.setRoot(rootItem);
    rootItem.setExpanded(true);
    parentTreeView.getSelectionModel().select(0);
    populateChildren(root, rootItem);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:MarathonFileChooser.java

示例3: TextFieldTreeViewSample

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public TextFieldTreeViewSample() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 1"), new TreeItem<String>("Child Node 2"),
            new TreeItem<String>("Child Node 3")));

    treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 4"),
            new TreeItem<String>("Child Node 5"), new TreeItem<String>("Child Node 6"), new TreeItem<String>("Child Node 7"),
            new TreeItem<String>("Child Node 8"), new TreeItem<String>("Child Node 9"), new TreeItem<String>("Child Node 10"),
            new TreeItem<String>("Child Node 11"), new TreeItem<String>("Child Node 12")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);
    treeView.setEditable(true);
    treeView.setCellFactory(TextFieldTreeCell.forTreeView());

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:TextFieldTreeViewSample.java

示例4: ChoiceBoxTreeViewSample

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public ChoiceBoxTreeViewSample() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 1"), new TreeItem<String>("Option 2"),
            new TreeItem<String>("Option 3")));

    treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 4"),
            new TreeItem<String>("Option 5"), new TreeItem<String>("Option 6")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);
    treeView.setEditable(true);
    treeView.setCellFactory(ChoiceBoxTreeCell.forTreeView(items));

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:ChoiceBoxTreeViewSample.java

示例5: ComboBoxTreeViewSample

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public ComboBoxTreeViewSample() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 1"), new TreeItem<String>("Option 2"),
            new TreeItem<String>("Option 3")));

    treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 4"),
            new TreeItem<String>("Option 5"), new TreeItem<String>("Option 6")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);
    treeView.setEditable(true);
    treeView.setCellFactory(ComboBoxTreeCell.forTreeView(items));

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:ComboBoxTreeViewSample.java

示例6: TreeViewSample1

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public TreeViewSample1() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 1"), new TreeItem<String>("Child Node 2"),
            new TreeItem<String>("Child Node 3")));

    treeRoot.getChildren().get(2).getChildren()
            .addAll(Arrays.asList(new TreeItem<String>("Child Node 4"), new TreeItem<String>("Child Node 5"),
                    new TreeItem<String>("Child Node 6"), new TreeItem<String>("Child Node 7"), new TreeItem<String>(
                            "Child Node 8"),
                    new TreeItem<String>("Child Node 9"), new TreeItem<String>("Child Node 10"),
                    new TreeItem<String>("Child Node 11"), new TreeItem<String>("Child Node 12"),
                    new TreeItem<String>("Child Node 13"), new TreeItem<String>("Child Node 14"),
                    new TreeItem<String>("Child Node 15"), new TreeItem<String>("Child Node 16"),
                    new TreeItem<String>("Child Node 17"), new TreeItem<String>("Child Node 18"),
                    new TreeItem<String>("Child Node 19"), new TreeItem<String>("Child Node 20"),
                    new TreeItem<String>("Child Node 21"), new TreeItem<String>("Child Node 22"),
                    new TreeItem<String>("Child Node 23"), new TreeItem<String>("Child Node 24")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:TreeViewSample1.java

示例7: setUpPrawnFileAuditTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Prepares the TreeView to be displayed
 * @param showDupesOnly determines whether the duplicate CheckBox has been checked
 */
private void setUpPrawnFileAuditTreeView(boolean showDupesOnly) {
    prawnAuditTree.setStyle(SquidUI.SPOT_LIST_CSS_STYLE_SPECS);
    
    SquidPrefixTree spotPrefixTree = squidProject.getPrefixTree();
    String summaryStatsString = spotPrefixTree.buildSummaryDataString();
    
    boolean hasDuplicates = spotPrefixTree.getCountOfDups() > 0;
    checkbox.setVisible(hasDuplicates);
    TreeItem<String> rootItem = customizeRootItem(summaryStatsString, hasDuplicates);
    rootItem.setExpanded(true);
    prawnAuditTree.setRoot(rootItem);
    
    populatePrefixTreeView(rootItem, spotPrefixTree, showDupesOnly);
}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:19,代码来源:SessionAuditController.java

示例8: 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:ztan5,项目名称:TechnicalAnalysisTool,代码行数:9,代码来源:MarketDataTreeViewNode.java

示例9: SchemaToTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public static TreeItem<TypeController> SchemaToTreeView(Schema s){
	TreeItem<TypeController> schema;
	TypeController ss = new TypeController(s, null);
	schema = new TreeItem<TypeController>(ss);
	schema.setExpanded(true);
	
	for (Type c : s.getTypes()) {
		addTypeTreeView(schema, c);			
	}
	return schema;
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:12,代码来源:SchemaTransformations.java

示例10: 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

示例11: createEmptyRootedProjectTree

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Creates empty tree project in case {@link OptionsSettingsTree#optionSet} is empty.
 * @return
 */
private TreeView<String> createEmptyRootedProjectTree()
{
	TreeItem<String> root = new TreeItem<String>("");
	root.setExpanded(true);

	TreeView<String> treeView = new TreeView<String>(root);
	treeView.showRootProperty().set(false);
	treeView.setBackground(Background.EMPTY);

	return treeView;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:16,代码来源:OptionsSettingsTree.java

示例12: fill

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

    final TreeItem<VirtualResourceElement<?>> newRoot = new TreeItem<>(element);
    newRoot.setExpanded(true);

    fill(newRoot);
    setRoot(newRoot);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:VirtualResourceTree.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: getPath

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public TreeItem<?> getPath(TreeView<?> treeView, String path) {
    String[] tokens = path.substring(1).split("(?<!\\\\)/");
    Object rootNode = treeView.getRoot();
    int start = treeView.isShowRoot() ? 1 : 0;
    List<TreeItem<?>> treePath = new ArrayList<TreeItem<?>>();
    treePath.add((TreeItem<?>) rootNode);
    StringBuilder searchedPath = new StringBuilder();
    if (treeView.isShowRoot()) {
        String rootNodeText = unescapeSpecialCharacters(tokens[0]);
        searchedPath.append("/" + rootNodeText);
        if (rootNode == null) {
            throw new RuntimeException("TreeView does not have a root node!");
        }
        if (!searchedPath.toString().equals("/" + getPathText(treePath))) {
            throw new RuntimeException("TreeView root node does not match: Expected </" + getPathText(treePath) + "> Actual: <"
                    + searchedPath.toString() + ">");
        }
    }
    for (int i = start; i < tokens.length; i++) {
        String childText = unescapeSpecialCharacters(tokens[i]);
        searchedPath.append("/" + childText);
        boolean matched = false;
        TreeItem<?> item = treePath.get(treePath.size() - 1);
        item.setExpanded(true);
        for (int j = 0; j < item.getChildren().size(); j++) {
            Object child = item.getChildren().get(j);
            treePath.add((TreeItem<?>) child);
            List<TreeItem<?>> childPath = treePath;
            if (childText.equals(getPathText(childPath))) {
                treePath = childPath;
                matched = true;
                break;
            }
        }
        if (!matched) {
            return null;
        }
    }
    return treePath.get(treePath.size() - 1);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:41,代码来源:JavaFXElementPropertyAccessor.java

示例15: EntretienToTreeView

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public static TreeItem<DescriptionEntretien> EntretienToTreeView(LinkedList<DescriptionEntretien> entretiens){
	TreeItem<DescriptionEntretien> entres;
	entres = new TreeItem<DescriptionEntretien>(new DescriptionEntretien(null, "Entretiens"));
	entres.setExpanded(true);
	for (DescriptionEntretien d : entretiens) {
		entres.getChildren().add(new TreeItem<DescriptionEntretien>(d));
	}
	return entres;
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:10,代码来源:SchemaTransformations.java


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