JavaFX: dynamic logical binding in RowFactory

This question goes further, where JavaFX: BooleanBindings in connection with several EasyBind cards is stopped.

I would like to expand the factory row a bit further: in table 1, the products are presented with 1 part of the row, so there can be several rows for one product object. Now I only want to disable the row if the sum in table 2 is equal to the total number of rows. For example: A product (SKU: P1) has three rows in table 1 (all represent the sum of 1). If the product (SKU: P1) had value = -2 in table2, in table 1 it is necessary to disable 2 lines of this product object. So far, you need to activate, no matter which of the three.

I have the following code at the moment:

table1.setRowFactory(tv -> { TableRow<Product> row = new TableRow<>(); row.disableProperty().bind(Bindings.createBooleanBinding( () -> row.getItem() != null && (row.getItem().getSKU().startsWith("C") || (skuAmountLookup.containsKey(row.getItem().getSKU()) && -skuAmountLookup.get(row.getItem().getSKU()) < amounts[SKUs.indexOf(row.getItem().getSKU())] )), skuAmountLookup, row.itemProperty())); return row; }); 

where skuAmountLookup :

 skuAmountLookup = table2.getItems().stream().collect( Collectors.toMap(Product::getSKU, Product::getAmount, (x, y) -> y, () -> FXCollections.observableHashMap())); 

This only disables the rows, if the total is table 1. You can change amounts[SKUs.indexOf(row.getItem().getSKU())] to 0 , which will disable all rows when only one of the products is present.

My question is: how can I change the factory string so that disableProperty of another string is taken into account?

For more information, see JavaFX: BooleanBindings in conjunction with multiple EasyBind and JavaFX cards : disable multiple rows in a TableView based on another TableView .

+7
javafx javafx-8 tablerow
source share

No one has answered this question yet.

See similar questions:

one
JavaFX: disable multiple rows in a TableView based on another TableView
one
JavaFX: BooleanBindings combined with multiple EasyBind cards

or similar:

345
Google Maps and JavaFX: Displaying a marker on the map after clicking the JavaFX button
156
JavaFX Application Icon
14
how to bind inverse logical, javafx
5
JavaFX: how to disable row in TableView?
2
JavaFX logical binding based on selected items in TableView
one
JavaFX Text Label
one
Multiple logical binding in JavaFX
one
JavaFX: BooleanBindings combined with multiple EasyBind cards
0
How to bind TableCell style classes to TableRow style classes (JavaFX)
0
Progurad confuses table view in javafx

All Articles