use of com.jfoenix.controls.JFXDialogLayout in project SmartCity-Market by TechnionYP5777.
the class DialogMessagesService method alertCreator.
private static void alertCreator(String title, String header, String content) {
JFXDialogLayout dialogContent = new JFXDialogLayout();
dialogContent.setHeading(new Text(header == null ? title : title + "\n" + header));
dialogContent.setBody(new Text(content));
JFXButton close = new JFXButton("Close");
close.getStyleClass().add("JFXButton");
dialogContent.setActions(close);
JFXDialog dialog = new JFXDialog((StackPane) AbstractApplicationScreen.stage.getScene().getRoot(), dialogContent, JFXDialog.DialogTransition.CENTER);
close.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
dialog.close();
}
});
dialog.show();
}
use of com.jfoenix.controls.JFXDialogLayout in project SmartCity-Market by TechnionYP5777.
the class DialogMessagesService method showConfirmationDialog.
public static void showConfirmationDialog(String title, String header, String content, IConfiramtionDialog d) {
JFXDialogLayout dialogContent = new JFXDialogLayout();
dialogContent.setHeading(new Text(header == null ? title : title + "\n" + header));
dialogContent.setBody(new Text(content));
JFXButton yes = new JFXButton("Yes");
yes.getStyleClass().add("JFXButton");
JFXButton no = new JFXButton("No");
no.getStyleClass().add("JFXButton");
dialogContent.setActions(yes, new Label(" "), no);
JFXDialog dialog = new JFXDialog((StackPane) AbstractApplicationScreen.stage.getScene().getRoot(), dialogContent, JFXDialog.DialogTransition.CENTER);
yes.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
dialog.close();
d.onYes();
}
});
no.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
dialog.close();
d.onNo();
}
});
dialog.show();
}
use of com.jfoenix.controls.JFXDialogLayout in project JFoenix by jfoenixadmin.
the class DialogController method init.
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() {
root.getChildren().remove(dialog);
centerButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.CENTER);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
topButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.TOP);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
rightButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.RIGHT);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
bottomButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.BOTTOM);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
leftButton.setOnAction(action -> {
dialog.setTransitionType(DialogTransition.LEFT);
dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE));
});
acceptButton.setOnAction(action -> dialog.close());
alertButton.setOnAction(action -> {
JFXAlert alert = new JFXAlert((Stage) alertButton.getScene().getWindow());
alert.initModality(Modality.APPLICATION_MODAL);
alert.setOverlayClose(false);
JFXDialogLayout layout = new JFXDialogLayout();
layout.setHeading(new Label("Modal Dialog using JFXAlert"));
layout.setBody(new Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit," + " sed do eiusmod tempor incididunt ut labore et dolore magna" + " aliqua. Utenim ad minim veniam, quis nostrud exercitation" + " ullamco laboris nisi ut aliquip ex ea commodo consequat."));
JFXButton closeButton = new JFXButton("ACCEPT");
closeButton.getStyleClass().add("dialog-accept");
closeButton.setOnAction(event -> alert.hideWithAnimation());
layout.setActions(closeButton);
alert.setContent(layout);
alert.show();
});
}
Aggregations