Page tree
Skip to end of metadata
Go to start of metadata

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. 

To show alerts, inject the  UiContext  interface to your class. The UiContext is implemented by AppContextSubAppContext and Shell, so if you have one of those at hand, just reuse them.

Usage examples: 

@Inject
public MyCustomClass(UiContext uiContext) {
   this.uiContext = uiContext;
}
 
// Show an ERROR alert.
private openErrorAlert(String message) {
   uiContext.openAlert(MessageStyleTypeEnum.ERROR, "Error", "File upload failed.", "OK", null);
}
 
// Confirm deletion with a WARNING alert.
private openConfirmationWarning(String message) {
   uiContext.openConfirmation(MessageStyleTypeEnum.WARNING, "Delete node?", "This action cannot be undone.", "Yes, Delete", "No", true, null);
  • No labels