Search in sources :

Example 1 with JFXDialogLayout

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();
}
Also used : ActionEvent(javafx.event.ActionEvent) JFXDialog(com.jfoenix.controls.JFXDialog) Text(javafx.scene.text.Text) JFXButton(com.jfoenix.controls.JFXButton) JFXDialogLayout(com.jfoenix.controls.JFXDialogLayout)

Example 2 with JFXDialogLayout

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();
}
Also used : ActionEvent(javafx.event.ActionEvent) Label(javafx.scene.control.Label) JFXDialog(com.jfoenix.controls.JFXDialog) Text(javafx.scene.text.Text) JFXButton(com.jfoenix.controls.JFXButton) JFXDialogLayout(com.jfoenix.controls.JFXDialogLayout)

Example 3 with JFXDialogLayout

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();
    });
}
Also used : Label(javafx.scene.control.Label) JFXButton(com.jfoenix.controls.JFXButton) JFXAlert(com.jfoenix.controls.JFXAlert) JFXDialogLayout(com.jfoenix.controls.JFXDialogLayout) PostConstruct(javax.annotation.PostConstruct)

Aggregations

JFXButton (com.jfoenix.controls.JFXButton)3 JFXDialogLayout (com.jfoenix.controls.JFXDialogLayout)3 JFXDialog (com.jfoenix.controls.JFXDialog)2 ActionEvent (javafx.event.ActionEvent)2 Label (javafx.scene.control.Label)2 Text (javafx.scene.text.Text)2 JFXAlert (com.jfoenix.controls.JFXAlert)1 PostConstruct (javax.annotation.PostConstruct)1