use of com.jfoenix.controls.JFXTreeViewPath in project S4T1TM2 by CSUS-CSC-131-Spring2018.
the class YaamDemo method constructPathbar.
private void constructPathbar() {
StackPane pathBarContainer = new StackPane();
content.getChildren().addAll(pathBarContainer);
pathBarContainer.setId("pathBar");
pathBarContainer.setAlignment(Pos.CENTER);
pathBarContainer.layoutXProperty().bind(brandName.widthProperty());
pathBarContainer.layoutYProperty().bind(brandName.heightProperty().divide(2));
pathBarContainer.prefWidthProperty().bind(content.widthProperty().subtract(brandName.widthProperty()));
pathBarContainer.prefHeightProperty().bind(brandName.heightProperty().divide(2));
pathTree = new TreeView<>();
pathBar = new JFXTreeViewPath(pathTree);
pathTree.setRoot(new TreeItem<>("Home"));
pathTree.getSelectionModel().select(pathTree.getRoot());
pathBarContainer.getChildren().add(pathBar);
}
use of com.jfoenix.controls.JFXTreeViewPath 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 com.jfoenix.controls.JFXTreeViewPath 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();
}
Aggregations