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;
}
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;
}
});
}
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);
}
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);
}
}
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);
}
Aggregations