Search in sources :

Example 61 with TreeItem

use of javafx.scene.control.TreeItem in project jgnash by ccavanaugh.

the class BudgetTableController method loadChildren.

private synchronized void loadChildren(final TreeItem<Account> parentItem) {
    final Account parent = parentItem.getValue();
    parent.getChildren(Comparators.getAccountByCode()).stream().filter(budgetResultsModel::includeAccount).forEach(child -> {
        final TreeItem<Account> childItem = new TreeItem<>(child);
        childItem.setExpanded(true);
        parentItem.getChildren().add(childItem);
        if (child.getChildCount() > 0) {
            loadChildren(childItem);
        }
    });
}
Also used : Account(jgnash.engine.Account) TreeItem(javafx.scene.control.TreeItem)

Example 62 with TreeItem

use of javafx.scene.control.TreeItem in project jgnash by ccavanaugh.

the class AbstractAccountTreeController method loadAccountTree.

private void loadAccountTree() {
    final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
    if (engine != null) {
        final TreeItem<Account> root = new TreeItem<>(engine.getRootAccount());
        root.setExpanded(true);
        getTreeView().setRoot(root);
        loadChildren(root);
    } else {
        getTreeView().setRoot(null);
    }
}
Also used : Account(jgnash.engine.Account) TreeItem(javafx.scene.control.TreeItem) Engine(jgnash.engine.Engine)

Example 63 with TreeItem

use of javafx.scene.control.TreeItem in project jgnash by ccavanaugh.

the class AbstractAccountTreeController method loadChildren.

private synchronized void loadChildren(final TreeItem<Account> parentItem) {
    final Account parent = parentItem.getValue();
    parent.getChildren(Comparators.getAccountByCode()).stream().filter(child -> !filteredAccounts.contains(child) && isAccountVisible(child)).forEach(child -> {
        final TreeItem<Account> childItem = new TreeItem<>(child);
        childItem.setExpanded(true);
        parentItem.getChildren().add(childItem);
        if (child.getChildCount() > 0) {
            loadChildren(childItem);
        }
    });
}
Also used : Engine(jgnash.engine.Engine) ObservableSet(javafx.collections.ObservableSet) ReadOnlyObjectProperty(javafx.beans.property.ReadOnlyObjectProperty) Comparators(jgnash.engine.Comparators) TreeItem(javafx.scene.control.TreeItem) EngineFactory(jgnash.engine.EngineFactory) SetChangeListener(javafx.collections.SetChangeListener) FXCollections(javafx.collections.FXCollections) MessageBus(jgnash.engine.message.MessageBus) TreeSet(java.util.TreeSet) TreeView(javafx.scene.control.TreeView) JavaFXUtils(jgnash.uifx.util.JavaFXUtils) Objects(java.util.Objects) Nullable(jgnash.util.Nullable) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) MessageChannel(jgnash.engine.message.MessageChannel) Account(jgnash.engine.Account) Message(jgnash.engine.message.Message) MessageListener(jgnash.engine.message.MessageListener) TreeSearch(jgnash.uifx.util.TreeSearch) Account(jgnash.engine.Account) TreeItem(javafx.scene.control.TreeItem)

Example 64 with TreeItem

use of javafx.scene.control.TreeItem in project pmd by pmd.

the class NodeInfoPanelController method initialize.

@Override
public void initialize(URL location, ResourceBundle resources) {
    EventStreams.valuesOf(scopeHierarchyTreeView.getSelectionModel().selectedItemProperty()).filter(Objects::nonNull).map(TreeItem::getValue).filterMap(o -> o instanceof NameDeclaration, o -> (NameDeclaration) o).subscribe(parent::onNameDeclarationSelected);
    scopeHierarchyTreeView.setCellFactory(view -> new ScopeHierarchyTreeCell(parent));
}
Also used : NameDeclaration(net.sourceforge.pmd.lang.symboltable.NameDeclaration) Initializable(javafx.fxml.Initializable) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) ScopeHierarchyTreeCell(net.sourceforge.pmd.util.fxdesigner.util.controls.ScopeHierarchyTreeCell) URL(java.net.URL) TreeItem(javafx.scene.control.TreeItem) TypeNode(net.sourceforge.pmd.lang.java.ast.TypeNode) FXCollections(javafx.collections.FXCollections) Node(net.sourceforge.pmd.lang.ast.Node) TreeView(javafx.scene.control.TreeView) Objects(java.util.Objects) MetricEvaluator(net.sourceforge.pmd.util.fxdesigner.model.MetricEvaluator) FXML(javafx.fxml.FXML) TabPane(javafx.scene.control.TabPane) ResourceBundle(java.util.ResourceBundle) AttributeAxisIterator(net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator) Tab(javafx.scene.control.Tab) ScopeHierarchyTreeItem(net.sourceforge.pmd.util.fxdesigner.util.controls.ScopeHierarchyTreeItem) EventStreams(org.reactfx.EventStreams) Attribute(net.sourceforge.pmd.lang.ast.xpath.Attribute) ObservableList(javafx.collections.ObservableList) Collections(java.util.Collections) MetricResult(net.sourceforge.pmd.util.fxdesigner.model.MetricResult) TreeItem(javafx.scene.control.TreeItem) ScopeHierarchyTreeItem(net.sourceforge.pmd.util.fxdesigner.util.controls.ScopeHierarchyTreeItem) ScopeHierarchyTreeCell(net.sourceforge.pmd.util.fxdesigner.util.controls.ScopeHierarchyTreeCell) NameDeclaration(net.sourceforge.pmd.lang.symboltable.NameDeclaration)

Example 65 with TreeItem

use of javafx.scene.control.TreeItem in project pmd by pmd.

the class SourceEditorController method focusNodeInTreeView.

public void focusNodeInTreeView(Node node) {
    ASTTreeItem found = ((ASTTreeItem) astTreeView.getRoot()).findItem(node);
    if (found != null) {
        SelectionModel<TreeItem<Node>> selectionModel = astTreeView.getSelectionModel();
        selectionModel.select(found);
        astTreeView.getFocusModel().focus(selectionModel.getSelectedIndex());
    // astTreeView.scrollTo(selectionModel.getSelectedIndex());
    }
}
Also used : TreeItem(javafx.scene.control.TreeItem) ASTTreeItem(net.sourceforge.pmd.util.fxdesigner.util.controls.ASTTreeItem) ASTTreeItem(net.sourceforge.pmd.util.fxdesigner.util.controls.ASTTreeItem)

Aggregations

TreeItem (javafx.scene.control.TreeItem)76 File (java.io.File)15 TreeView (javafx.scene.control.TreeView)11 ArrayList (java.util.ArrayList)10 List (java.util.List)10 ObjectProperty (javafx.beans.property.ObjectProperty)9 MenuItem (javafx.scene.control.MenuItem)9 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)8 Logger (org.slf4j.Logger)8 LoggerFactory (org.slf4j.LoggerFactory)8 IOException (java.io.IOException)7 Optional (java.util.Optional)7 FXCollections (javafx.collections.FXCollections)7 ListChangeListener (javafx.collections.ListChangeListener)7 ObservableList (javafx.collections.ObservableList)7 ActionEvent (javafx.event.ActionEvent)7 ContextMenu (javafx.scene.control.ContextMenu)7 Stage (javafx.stage.Stage)7 FXML (javafx.fxml.FXML)6 Button (javafx.scene.control.Button)6