Class NotificationManager
java.lang.Object
com.nomagic.magicdraw.ui.notification.NotificationManager
Entry point to display notifications in MagicDraw. Two types of notifications can be displayed: application level and
container level. Container lever notifications are displayed in special container that implements
NotificationsContainer interface. When show notification method is called component owner parameter should point
to notification container. If application level notification must be displayed, null parameter should be passed as
component owner.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates new Notification manager instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotificationShowingConfigurator
(Predicate<Notification> notificationShowingConfigurator) Adds custom logic configurator in order to limit shown notifications.Returns builder that creates and displays grouped application notificationsReturns builder that creates and displays application notificationsgetConfig
(Notification notification) Helper method that returns predefined display parameters determined by notification severity level.Returns builder that creates and displays container notificationsReturns display parameters for notification with severity errorReturns display parameters for notification with severity infostatic NotificationManager
Returns single Notification manger instanceReturns display parameters for notification with severity warningstatic boolean
void
hideNotifications
(Component owner) Hides all notifications for component.void
hideNotifications
(String notificationID) Hides notifications with specified idboolean
isNotificationVisible
(String notificationID) Returns true if notification with specified id is shownstatic boolean
void
logHyperlinkedTextNotifications
(String text, Map<String, Runnable> callbacks) Logs hyperlinked text to Notification window without displaying balloon message.void
openNotificationWindow
(Notification notification, boolean openWindow) Shows notification in notification windowvoid
setApplicationNotificationGroupBuilder
(NotificationViewBuilder applicationNotificationGroupBuilder) Sets builder that creates and displays grouped application notificationsvoid
setApplicationNotificationsBuilder
(NotificationViewBuilder applicationNotificationsBuilder) Sets builder that creates and displays application notificationsvoid
setContainerNotificationsBuilder
(NotificationViewBuilder containerNotificationsBuilder) Sets builder that creates and displays container notificationsstatic void
setHasNewMessages
(boolean hasNewMessages) static void
setOpenWindowAfterLoad
(boolean openWindowAfterLoad) void
showNotification
(Notification notification) Shows application level notification in right bottom corner with default display parameters.void
showNotification
(Notification notification, NotificationViewConfig config) Shows application level notification in right bottom corner with display parameters specified in config object.void
showNotification
(Notification notification, Component owner) Shows application or container level notification with default display parameters.void
showNotification
(Notification notification, Component owner, NotificationViewConfig config) Shows application or container level notification with specified display parameters.
-
Constructor Details
-
NotificationManager
protected NotificationManager()Creates new Notification manager instance. Constructor made protected to implement singleton pattern
-
-
Method Details
-
getInstance
Returns single Notification manger instance- Returns:
- Notification manager instance
-
openNotificationWindow
Shows notification in notification window- Parameters:
notification
- notificationopenWindow
- flag, if true opens notification window
-
setOpenWindowAfterLoad
public static void setOpenWindowAfterLoad(boolean openWindowAfterLoad) -
isOpenWindowAfterLoad
public static boolean isOpenWindowAfterLoad() -
setHasNewMessages
public static void setHasNewMessages(boolean hasNewMessages) -
hasNewMessages
public static boolean hasNewMessages() -
showNotification
Shows application level notification in right bottom corner with default display parameters.- Parameters:
notification
- notification to show
-
showNotification
Shows application level notification in right bottom corner with display parameters specified in config object.- Parameters:
notification
- notification to showconfig
- notification display parameters
-
showNotification
Shows application or container level notification with default display parameters. If owner is not null and implements NotificationsContainer interface, the notification is displayed in owner's specific display area.- Parameters:
notification
- notification to showowner
- notification display container
-
showNotification
public void showNotification(Notification notification, @CheckForNull Component owner, @CheckForNull NotificationViewConfig config) Shows application or container level notification with specified display parameters. If owner is not null and implements NotificationsContainer interface, the notification is displayed in owner's specific display area.- Parameters:
notification
- notification to showowner
- notification display containerconfig
- notification display parameters
-
hideNotifications
Hides notifications with specified id- Parameters:
notificationID
- notification id
-
hideNotifications
Hides all notifications for component. -
isNotificationVisible
Returns true if notification with specified id is shown- Parameters:
notificationID
- notification id
-
logHyperlinkedTextNotifications
public void logHyperlinkedTextNotifications(String text, @CheckForNull Map<String, Runnable> callbacks) Logs hyperlinked text to Notification window without displaying balloon message.- Parameters:
text
- text with hyper links.callbacks
- callbacks that will be executed when link in text is selected
-
getApplicationNotificationsBuilder
Returns builder that creates and displays application notifications- Returns:
- builder that creates and displays application notifications
-
setApplicationNotificationsBuilder
public void setApplicationNotificationsBuilder(NotificationViewBuilder applicationNotificationsBuilder) Sets builder that creates and displays application notifications- Parameters:
applicationNotificationsBuilder
- builder that creates and displays application notifications
-
getContainerNotificationsBuilder
Returns builder that creates and displays container notifications- Returns:
- builder that creates and displays container notifications
-
setContainerNotificationsBuilder
Sets builder that creates and displays container notifications- Parameters:
containerNotificationsBuilder
- builder that creates and displays container notifications
-
getApplicationNotificationGroupBuilder
Returns builder that creates and displays grouped application notifications- Returns:
- builder that creates and displays grouped application notifications
-
setApplicationNotificationGroupBuilder
public void setApplicationNotificationGroupBuilder(NotificationViewBuilder applicationNotificationGroupBuilder) Sets builder that creates and displays grouped application notifications- Parameters:
applicationNotificationGroupBuilder
- builder that creates and displays grouped application notifications
-
getErrorConfig
Returns display parameters for notification with severity error- Returns:
- display parameters for notification with severity error
-
getWarningConfig
Returns display parameters for notification with severity warning- Returns:
- display parameters for notification with severity warning
-
getInfoConfig
Returns display parameters for notification with severity info- Returns:
- display parameters for notification with severity info
-
getConfig
Helper method that returns predefined display parameters determined by notification severity level.- Parameters:
notification
- notification for which display parameters should be returned- Returns:
- notification display parameters specific to its severity
-
addNotificationShowingConfigurator
public void addNotificationShowingConfigurator(Predicate<Notification> notificationShowingConfigurator) Adds custom logic configurator in order to limit shown notifications.- Parameters:
notificationShowingConfigurator
- configurator which limits shown notifications. Should return true if notification should be shown.
-