use of CustomerGuiHelpers.CustomerProductCellFormat in project SmartCity-Market by TechnionYP5777.
the class CustomerMainScreen method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
AbstractApplicationScreen.fadeTransition(customerMainScreenPane);
barcodeEventHandler.register(this);
customer = TempCustomerPassingData.customer;
filteredProductList = new FilteredList<>(productsObservableList, s -> true);
searchField.textProperty().addListener(obs -> {
String filter = searchField.getText();
filteredProductList.setPredicate((filter == null || filter.length() == 0) ? s -> true : s -> s.getCatalogProduct().getName().contains(filter));
});
productsListView.setItems(filteredProductList);
productsListView.setCellFactory(new Callback<ListView<CartProduct>, ListCell<CartProduct>>() {
@Override
public ListCell<CartProduct> call(ListView<CartProduct> __) {
return new CustomerProductCellFormat();
}
});
productsListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CartProduct>() {
@Override
public void changed(ObservableValue<? extends CartProduct> __, CartProduct oldValue, CartProduct newValue) {
updateProductInfoPaine(newValue.getCatalogProduct(), newValue.getTotalAmount(), ProductInfoPaneVisibleMode.PRESSED_PRODUCT);
}
});
productsListView.depthProperty().set(1);
productsListView.setExpanded(true);
setAbilityAndVisibilityOfProductInfoPane(false);
}
Aggregations