Search in sources :

Example 26 with TreeItem

use of javafx.scene.control.TreeItem in project dwoss by gg-net.

the class TreeTableController method getUnitCollections.

private ObservableList<TreeItem<DataWrapper>> getUnitCollections(Product product) {
    ObservableList<TreeItem<DataWrapper>> result = FXCollections.observableArrayList();
    for (UnitCollection uc : loadUnitCollections(product)) {
        TreeItem<DataWrapper> item = new TreeItem<>();
        UnitCollectionWrapper unitCollectionWrapper = new UnitCollectionWrapper(item, uc);
        item.setValue(unitCollectionWrapper);
        result.add(item);
    }
    return result;
}
Also used : UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) TreeItem(javafx.scene.control.TreeItem)

Example 27 with TreeItem

use of javafx.scene.control.TreeItem in project dwoss by gg-net.

the class TreeTableController method initialize.

/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    TreeItem<DataWrapper> root = new TreeItem<>(new DataWrapper() {

        @Override
        public String getName() {
            return "Root";
        }
    });
    view.setRoot(root);
    root.setExpanded(true);
    view.setShowRoot(false);
    root.getChildren().addAll(getTradeNames());
    overview.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<DataWrapper, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<DataWrapper, String> param) {
            return new ReadOnlyStringWrapper(param.getValue().getValue().getName());
        }
    });
    amount.setCellValueFactory(new Callback<CellDataFeatures<DataWrapper, Integer>, ObservableValue<Integer>>() {

        @Override
        public ObservableValue<Integer> call(CellDataFeatures<DataWrapper, Integer> param) {
            DataWrapper dw = param.getValue().getValue();
            SimpleObjectProperty<Integer> result;
            if (dw instanceof ProductGroupWrapper) {
                result = new SimpleObjectProperty<>(amountOfCategoryProducts(((ProductGroupWrapper) dw).getTradeName(), ((ProductGroupWrapper) dw).getProductGroup()));
                return result;
            }
            if (dw instanceof CategoryProductWrapper) {
                result = new SimpleObjectProperty<>(amountOfProducts(((CategoryProductWrapper) dw).getCategoryProductId()));
                return result;
            }
            if (dw instanceof ProductWrapper) {
                result = new SimpleObjectProperty<>(amountOfUnitCollections(((ProductWrapper) dw).getProductId()));
                return result;
            }
            if (dw instanceof UnitCollectionWrapper) {
                result = new SimpleObjectProperty<>(amountOfUnits(((UnitCollectionWrapper) dw).getUnitCollectionId()));
                return result;
            }
            result = new SimpleObjectProperty<>(0);
            return result;
        }
    });
}
Also used : CellDataFeatures(javafx.scene.control.TreeTableColumn.CellDataFeatures) TreeItem(javafx.scene.control.TreeItem) ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) ObservableValue(javafx.beans.value.ObservableValue) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty)

Example 28 with TreeItem

use of javafx.scene.control.TreeItem in project trex-stateless-gui by cisco-system-traffic-generator.

the class ConfigTreeView method rebuildFromValueData.

public void rebuildFromValueData() {
    this.setRoot(new TreeItem(this.title));
    for (ConfigNode configNode : this.userConfigModel.getValueFields()) {
        TreeItem newItem = new ConfigTreeItem(configNode, configUpdateCallback);
        this.getRoot().getChildren().add(newItem);
    }
    this.getRoot().setExpanded(true);
}
Also used : TreeItem(javafx.scene.control.TreeItem)

Example 29 with TreeItem

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

the class AccountsViewController method loadAccountTree.

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

Example 30 with TreeItem

use of javafx.scene.control.TreeItem in project Smartcity-Smarthouse by TechnionYP5777.

the class MainSystemGuiController method createTree.

private void createTree(ReadOnlyFileNode currNode, TreeItem<String> currTreeNode) {
    TreeItem<String> newTreeNode = new TreeItem<>(currNode.getName());
    if (currNode.isLeaf())
        return;
    for (ReadOnlyFileNode child : currNode.getChildren()) createTree(child, newTreeNode);
    newTreeNode.setExpanded(true);
    currTreeNode.getChildren().add(newTreeNode);
}
Also used : TreeItem(javafx.scene.control.TreeItem) ReadOnlyFileNode(il.ac.technion.cs.smarthouse.system.file_system.FileSystem.ReadOnlyFileNode)

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 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)7 IOException (java.io.IOException)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 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)6 FXML (javafx.fxml.FXML)6 Button (javafx.scene.control.Button)6