use of javafx.scene.control.TreeItem in project certmgr by hdecarne.
the class UserCertStoreTreeTableViewHelper method updateHelper.
private void updateHelper(TreeItem<T> parent, Set<UserCertStoreEntry> entries) {
ObservableList<TreeItem<T>> items = parent.getChildren();
List<TreeItem<T>> itemsToRemove = new ArrayList<>(items.size());
Map<UserCertStoreEntry, TreeItem<T>> itemsToUpdate = new HashMap<>(items.size());
for (TreeItem<T> item : items) {
if (entries.contains(item.getValue().getEntry())) {
// entry does still exist -> remember for update
itemsToUpdate.put(item.getValue().getEntry(), item);
} else {
// entry no longer in store -> remember for remove
itemsToRemove.add(item);
}
}
items.removeAll(itemsToRemove);
for (UserCertStoreEntry entry : entries) {
TreeItem<T> entryItem = itemsToUpdate.get(entry);
if (entryItem == null) {
entryItem = new TreeItem<>(this.modelFactory.apply(entry));
entryItem.graphicProperty().bind(entryItem.getValue().graphicProperty());
items.add(entryItem);
} else {
entryItem.getValue().updateGraphic();
}
updateHelper(entryItem, entry.issuedEntries());
}
items.sort(this.comparator);
}
use of javafx.scene.control.TreeItem in project S4T1TM2 by CSUS-CSC-131-Spring2018.
the class TreeViewDemo method start.
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
final JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
treeView.setEditable(true);
// creating node and adding to department
for (Employee employee : employees) {
FilterableTreeItem<String> empLeaf = new FilterableTreeItem<>(employee.getName());
FilterableTreeItem<String> test = new FilterableTreeItem<>("Test");
empLeaf.getInternalChildren().add(test);
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())) {
((FilterableTreeItem) depNode).getInternalChildren().add(empLeaf);
found = true;
break;
}
}
if (!found) {
FilterableTreeItem<String> depNode = new FilterableTreeItem<>(employee.getDepartment());
rootNode.getInternalChildren().add(depNode);
depNode.getInternalChildren().add(empLeaf);
}
}
// initialize stage
stage.setTitle("Tree View Sample");
stage.setTitle("Agile Manager");
stage.setWidth(800);
stage.setHeight(600);
treeView.setPrefHeight(600);
treeView.setPrefWidth(200);
// creating pane
VBox box = new VBox();
box.setPrefWidth(200);
box.setPrefHeight(600);
final Scene scene = new Scene(box);
scene.setFill(Color.LIGHTGRAY);
// treeView.setShowRoot(false);
// create search functionality
TextField filterField = new JFXTextField();
filterField.setPromptText("Search...");
// define search predicate
rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
// predicate is reevaluated when filterfield is modified
if (filterField.getText() == null || filterField.getText().isEmpty())
return null;
return TreeItemPredicate.create(actor -> actor.toString().contains(filterField.getText()));
}, filterField.textProperty()));
// add to pane
box.getChildren().addAll(new JFXTreeViewPath(treeView), treeView, filterField);
VBox.setVgrow(treeView, Priority.ALWAYS);
// stage shit
stage.setScene(scene);
stage.show();
}
use of javafx.scene.control.TreeItem in project jphp by jphp-compiler.
the class UXTreeView method getExpandedItems.
@Getter
public Memory getExpandedItems(Environment env) {
TreeItem root = getWrappedObject().getRoot();
ArrayMemory result = new ArrayMemory();
if (root != null) {
_getExpandedItems(env, root, result);
}
return result;
}
use of javafx.scene.control.TreeItem in project JFoenix by jfoenixadmin.
the class TreeViewDemo method start.
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
final JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
for (Employee employee : employees) {
FilterableTreeItem<String> empLeaf = new FilterableTreeItem<>(employee.getName());
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())) {
((FilterableTreeItem) depNode).getInternalChildren().add(empLeaf);
found = true;
break;
}
}
if (!found) {
FilterableTreeItem<String> depNode = new FilterableTreeItem<>(employee.getDepartment());
rootNode.getInternalChildren().add(depNode);
depNode.getInternalChildren().add(empLeaf);
}
}
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
treeView.setShowRoot(false);
TextField filterField = new JFXTextField();
rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
if (filterField.getText() == null || filterField.getText().isEmpty())
return null;
return TreeItemPredicate.create(actor -> actor.toString().contains(filterField.getText()));
}, filterField.textProperty()));
box.getChildren().addAll(new JFXTreeViewPath(treeView), treeView, filterField);
VBox.setVgrow(treeView, Priority.ALWAYS);
stage.setScene(scene);
stage.show();
}
use of javafx.scene.control.TreeItem in project jgnash by ccavanaugh.
the class BudgetTableController method loadAccountTree.
private void loadAccountTree() {
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
final TreeItem<Account> root = new TreeItem<>(engine.getRootAccount());
root.setExpanded(true);
accountTreeView.setRoot(root);
loadChildren(root);
}
Aggregations