Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
Notifications are non-intrusive messages that inform the user whether an action was completed or aborted successfully. Typically they confirm something. Notifications look like Post-IT notes. They go away automatically and don't require user action. Use notifications to confirm what the user did and provide them with confidence and assurance.
To show notifications, inject the
UiContext
interface to your class. The UiContext
is implemented by AppContext
, SubAppContext
and Shell
, so if you have one of those at hand, just reuse them.
Usage examples:
@Inject public MyCustomClass(UiContext uiContext) { this.uiContext = uiContext; } // Send an INFO notification to the current user. private openInfoNotification(String message) { uiContext.openNotification(MessageStyleTypeEnum.INFO, true, message); } // Send an ERROR notification to the current user. private openErrorNotification(String message) { uiContext.openNotification(MessageStyleTypeEnum.ERROR, true, message); }