Alerts are modal messages that show up in the context the user is
currently working in. You can use alerts to confirm that an action
should be executed, inform the user of harmful consequences, or report
the progress of a long-running action. Since alerts are modal they block
the user interface.
Use info.magnolia.ui.AlertBuilder to build various alerts.
Usage examples:
// Show an ERROR alert.voidopenErrorAlert(String message, Runnable confirmationHandler){
AlertBuilder.alert("Error")
.withLevel(Notification.Type.ERROR_MESSAGE)
.withBody(message)
.withConfirmationHandler(confirmationHandler)
.withOkButtonCaption("OK")
.buildAndOpen();
}
// Confirm deletion with a WARNING alert.voidopenConfirmationWarning(String message, Runnable confirmationHandler){
AlertBuilder.confirmDialog("Delete node?")
.withLevel(Notification.Type.WARNING_MESSAGE)
.withBody("This action cannot be undone.")
.withConfirmationHandler(confirmationHandler)
.withConfirmButtonCaption("Yes, Delete")
.withDeclineButtonCaption("No")
.buildAndOpen();
}Copy