Search in sources :

Example 1 with JFXPopup

use of com.jfoenix.controls.JFXPopup in project SmartCity-Market by TechnionYP5777.

the class ManageCatalogProductDetailsTab method initialize.

@Override
public void initialize(URL location, ResourceBundle __) {
    createManufacturerList();
    createIngredientList();
    filterManu.textProperty().addListener(obs -> {
        String filter = filterManu.getText();
        filteredDataManu.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
    });
    manufacturerList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {

        @Override
        public ObservableValue<Boolean> call(String item) {
            BooleanProperty observable = new SimpleBooleanProperty();
            observable.set(selectedManu.contains(item));
            observable.addListener((obs, wasSelected, isNowSelected) -> {
                if (isNowSelected)
                    selectedManu.add(item);
                else
                    selectedManu.remove(item);
                enableButtons();
            });
            return observable;
        }
    }));
    filterIngr.textProperty().addListener(obs -> {
        String filter = filterIngr.getText();
        filteredDataIngr.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
    });
    ingredientsList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {

        @Override
        public ObservableValue<Boolean> call(String item) {
            BooleanProperty observable = new SimpleBooleanProperty();
            observable.set(selectedIngr.contains(item));
            observable.addListener((obs, wasSelected, isNowSelected) -> {
                if (isNowSelected)
                    selectedIngr.add(item);
                else
                    selectedIngr.remove(item);
                enableButtons();
            });
            return observable;
        }
    }));
    Label lbl1 = new Label("Insert New Manufacturar");
    newManu = new JFXTextField();
    okNewManu = new JFXButton("Done!");
    okNewManu.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            addManuPressed();
        }
    });
    VBox manuContainer = new VBox();
    manuContainer.getChildren().addAll(lbl1, newManu, okNewManu);
    manuContainer.setPadding(new Insets(10, 50, 50, 50));
    manuContainer.setSpacing(10);
    JFXPopup popup1 = new JFXPopup(manuContainer);
    addManuBtn.setOnMouseClicked(e -> popup1.show(addManuBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
    newManu.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
    Label lbl2 = new Label("Insert New Ingredient");
    newIngr = new JFXTextField();
    okNewIngr = new JFXButton("Done!");
    okNewIngr.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            addIngPressed();
        }
    });
    VBox ingrContainer = new VBox();
    ingrContainer.getChildren().addAll(lbl2, newIngr, okNewIngr);
    ingrContainer.setPadding(new Insets(10, 50, 50, 50));
    ingrContainer.setSpacing(10);
    JFXPopup popup2 = new JFXPopup(ingrContainer);
    addIngrBtn.setOnMouseClicked(e -> popup2.show(addIngrBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
    newIngr.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
    Label lbl3 = new Label("Rename Selected Manufacturar");
    renameManuLbl = new JFXTextField();
    okRenameManu = new JFXButton("Done!");
    okRenameManu.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            renameManuPressed();
        }
    });
    VBox renameManuContainer = new VBox();
    renameManuContainer.getChildren().addAll(lbl3, renameManuLbl, okRenameManu);
    renameManuContainer.setPadding(new Insets(10, 50, 50, 50));
    renameManuContainer.setSpacing(10);
    JFXPopup popup3 = new JFXPopup(renameManuContainer);
    renameManu.setOnMouseClicked(e -> popup3.show(renameManu, PopupVPosition.TOP, PopupHPosition.LEFT));
    renameManuLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
    Label lbl4 = new Label("Rename Selected Ingredient");
    renameIngrLbl = new JFXTextField();
    okRenameIngr = new JFXButton("Done!");
    okRenameIngr.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent __) {
            renameIngrPressed();
        }
    });
    VBox renameIngrContainer = new VBox();
    renameIngrContainer.getChildren().addAll(lbl4, renameIngrLbl, okRenameIngr);
    renameIngrContainer.setPadding(new Insets(10, 50, 50, 50));
    renameIngrContainer.setSpacing(10);
    JFXPopup popup4 = new JFXPopup(renameIngrContainer);
    renameIngr.setOnMouseClicked(e -> popup4.show(renameIngr, PopupVPosition.TOP, PopupHPosition.LEFT));
    renameIngrLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
    enableButtons();
    enableAddButtons();
}
Also used : EventHandler(javafx.event.EventHandler) JFXButton(com.jfoenix.controls.JFXButton) Initializable(javafx.fxml.Initializable) URL(java.net.URL) CheckBoxListCell(javafx.scene.control.cell.CheckBoxListCell) PopupVPosition(com.jfoenix.controls.JFXPopup.PopupVPosition) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) Manufacturer(BasicCommonClasses.Manufacturer) VBox(javafx.scene.layout.VBox) JFXPopup(com.jfoenix.controls.JFXPopup) EmployeeNotConnected(EmployeeDefs.AEmployeeException.EmployeeNotConnected) HashSet(java.util.HashSet) ParamIDAlreadyExists(EmployeeDefs.AEmployeeException.ParamIDAlreadyExists) Logger(org.apache.log4j.Logger) Insets(javafx.geometry.Insets) ResourceBundle(java.util.ResourceBundle) ManfacturerStillInUse(EmployeeDefs.AEmployeeException.ManfacturerStillInUse) ConnectionFailure(EmployeeDefs.AEmployeeException.ConnectionFailure) ParamIDDoesNotExist(EmployeeDefs.AEmployeeException.ParamIDDoesNotExist) Callback(javafx.util.Callback) CriticalError(SMExceptions.CommonExceptions.CriticalError) Label(javafx.scene.control.Label) StackTraceUtil(UtilsImplementations.StackTraceUtil) JFXListView(com.jfoenix.controls.JFXListView) FilteredList(javafx.collections.transformation.FilteredList) Manager(EmployeeImplementations.Manager) IngredientStillInUse(EmployeeDefs.AEmployeeException.IngredientStillInUse) FXML(javafx.fxml.FXML) InjectionFactory(UtilsImplementations.InjectionFactory) BooleanProperty(javafx.beans.property.BooleanProperty) ActionEvent(javafx.event.ActionEvent) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) PopupHPosition(com.jfoenix.controls.JFXPopup.PopupHPosition) IManager(EmployeeContracts.IManager) ObservableValue(javafx.beans.value.ObservableValue) ObservableList(javafx.collections.ObservableList) Ingredient(BasicCommonClasses.Ingredient) JFXTextField(com.jfoenix.controls.JFXTextField) InvalidParameter(EmployeeDefs.AEmployeeException.InvalidParameter) JFXPopup(com.jfoenix.controls.JFXPopup) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Insets(javafx.geometry.Insets) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) ActionEvent(javafx.event.ActionEvent) JFXTextField(com.jfoenix.controls.JFXTextField) Label(javafx.scene.control.Label) JFXButton(com.jfoenix.controls.JFXButton) Callback(javafx.util.Callback) VBox(javafx.scene.layout.VBox)

Example 2 with JFXPopup

use of com.jfoenix.controls.JFXPopup in project JFoenix by jfoenixadmin.

the class PopupController method init.

@PostConstruct
public void init() throws FlowException, VetoException {
    try {
        popup = new JFXPopup(FXMLLoader.load(getClass().getResource("/resources/fxml/ui/popup/DemoPopup.fxml")));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    burger1.setOnMouseClicked((e) -> {
        popup.show(rippler1, PopupVPosition.TOP, PopupHPosition.LEFT);
    });
    burger2.setOnMouseClicked((e) -> {
        popup.show(rippler2, PopupVPosition.TOP, PopupHPosition.RIGHT);
    });
    burger3.setOnMouseClicked((e) -> {
        popup.show(rippler3, PopupVPosition.BOTTOM, PopupHPosition.LEFT);
    });
    burger4.setOnMouseClicked((e) -> {
        popup.show(rippler4, PopupVPosition.BOTTOM, PopupHPosition.RIGHT);
    });
}
Also used : JFXPopup(com.jfoenix.controls.JFXPopup) IOException(java.io.IOException) PostConstruct(javax.annotation.PostConstruct)

Example 3 with JFXPopup

use of com.jfoenix.controls.JFXPopup in project JFoenix by jfoenixadmin.

the class PopupDemo method start.

@Override
public void start(Stage primaryStage) throws Exception {
    JFXHamburger show = new JFXHamburger();
    show.setPadding(new Insets(10, 5, 10, 5));
    JFXRippler r = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK);
    JFXListView<Label> list = new JFXListView<Label>();
    for (int i = 1; i < 5; i++) list.getItems().add(new Label("Item " + i));
    AnchorPane container = new AnchorPane();
    container.getChildren().add(r);
    AnchorPane.setLeftAnchor(r, 200.0);
    AnchorPane.setTopAnchor(r, 210.0);
    StackPane main = new StackPane();
    main.getChildren().add(container);
    JFXPopup popup = new JFXPopup(list);
    r.setOnMouseClicked((e) -> popup.show(r, PopupVPosition.TOP, PopupHPosition.LEFT));
    final Scene scene = new Scene(main, 800, 800);
    scene.getStylesheets().add(PopupDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    primaryStage.setTitle("JFX Popup Demo");
    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
}
Also used : JFXPopup(com.jfoenix.controls.JFXPopup) Insets(javafx.geometry.Insets) JFXRippler(com.jfoenix.controls.JFXRippler) JFXHamburger(com.jfoenix.controls.JFXHamburger) JFXListView(com.jfoenix.controls.JFXListView) Label(javafx.scene.control.Label) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane) StackPane(javafx.scene.layout.StackPane)

Example 4 with JFXPopup

use of com.jfoenix.controls.JFXPopup in project SmartCity-Market by TechnionYP5777.

the class ManagePackagesTab method initialize.

@Override
public void initialize(URL location, ResourceBundle __) {
    barcodeEventHandler.register(this);
    barcodeTextField.textProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*"))
            barcodeTextField.setText(newValue.replaceAll("[^\\d]", ""));
        showScanCodePane(true);
        resetParams();
        searchCodeButton.setDisable(newValue.isEmpty());
    });
    editPackagesAmountSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
    editPackagesAmountSpinner.valueProperty().addListener((obs, oldValue, newValue) -> {
        if (newValue == null || newValue < 1)
            editPackagesAmountSpinner.getValueFactory().setValue(oldValue);
        enableRunTheOperationButton();
    });
    editPackagesAmountSpinner.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null && !newValue) {
            editPackagesAmountSpinner.increment(0);
            enableRunTheOperationButton();
        }
    });
    final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {

        @Override
        public DateCell call(final DatePicker __) {
            return new DateCell() {

                @Override
                public void updateItem(LocalDate item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!item.isBefore(LocalDate.now()))
                        return;
                    setDisable(true);
                    setStyle("-fx-background-color: #EEEEEE;");
                }
            };
        }
    };
    datePicker.setDayCellFactory(dayCellFactory);
    datePicker.setValue(LocalDate.now());
    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10, 50, 50, 50));
    vbox.setSpacing(10);
    datePickerForSmartCode = new JFXDatePicker();
    Label lbl = new Label("Choose Date");
    vbox.getChildren().addAll(lbl, datePickerForSmartCode);
    JFXPopup popup = new JFXPopup(vbox);
    showDatePickerBtn.setOnMouseClicked(e -> popup.show(showDatePickerBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
    radioButtonContainerSmarcodeOperations.addRadioButtons(Arrays.asList(new RadioButton[] { printSmartCodeRadioButton, addPackageToStoreRadioButton, removePackageFromStoreRadioButton, removePackageFromWarhouseRadioButton }));
    radioButtonContainerBarcodeOperations.addRadioButtons(Arrays.asList(new RadioButton[] { addPakageToWarhouseRadioButton }));
    resetParams();
    showScanCodePane(true);
}
Also used : JFXDatePicker(com.jfoenix.controls.JFXDatePicker) JFXPopup(com.jfoenix.controls.JFXPopup) Callback(javafx.util.Callback) Insets(javafx.geometry.Insets) Label(javafx.scene.control.Label) DatePicker(javafx.scene.control.DatePicker) JFXDatePicker(com.jfoenix.controls.JFXDatePicker) RadioButton(javafx.scene.control.RadioButton) JFXRadioButton(com.jfoenix.controls.JFXRadioButton) DateCell(javafx.scene.control.DateCell) LocalDate(java.time.LocalDate) VBox(javafx.scene.layout.VBox)

Aggregations

JFXPopup (com.jfoenix.controls.JFXPopup)4 Insets (javafx.geometry.Insets)3 Label (javafx.scene.control.Label)3 JFXListView (com.jfoenix.controls.JFXListView)2 VBox (javafx.scene.layout.VBox)2 Callback (javafx.util.Callback)2 Ingredient (BasicCommonClasses.Ingredient)1 Manufacturer (BasicCommonClasses.Manufacturer)1 IManager (EmployeeContracts.IManager)1 ConnectionFailure (EmployeeDefs.AEmployeeException.ConnectionFailure)1 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)1 IngredientStillInUse (EmployeeDefs.AEmployeeException.IngredientStillInUse)1 InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)1 ManfacturerStillInUse (EmployeeDefs.AEmployeeException.ManfacturerStillInUse)1 ParamIDAlreadyExists (EmployeeDefs.AEmployeeException.ParamIDAlreadyExists)1 ParamIDDoesNotExist (EmployeeDefs.AEmployeeException.ParamIDDoesNotExist)1 Manager (EmployeeImplementations.Manager)1 CriticalError (SMExceptions.CommonExceptions.CriticalError)1 InjectionFactory (UtilsImplementations.InjectionFactory)1 StackTraceUtil (UtilsImplementations.StackTraceUtil)1