use of javafx.scene.control.TreeTableColumn.CellDataFeatures 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.TreeTableColumn.CellDataFeatures in project Smartcity-Smarthouse by TechnionYP5777.
the class MainSystemGuiController method setupFSTreeView.
private void setupFSTreeView(SystemCore model) {
TreeItem<String> rootElement = new TreeItem<>("File System View");
rootElement.setExpanded(true);
createTree(model.getFileSystem().getReadOnlyFileSystem(), rootElement);
TreeTableColumn<String, String> fsViewCol = new TreeTableColumn<>();
fsViewCol.prefWidthProperty().bind(fsTreeView.widthProperty());
fsViewCol.setCellValueFactory((CellDataFeatures<String, String> p) -> new ReadOnlyStringWrapper(p.getValue().getValue()));
fsTreeView.setRoot(rootElement);
fsTreeView.getColumns().add(fsViewCol);
mainSplitPane.getItems().add(fsTreeView);
mainSplitPane.getDividers().get(0).setPosition(0.7);
}
Aggregations