本文整理了Java中javafx.scene.control.TreeView.setRoot()
方法的一些代码示例,展示了TreeView.setRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeView.setRoot()
方法的具体详情如下:
包路径:javafx.scene.control.TreeView
类名称:TreeView
方法名:setRoot
暂无
代码示例来源:origin: speedment/speedment
private void populateTree(ProjectProperty project) {
requireNonNull(project);
final TreeItem<DocumentProperty> root = branch(project);
hierarchy.setRoot(root);
hierarchy.getSelectionModel().select(root);
}
代码示例来源:origin: pmd/pmd
/**
* Refreshes the AST and returns the new compilation unit if the parse didn't fail.
*/
public Optional<Node> refreshAST() {
String source = getText();
if (StringUtils.isBlank(source)) {
astTreeView.setRoot(null);
return Optional.empty();
}
Optional<Node> current;
try {
current = astManager.updateIfChanged(source, auxclasspathClassLoader.getValue());
} catch (ParseAbortedException e) {
astViewTitledPane.setTitle("Abstract syntax tree (error)");
return Optional.empty();
}
current.ifPresent(this::setUpToDateCompilationUnit);
return current;
}
代码示例来源:origin: pmd/pmd
private void setUpToDateCompilationUnit(Node node) {
parent.invalidateAst();
astViewTitledPane.setTitle("Abstract syntax tree");
ASTTreeItem root = ASTTreeItem.getRoot(node);
astTreeView.setRoot(root);
}
代码示例来源:origin: pmd/pmd
/**
* Invalidates the info being displayed.
*/
private void invalidateInfo() {
metricResultsListView.setItems(FXCollections.emptyObservableList());
xpathAttributesListView.setItems(FXCollections.emptyObservableList());
scopeHierarchyTreeView.setRoot(null);
}
代码示例来源:origin: pmd/pmd
private void displayScopes(Node node, boolean focusScopeView) {
// current selection
TreeItem<Object> previousSelection = scopeHierarchyTreeView.getSelectionModel().getSelectedItem();
ScopeHierarchyTreeItem rootScope = ScopeHierarchyTreeItem.buildAscendantHierarchy(node);
scopeHierarchyTreeView.setRoot(rootScope);
if (focusScopeView && previousSelection != null) {
// Try to find the node that was previously selected and focus it in the new ascendant hierarchy.
// Otherwise, when you select a node in the scope tree, since focus of the app is shifted to that
// node, the scope hierarchy is reset and you lose the selection - even though obviously the node
// you selected is in its own scope hierarchy so it looks buggy.
int maxDepth = DesignerIteratorUtil.count(DesignerIteratorUtil.parentIterator(previousSelection, true));
rootScope.tryFindNode(previousSelection.getValue(), maxDepth)
.ifPresent(scopeHierarchyTreeView.getSelectionModel()::select);
}
}
代码示例来源:origin: speedment/speedment
@Override
public void initialize(URL location, ResourceBundle resources) {
title.setTextFill(Color.web("#45a6fc")); // TODO Use styleClass instead
header.setText("Component Explorer");
final RootItem root = new RootItem(speedment);
root.getChildren().addAll(components());
tree.setRoot(root);
close.setOnAction(newCloseHandler());
}
代码示例来源:origin: pmd/pmd
@Override
protected void beforeParentInit() {
treeViewWrapper = new TreeViewWrapper<>(astTreeView);
astTreeView.setCellFactory(treeView -> new ASTTreeCell(parent));
initializeLanguageSelector(); // languageVersionProperty() must be initialized
languageVersionProperty().values()
.filterMap(Objects::nonNull, LanguageVersion::getLanguage)
.distinct()
.subscribe(this::updateSyntaxHighlighter);
languageVersionProperty().values()
.filter(Objects::nonNull)
.map(LanguageVersion::getShortName)
.map(lang -> "Source Code (" + lang + ")")
.subscribe(editorTitledPane::setTitle);
EventStreams.valuesOf(astTreeView.getSelectionModel().selectedItemProperty())
.filterMap(Objects::nonNull, TreeItem::getValue)
.subscribe(parent::onNodeItemSelected);
codeEditorArea.plainTextChanges()
.filter(t -> !t.isIdentity())
.successionEnds(AST_REFRESH_DELAY)
// Refresh the AST anytime the text, classloader, or language version changes
.or(auxclasspathClassLoader.changes())
.or(languageVersionProperty().changes())
.subscribe(tick -> {
// Discard the AST if the language version has changed
tick.ifRight(c -> astTreeView.setRoot(null));
Platform.runLater(parent::refreshAST);
});
codeEditorArea.setParagraphGraphicFactory(lineNumberFactory());
}
代码示例来源:origin: eu.agrosense.spi/session
@Override
public void initialize(URL url, ResourceBundle rb) {
session.setRoot(new TreeItem<String>("Session") {
private boolean isFirstTimeChildren = true;
@Override
public ObservableList getChildren() {
if (isFirstTimeChildren) {
isFirstTimeChildren = false;
// First getChildren() call, so we actually go off and
// determine the children of the File contained in this TreeItem.
super.getChildren().setAll(buildChildren(this));
}
return super.getChildren();
}
@Override
public boolean isLeaf() {
return false;
}
private ObservableList<TreeItem<String>> buildChildren(TreeItem<String> treeItem) {
ObservableList<TreeItem<String>> children = FXCollections.observableArrayList();
children.add(new TreeItem<>(Connections.get().getURL().getHost()));
return children;
}
});
}
代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer
private void refreshSubstationDetailView(IdAndName substationIdAndName) {
if (substationIdAndName != null && substationIdAndName != LIST_BUSY) {
substationDetailedView.setRoot(new TreeItem<>(TREEVIEW_BUSY));
String query = processTemplate(voltageLevelTemplate, ImmutableMap.of("substationId", substationIdAndName.getId()));
queryNetwork(query, voltageLevelQueryResultListType,
(List<VoltageLevelQueryResult> voltageLevelQueryResults) -> fillSubstationDetailViewWithQueryResults(substationIdAndName, voltageLevelQueryResults),
substationDetailsExecutor);
} else {
substationDetailedView.setRoot(null);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
private void rebuildTable(Observable o) {
if (getSkinnable().getRootDirectories() == null) {
this.tree.setRoot(new TreeItem<>());
} else {
TreeItem<@NonNull ResourceItem> root = new TreeItem<>();
root.getChildren().setAll(
getSkinnable().getRootDirectories().stream()
.map((d) -> new DirTreeItem(d))
.collect(Collectors.toList()));
this.tree.setRoot(root);
}
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
private void rebuildTable(Observable o) {
if (getSkinnable().getRootDirectories() == null) {
this.tree.setRoot(new TreeItem<>());
} else {
TreeItem<@NonNull DirItem> root = new TreeItem<>();
root.getChildren().setAll(
getSkinnable().getRootDirectories().stream()
.map((d) -> new DirTreeItem(d))
.collect(Collectors.toList()));
this.tree.setRoot(root);
}
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
private void rebuildTable(Observable o) {
if (getSkinnable().getRootDirectories() == null) {
this.tree.setRoot(new TreeItem<>());
} else {
TreeItem<@NonNull ResourceItem> root = new TreeItem<>();
root.getChildren().setAll(
getSkinnable().getRootDirectories().stream()
.map((d) -> new DirTreeItem(d))
.collect(Collectors.toList()));
this.tree.setRoot(root);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
private void rebuildTable(Observable o) {
if (getSkinnable().getRootDirectories() == null) {
this.tree.setRoot(new TreeItem<>());
} else {
TreeItem<@NonNull DirItem> root = new TreeItem<>();
root.getChildren().setAll(
getSkinnable().getRootDirectories().stream()
.map((d) -> new DirTreeItem(d))
.collect(Collectors.toList()));
this.tree.setRoot(root);
}
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
treeView.setRoot(new TreeItem<DisplayableNode>(null));
treeView.setShowRoot(false);
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<DisplayableNode>>() {
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.code.editor.fx
view.setRoot(root);
treeCache.put(outline, view);
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.code.editor.fx
view.setRoot(root);
treeCache.put(outline, view);
代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer
private void fillSubstationDetailViewWithQueryResults(IdAndName substationIdAndName, List<VoltageLevelQueryResult> voltageLevelQueryResults) {
equipmentTabs.getTabs().clear();
if (voltageLevelQueryResults != null) {
TreeItem<EquipmentInfo> substationItem = new TreeItem<>(new EquipmentInfo(substationIdAndName, "SUBSTATION"));
substationItem.setExpanded(true);
for (VoltageLevelQueryResult voltageLevelQueryResult : voltageLevelQueryResults) {
TreeItem<EquipmentInfo> voltageLevelItem = new TreeItem<>(new EquipmentInfo(voltageLevelQueryResult.getIdAndName(), "VOLTAGE_LEVEL"));
substationItem.getChildren().add(voltageLevelItem);
for (EquipmentInfo equipment : voltageLevelQueryResult.getEquipments()) {
Node icon = getSymbol(equipment.getType());
TreeItem<EquipmentInfo> equipmentItem = new TreeItem<>(equipment, icon);
voltageLevelItem.getChildren().add(equipmentItem);
}
voltageLevelItem.setExpanded(true);
}
substationDetailedView.setRoot(substationItem);
} else {
substationDetailedView.setRoot(null);
}
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
public void refresh(List<WorkflowVersion> newItems) {
treeView.setShowRoot(false);
TreeItem<DisplayWorkflowClassesModel> rootItem = new TreeItem<DisplayWorkflowClassesModel>();
rootItem.getChildren().addAll(groupToTreeItem(newItems));
treeView.setRoot(rootItem);
treeView.setCellFactory(new Callback<TreeView<DisplayWorkflowClassesModel>, TreeCell<DisplayWorkflowClassesModel>>() {
@Override
public TreeCell<DisplayWorkflowClassesModel> call(TreeView<DisplayWorkflowClassesModel> listView) {
return new TextFieldTreeCell<DisplayWorkflowClassesModel>(new StringConverter<DisplayWorkflowClassesModel>() {
@Override
public DisplayWorkflowClassesModel fromString(String string) {
return null;
}
@Override
public String toString(DisplayWorkflowClassesModel object) {
return object.displayName;
}
});
}
});
rootItem.setExpanded(true);
}
代码示例来源:origin: com.aquafx-project/aquafx
treeView.setRoot(root);
treeView1.setRoot(root1);
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
treeView.setRoot(dummyRoot);
treeView.setShowRoot(false);
内容来源于网络,如有侵权,请联系作者删除!