當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeItem類代碼示例

本文整理匯總了Java中javafx.scene.control.TreeItem的典型用法代碼示例。如果您正苦於以下問題:Java TreeItem類的具體用法?Java TreeItem怎麽用?Java TreeItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TreeItem類屬於javafx.scene.control包,在下文中一共展示了TreeItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTreeView

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public TreeView<Concept> getTreeView() {
    if (treeView == null) {
        TreeCellFactory cellFactory = new TreeCellFactory(conceptService);
        treeView = new TreeView<>();
        treeView.getStyleClass().add("concepttree-treeview");
        treeView.setEditable(false);
        treeView.setCellFactory(tv -> cellFactory.build());
        treeView.setContextMenu(getContextMenu());
        conceptService.findRoot()
                .thenApply(root -> {
                    Platform.runLater(() -> {
                        TreeItem<Concept> rootItem = buildTreeItem(root, null);
                        treeView.setRoot(rootItem);
                    });
                    return null;
                });
    }
    return treeView;
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:20,代碼來源:TreeViewController.java

示例2: changed

import javafx.scene.control.TreeItem; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:27,代碼來源:FunctionStage.java

示例3: testBranches

import javafx.scene.control.TreeItem; //導入依賴的package包/類
@Test
public void testBranches() {
  table.getEntry("branch/entry").setString("x");
  NetworkTableInstance.getDefault().waitForEntryListenerQueue(-1.0);
  waitForFxEvents();
  ObservableList<TreeItem<NetworkTableSourceEntry>> children = root.getChildren();

  assertEquals(1, children.size(), "There should be 1 first-level child");
  assertEquals(1, children.get(0).getChildren().size(), "There should be 1 second-level child");
  final TreeItem<NetworkTableSourceEntry> branch = children.get(0);
  final TreeItem<NetworkTableSourceEntry> leaf = branch.getChildren().get(0);

  assertThat(branch, hasKey("/branch"));
  assertThat(branch, hasDisplayString(""));
  assertThat("Branch should not be a leaf", branch, not(isLeaf()));
  assertThat("Branch should be expanded", branch, isExpanded());

  assertThat(leaf, hasKey("/branch/entry"));
  assertThat(leaf, hasSimpleKey("entry"));
  assertThat(leaf, hasDisplayString("x"));
  assertThat(leaf, isLeaf());
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:23,代碼來源:NetworkTableTreeTest.java

示例4: expanderListener

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public ChangeListener<Boolean> expanderListener() {
    return (observable, oldValue, newValue) -> {
        BooleanProperty bb = (BooleanProperty) observable;

        TreeItem t = (TreeItem) bb.getBean();

        CustomIcons customIcons = new CustomIcons();
        t.setGraphic(new ImageView(newValue ? customIcons.getFolderExpandImage() : customIcons.getFolderCollapseImage()));

        if (newValue) {
            scheduleHighlight();
        }
    };
}
 
開發者ID:MrChebik,項目名稱:Coconut-IDE,代碼行數:15,代碼來源:TreeUpdater.java

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

示例6: getCollections

import javafx.scene.control.TreeItem; //導入依賴的package包/類
List<TreeItem<String>> getCollections() {
    Set<String> mapNames = dbStore.getMapNames();

    List<TreeItem<String>> treeItems = new ArrayList<>();
    mapNames.stream().filter(this::isCollection)
            .forEachOrdered(name -> {
                TreeItem<String> collectionItem = new TreeItem<>(name, getIcon("collection.png"));
                if (!name.contains(META_MAP_NAME)) {

                    TreeItem<String> indicesItem = new TreeItem<>("Indices");
                    indicesItem.getChildren().addAll(getIndices(mapNames, name));

                    TreeItem<String> metaItem = new TreeItem<>("Metadata");
                    metaItem.getChildren().add(getMeta(mapNames, name));

                    collectionItem.getChildren().add(indicesItem);
                    collectionItem.getChildren().add(metaItem);
                }
                treeItems.add(collectionItem);
            });
    return treeItems;
}
 
開發者ID:dizitart,項目名稱:nitrite-database,代碼行數:23,代碼來源:NitriteHelper.java

示例7: notifyRemoved

import javafx.scene.control.TreeItem; //導入依賴的package包/類
/**
 * Notify about removed a spatial.
 *
 * @param spatial the spatial.
 */
public void notifyRemoved(@NotNull final Spatial spatial) {
    spatial.depthFirstTraversal(child -> {

        final SceneLayer layer = SceneLayer.getLayer(child);
        if (layer == SceneLayer.NO_LAYER) return;

        final TreeItem<TreeNode<?>> newLayerItem = findItemForValue(getTreeView(), layer);
        final TreeItem<TreeNode<?>> treeItem = findItemForValue(getTreeView(), child);

        if (newLayerItem != null && treeItem != null) {
            newLayerItem.getChildren().remove(treeItem);
        }

    }, Spatial.DFSMode.POST_ORDER);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:21,代碼來源:LayerNodeTree.java

示例8: updateCompGeom

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public void updateCompGeom(Map<String, String> map) throws Exception {
	compGeomContainer.getChildren().clear();
	String groupName = "";
	TreeItem<DesignVariableGroup> group = null;
	for (String key : map.keySet()) {
		String[] names = key.split(":");
		if (names.length == 3) {
			if (!groupName.equals(names[1])) {
				groupName = names[1];
				group = new TreeItem<>(new DesignVariableGroup(groupName));
				compGeomContainer.getChildren().add(group);
			}	
			if (group != null) addDesignVariable(compGeomContainer, group, names[2], names[0], "0", "", true);
		}
	}
}
 
開發者ID:nasa,項目名稱:OpenVSP3Plugin,代碼行數:17,代碼來源:OpenVSP3File.java

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

示例10: notifyAdded

import javafx.scene.control.TreeItem; //導入依賴的package包/類
/**
 * Notify about added a spatial.
 *
 * @param spatial the spatial.
 */
public void notifyAdded(@NotNull final Spatial spatial) {
    spatial.depthFirstTraversal(child -> {

        final SceneLayer layer = SceneLayer.getLayer(child);
        if (layer == SceneLayer.NO_LAYER) return;

        final TreeItem<TreeNode<?>> newLayerItem = findItemForValue(getTreeView(), layer);
        final TreeItem<TreeNode<?>> treeItem = findItemForValue(getTreeView(), child);

        if (newLayerItem != null && treeItem == null) {
            final TreeNode<?> objectNode = FACTORY_REGISTRY.createFor(child);
            newLayerItem.getChildren().add(new TreeItem<>(objectNode));
        }

    }, Spatial.DFSMode.POST_ORDER);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:22,代碼來源:LayerNodeTree.java

示例11: CollatedTreeItem

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public CollatedTreeItem() {
    children = FXCollections.observableArrayList();
    filteredChildren = new FilteredList<>(children, new Predicate<TreeItem<T>>() {
        @Override public boolean test(TreeItem<T> t) {
            return filter.test(t.getValue());
        }
    });
    sortedChildren = new SortedList<>(filteredChildren);
    ObservableList<TreeItem<T>> original = super.getChildren();
    sortedChildren.addListener(new ListChangeListener<TreeItem<T>>() {
        @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<T>> c) {
            while (c.next()) {
                original.removeAll(c.getRemoved());
                original.addAll(c.getFrom(), c.getAddedSubList());
            }
        }
    });
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:CollatedTreeItem.java

示例12: setCollation

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public void setCollation() {
    if (comparator == null) {
        sortedChildren.setComparator(null);
    } else {
        sortedChildren.setComparator((o1, o2) -> comparator.compare(o1.getValue(), o2.getValue()));
    }
    if (filter == null) {
        filteredChildren.setPredicate(null);
    } else {
        filteredChildren.setPredicate(new Predicate<TreeItem<T>>() {
            @Override public boolean test(TreeItem<T> t) {
                return filter.test(t.getValue());
            }
        });
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:CollatedTreeItem.java

示例13: populateSectionsTree

import javafx.scene.control.TreeItem; //導入依賴的package包/類
/**
 * Fills sections treeview with passed in sectionsList
 *
 * @param sectionsList
 */
private void populateSectionsTree( Set<OptionSection> sectionsList )
{
	for ( OptionSection section : sectionsList )
	{
		//TODO this feels disgusting. Fix this
		if ( !section.getFullPath().contains(".") )
		{
			TreeItem<String> sectionItem = new TreeItem<>(section.getName());
			if ( section.size() > 0 )
				sectionItem.getChildren().addAll(getSectionChildren(section));

			sections.getRoot().getChildren().add(sectionItem);
		}
	}
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:21,代碼來源:OptionsSettingsTree.java

示例14: onNextFailure

import javafx.scene.control.TreeItem; //導入依賴的package包/類
public void onNextFailure() {
    if (testTree.getRoot() == null) {
        return;
    }
    TreeItem<Test> item = testTree.getSelectionModel().getSelectedItem();
    TestTreeItem nextFailure = null;
    if (item != null) {
        if (item.isLeaf()) {
            nextFailure = findNextFailureInSiblings((TestTreeItem) item);
        } else {
            nextFailure = findNextFailureInChildren((TestTreeItem) item, true);
        }
    } else {
        nextFailure = findNextFailureInChildren((TestTreeItem) testTree.getRoot(), false);
    }
    if (nextFailure == null) {
        return;
    }
    isExpandNeeded(nextFailure);
    int failureIndex = testTree.getRow(nextFailure);
    testTree.getSelectionModel().clearAndSelect(failureIndex);
    testTree.scrollTo(failureIndex);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:24,代碼來源:TestRunner.java

示例15: findNextFailureInChildren

import javafx.scene.control.TreeItem; //導入依賴的package包/類
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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:27,代碼來源:TestRunner.java


注:本文中的javafx.scene.control.TreeItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。