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();
}
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);
});
}
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();
}
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);
}
Aggregations