com.alee.managers.notification
Class NotificationManager

java.lang.Object
  extended by com.alee.managers.notification.NotificationManager
All Implemented Interfaces:
javax.swing.SwingConstants

public final class NotificationManager
extends java.lang.Object
implements javax.swing.SwingConstants

This manager allows you to display custom notification popups within the application. You can also add custom actions, set their duration, modify popup styling and use some other advanced features.

Author:
Mikle Garin
See Also:
WebInnerNotification, DisplayType

Field Summary
protected static boolean avoidOverlappingSystemToolbar
          Whether notifications displayed in separate windows should avoid overlapping system toolbar or not.
protected static boolean cascade
          Whether popups should be cascaded or not.
protected static int cascadeAmount
          Amount of cascaded in a row popups.
protected static DisplayType displayType
          Notifications display type.
protected static int gap
          Gap between notifications.
protected static int location
          Notifications display location.
protected static java.awt.Insets margin
          Notifications side margin.
protected static java.util.Map<WebInnerNotification,PopupLayer> notificationPopups
          Cached notification popups.
protected static java.util.Map<PopupLayer,NotificationsLayout> notificationsLayouts
          Cached notification layouts.
protected static java.util.Map<WebNotification,java.awt.Window> notificationWindows
          Cached notification windows.
protected static java.util.Map<java.awt.GraphicsDevice,NotificationsScreenLayout> screenLayouts
          Special layouts for notification windows.
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
NotificationManager()
           
 
Method Summary
static int getCascadeAmount()
          Returns amount of cascaded in a row popups.
static DisplayType getDisplayType()
          Retyrns notification display type.
static int getGap()
          Returns gap between notifications.
static int getLocation()
          Returns notifications display location.
static java.awt.Insets getMargin()
          Returns notifications side margin.
static void hideAllNotifications()
          Hides all visible notifications.
static boolean isAvoidOverlappingSystemToolbar()
          Returns whether notifications displayed in separate windows should avoid overlapping system toolbar or not.
static boolean isCascade()
          Returns whether popups should be cascaded or not.
static void setAvoidOverlappingSystemToolbar(boolean avoid)
          Sets whether notifications displayed in separate windows should avoid overlapping system toolbar or not.
static void setCascade(boolean cascade)
          Sets whether popups should be cascaded or not.
static void setCascadeAmount(int cascadeAmount)
          Sets amount of cascaded in a row popups.
static void setDisplayType(DisplayType displayType)
          Sets notification display type.
static void setGap(int gap)
          Sets gap between notifications.
static void setLocation(int location)
          Sets notifications display location.
static void setMargin(java.awt.Insets margin)
          Sets notifications side margin.
static void setMargin(int margin)
          Sets notifications side margin.
static void setMargin(int top, int left, int bottom, int right)
          Sets notifications side margin.
static WebInnerNotification showInnerNotification(java.awt.Component content)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.awt.Component content)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.awt.Component content, javax.swing.Icon icon)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.awt.Component content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.awt.Component content, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component content, javax.swing.Icon icon)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component content, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.lang.String content)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.lang.String content, javax.swing.Icon icon)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.lang.String content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, java.lang.String content, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.awt.Component showFor, WebInnerNotification notification)
          Displays notification on popup layer.
static WebInnerNotification showInnerNotification(java.lang.String content)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.lang.String content, javax.swing.Icon icon)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.lang.String content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(java.lang.String content, NotificationOption... options)
          Returns displayed notification.
static WebInnerNotification showInnerNotification(WebInnerNotification notification)
          Displays notification on popup layer.
static WebNotification showNotification(java.awt.Component content)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.awt.Component content)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.awt.Component content, javax.swing.Icon icon)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.awt.Component content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.awt.Component content, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component content, javax.swing.Icon icon)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component content, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.lang.String content)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.lang.String content, javax.swing.Icon icon)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.lang.String content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, java.lang.String content, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.awt.Component showFor, WebNotification notification)
          Displays notification in window.
static WebNotification showNotification(java.lang.String content)
          Returns displayed notification.
static WebNotification showNotification(java.lang.String content, javax.swing.Icon icon)
          Returns displayed notification.
static WebNotification showNotification(java.lang.String content, javax.swing.Icon icon, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(java.lang.String content, NotificationOption... options)
          Returns displayed notification.
static WebNotification showNotification(WebNotification notification)
          Displays notification in window.
static void updateNotificationLayouts()
          Optimized layout updates for all visible notifications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

protected static int location
Notifications display location.


displayType

protected static DisplayType displayType
Notifications display type.


margin

protected static java.awt.Insets margin
Notifications side margin.


gap

protected static int gap
Gap between notifications.


cascade

protected static boolean cascade
Whether popups should be cascaded or not.


cascadeAmount

protected static int cascadeAmount
Amount of cascaded in a row popups.


avoidOverlappingSystemToolbar

protected static boolean avoidOverlappingSystemToolbar
Whether notifications displayed in separate windows should avoid overlapping system toolbar or not.


notificationsLayouts

protected static final java.util.Map<PopupLayer,NotificationsLayout> notificationsLayouts
Cached notification layouts.


notificationPopups

protected static final java.util.Map<WebInnerNotification,PopupLayer> notificationPopups
Cached notification popups.


screenLayouts

protected static final java.util.Map<java.awt.GraphicsDevice,NotificationsScreenLayout> screenLayouts
Special layouts for notification windows. Each layout is cached under according graphics device it is used with.


notificationWindows

protected static final java.util.Map<WebNotification,java.awt.Window> notificationWindows
Cached notification windows.

Constructor Detail

NotificationManager

public NotificationManager()
Method Detail

getLocation

public static int getLocation()
Returns notifications display location.

Returns:
notifications display location

setLocation

public static void setLocation(int location)
Sets notifications display location.

Parameters:
location - new notifications display location

getDisplayType

public static DisplayType getDisplayType()
Retyrns notification display type.

Returns:
notification display type

setDisplayType

public static void setDisplayType(DisplayType displayType)
Sets notification display type.

Parameters:
displayType - new notification display type

getMargin

public static java.awt.Insets getMargin()
Returns notifications side margin.

Returns:
notifications side margin

setMargin

public static void setMargin(int margin)
Sets notifications side margin.

Parameters:
margin - margin

setMargin

public static void setMargin(int top,
                             int left,
                             int bottom,
                             int right)
Sets notifications side margin.

Parameters:
top - top margin
left - left margin
bottom - bottom margin
right - right margin

setMargin

public static void setMargin(java.awt.Insets margin)
Sets notifications side margin.

Parameters:
margin - new notifications side margin

getGap

public static int getGap()
Returns gap between notifications.

Returns:
gap between notifications

setGap

public static void setGap(int gap)
Sets gap between notifications.

Parameters:
gap - new gap between notifications

isCascade

public static boolean isCascade()
Returns whether popups should be cascaded or not.

Returns:
whether popups should be cascaded or not

setCascade

public static void setCascade(boolean cascade)
Sets whether popups should be cascaded or not.

Parameters:
cascade - whether popups should be cascaded or not

getCascadeAmount

public static int getCascadeAmount()
Returns amount of cascaded in a row popups.

Returns:
amount of cascaded in a row popups

setCascadeAmount

public static void setCascadeAmount(int cascadeAmount)
Sets amount of cascaded in a row popups.

Parameters:
cascadeAmount - new amount of cascaded in a row popups

isAvoidOverlappingSystemToolbar

public static boolean isAvoidOverlappingSystemToolbar()
Returns whether notifications displayed in separate windows should avoid overlapping system toolbar or not.

Returns:
true if notifications displayed in separate windows should avoid overlapping system toolbar, false otherwise

setAvoidOverlappingSystemToolbar

public static void setAvoidOverlappingSystemToolbar(boolean avoid)
Sets whether notifications displayed in separate windows should avoid overlapping system toolbar or not.

Parameters:
avoid - whether notifications displayed in separate windows should avoid overlapping system toolbar or not

updateNotificationLayouts

public static void updateNotificationLayouts()
Optimized layout updates for all visible notifications.


hideAllNotifications

public static void hideAllNotifications()
Hides all visible notifications.


showNotification

public static WebNotification showNotification(java.lang.String content)
Returns displayed notification.

Parameters:
content - notification text content
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.lang.String content,
                                               javax.swing.Icon icon)
Returns displayed notification.

Parameters:
content - notification text content
icon - notification icon
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.lang.String content)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification text content
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.lang.String content,
                                               javax.swing.Icon icon)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification text content
icon - notification icon
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component content)
Returns displayed notification.

Parameters:
content - notification content
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component content,
                                               javax.swing.Icon icon)
Returns displayed notification.

Parameters:
content - notification content
icon - notification icon
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.awt.Component content)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification content
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.awt.Component content,
                                               javax.swing.Icon icon)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification content
icon - notification icon
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.lang.String content,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification text content
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.lang.String content,
                                               javax.swing.Icon icon,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification text content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.lang.String content,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification text content
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.lang.String content,
                                               javax.swing.Icon icon,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification text content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component content,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification content
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component content,
                                               javax.swing.Icon icon,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.awt.Component content,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification content
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               java.awt.Component content,
                                               javax.swing.Icon icon,
                                               NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine notification parent window
content - notification content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showNotification

public static WebNotification showNotification(WebNotification notification)
Displays notification in window.

Parameters:
notification - notification to display

showNotification

public static WebNotification showNotification(java.awt.Component showFor,
                                               WebNotification notification)
Displays notification in window.

Parameters:
showFor - component used to determine notification parent window
notification - notification to display

showInnerNotification

public static WebInnerNotification showInnerNotification(java.lang.String content)
Returns displayed notification.

Parameters:
content - notification text content
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.lang.String content,
                                                         javax.swing.Icon icon)
Returns displayed notification.

Parameters:
content - notification text content
icon - notification icon
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.lang.String content)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification text content
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.lang.String content,
                                                         javax.swing.Icon icon)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification text content
icon - notification icon
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component content)
Returns displayed notification.

Parameters:
content - notification content
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component content,
                                                         javax.swing.Icon icon)
Returns displayed notification.

Parameters:
content - notification content
icon - notification icon
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.awt.Component content)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification content
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.awt.Component content,
                                                         javax.swing.Icon icon)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification content
icon - notification icon
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.lang.String content,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification text content
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.lang.String content,
                                                         javax.swing.Icon icon,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification text content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.lang.String content,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification text content
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.lang.String content,
                                                         javax.swing.Icon icon,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification text content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component content,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification content
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component content,
                                                         javax.swing.Icon icon,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
content - notification content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.awt.Component content,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification content
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         java.awt.Component content,
                                                         javax.swing.Icon icon,
                                                         NotificationOption... options)
Returns displayed notification.

Parameters:
showFor - component used to determine window where notification should be displayed
content - notification content
icon - notification icon
options - notification selectable options
Returns:
displayed notification

showInnerNotification

public static WebInnerNotification showInnerNotification(WebInnerNotification notification)
Displays notification on popup layer.

Parameters:
notification - notification to display

showInnerNotification

public static WebInnerNotification showInnerNotification(java.awt.Component showFor,
                                                         WebInnerNotification notification)
Displays notification on popup layer.

Parameters:
showFor - component used to determine window where notification should be displayed
notification - notification to display