Search in sources :

Example 1 with CustomerProductCellFormat

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);
}
Also used : Button(javafx.scene.control.Button) TempCustomerPassingData(CustomerGuiHelpers.TempCustomerPassingData) Initializable(javafx.fxml.Initializable) ListView(javafx.scene.control.ListView) URL(java.net.URL) ListCell(javafx.scene.control.ListCell) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) IConfiramtionDialog(UtilsContracts.IConfiramtionDialog) ICustomer(CustomerContracts.ICustomer) Logger(org.apache.log4j.Logger) CatalogProduct(BasicCommonClasses.CatalogProduct) ResourceBundle(java.util.ResourceBundle) BarcodeEventHandler(UtilsImplementations.BarcodeEventHandler) Subscribe(com.google.common.eventbus.Subscribe) Callback(javafx.util.Callback) CustomerProductCellFormat(CustomerGuiHelpers.CustomerProductCellFormat) GridPane(javafx.scene.layout.GridPane) CartProduct(BasicCommonClasses.CartProduct) Label(javafx.scene.control.Label) MalformedURLException(java.net.MalformedURLException) SmartCode(BasicCommonClasses.SmartCode) StackTraceUtil(UtilsImplementations.StackTraceUtil) JFXListView(com.jfoenix.controls.JFXListView) FilteredList(javafx.collections.transformation.FilteredList) SMException(SMExceptions.SMException) DialogMessagesService(GuiUtils.DialogMessagesService) File(java.io.File) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) InjectionFactory(UtilsImplementations.InjectionFactory) ActionEvent(javafx.event.ActionEvent) IBarcodeEventHandler(UtilsContracts.IBarcodeEventHandler) Stage(javafx.stage.Stage) ImageView(javafx.scene.image.ImageView) LocalDate(java.time.LocalDate) SmartcodeScanEvent(UtilsContracts.SmartcodeScanEvent) ObservableValue(javafx.beans.value.ObservableValue) ObservableList(javafx.collections.ObservableList) AbstractApplicationScreen(GuiUtils.AbstractApplicationScreen) ChangeListener(javafx.beans.value.ChangeListener) Image(javafx.scene.image.Image) JFXTextField(com.jfoenix.controls.JFXTextField) ListView(javafx.scene.control.ListView) JFXListView(com.jfoenix.controls.JFXListView) ListCell(javafx.scene.control.ListCell) CartProduct(BasicCommonClasses.CartProduct) CustomerProductCellFormat(CustomerGuiHelpers.CustomerProductCellFormat)

Aggregations

CartProduct (BasicCommonClasses.CartProduct)1 CatalogProduct (BasicCommonClasses.CatalogProduct)1 SmartCode (BasicCommonClasses.SmartCode)1 ICustomer (CustomerContracts.ICustomer)1 CustomerProductCellFormat (CustomerGuiHelpers.CustomerProductCellFormat)1 TempCustomerPassingData (CustomerGuiHelpers.TempCustomerPassingData)1 AbstractApplicationScreen (GuiUtils.AbstractApplicationScreen)1 DialogMessagesService (GuiUtils.DialogMessagesService)1 SMException (SMExceptions.SMException)1 IBarcodeEventHandler (UtilsContracts.IBarcodeEventHandler)1 IConfiramtionDialog (UtilsContracts.IConfiramtionDialog)1 SmartcodeScanEvent (UtilsContracts.SmartcodeScanEvent)1 BarcodeEventHandler (UtilsImplementations.BarcodeEventHandler)1 InjectionFactory (UtilsImplementations.InjectionFactory)1 StackTraceUtil (UtilsImplementations.StackTraceUtil)1 Subscribe (com.google.common.eventbus.Subscribe)1 JFXListView (com.jfoenix.controls.JFXListView)1 JFXTextField (com.jfoenix.controls.JFXTextField)1 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1