當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。