com.alee.managers.notification
Class WebNotificationPopup

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.alee.laf.panel.WebPanel
                      extended by com.alee.managers.popup.WebPopup
                          extended by com.alee.managers.notification.WebNotificationPopup
All Implemented Interfaces:
PartialDecoration, LanguageContainerMethods, ShapeProvider, Styleable, SizeMethods<WebPanel>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class WebNotificationPopup
extends WebPopup

Custom popup used to display notifications within the application windows.

Author:
Mikle Garin
See Also:
NotificationManager, NotificationStyle, NotificationIcon, NotificationOption, WebPopup, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean accepted
          Whether notification is accepted or not.
protected  boolean clickToClose
          Whether notification can be closed by simple click on popup or not.
protected  boolean closeOnOptionSelection
          Whether notification popup should be closed when some option is selected by user or not.
protected  java.awt.Component content
          Notification content.
protected  WebPanel contentPanel
           
protected  long displayTime
          Notification display duration.
protected  WebTimer displayTimer
          Delayed hide timer.
protected  javax.swing.Icon icon
          Notification icon.
protected  WebImage iconImage
          Notification visual components.
protected  java.util.List<NotificationListener> listeners
          Notification popup listeners.
protected  java.util.List<NotificationOption> options
          Notification options.
protected  WebPanel optionsPanel
           
 
Fields inherited from class com.alee.managers.popup.WebPopup
animated, closeOnFocusLoss, defaultFocusComponent, fade, fadeFps, fadeStateType, fadeTime, fadeTimer, focusableChilds, focused, focusTracker, lastAncestorListener, lastComponent, lastComponentListener, popupListeners, requestFocusOnShow
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebNotificationPopup()
          Constructs new notification popup.
WebNotificationPopup(NotificationStyle notificationStyle)
          Constructs new notification popup with the specified notification style.
WebNotificationPopup(Painter stylePainter)
          Constructs new notification popup with the specified painter.
WebNotificationPopup(PopupStyle popupStyle)
          Constructs new notification popup with the specified style.
 
Method Summary
 void acceptAndHide()
          Accepts notification and closes popup.
 void addNotificationListener(NotificationListener listener)
          Adds directory chooser listener.
 void fireAccepted()
          Fires when notification accepted and closed.
 void fireClosed()
          Fires when notification simply closed.
 void fireOptionSelected(NotificationOption option)
          Fires when notification options is selected.
 java.awt.Component getContent()
          Returns notification content.
 long getDisplayTime()
          Returns notification display time.
 javax.swing.Icon getIcon()
          Returns notification icon.
 java.util.List<NotificationOption> getOptions()
          Returns notification options list.
protected  void initializeNotificationPopup()
          Initializes various notification popup settings.
 boolean isClickToClose()
          Returns whether notification can be closed by simple click on popup or not.
 boolean isCloseOnOptionSelection()
          Whether notification popup should be closed when some option is selected by user or not.
 void removeNotificationListener(NotificationListener listener)
          Removes directory chooser listener.
 void setClickToClose(boolean clickToClose)
          Sets whether notification can be closed by simple click on popup or not.
 void setCloseOnOptionSelection(boolean closeOnOptionSelection)
          Returns whether notification popup should be closed when some option is selected by user or not.
 void setContent(java.awt.Component content)
          Sets notification content.
 void setContent(java.lang.String content)
          Sets notification text content.
 void setDisplayTime(long displayTime)
          Sets notification display time.
 void setIcon(javax.swing.Icon icon)
          Sets notification icon.
 void setIcon(NotificationIcon iconType)
          Sets notification icon type.
 void setOptions(java.util.List<NotificationOption> options)
          Sets notification options list.
 void setOptions(NotificationOption... options)
          Sets notification options.
protected  void updateContent()
          Updates visible notification content.
protected  void updateIcon()
          Updates visible notification icon.
protected  void updateOptions()
          Updates visible notification options.
 
Methods inherited from class com.alee.managers.popup.WebPopup
addFocusableChild, addPopupListener, clearLocationListeners, contains, firePopupClosed, firePopupOpened, firePopupWillBeClosed, firePopupWillBeOpened, focusChanged, getDefaultFocusComponent, getFocusableChilds, getPopupLayer, hidePopup, hidePopupImpl, initializePopup, isAnimated, isChildFocused, isCloseOnFocusLoss, isRequestFocusOnShow, packPopup, paintComponent, removeFocusableChild, removePopupListener, setAnimated, setCloseOnFocusLoss, setDefaultFocusComponent, setPopupStyle, setRequestFocusOnShow, showAsPopupMenu, showPopup, showPopup, showPopup, showPopup, showPopup, showPopup, showPopupAsModal, showPopupAsModal, updateBounds, updateComponentAncestorListener, updateLocationListeners, updatePopupBounds, updatePopupBounds
 
Methods inherited from class com.alee.laf.panel.WebPanel
add, add, add, add, add, add, getBorderColor, getBorderStroke, getDisabledBorderColor, getFirstComponent, getLanguageContainerKey, getLastComponent, getMargin, getMinimumHeight, getMinimumWidth, getPainter, getPreferredHeight, getPreferredSize, getPreferredWidth, getRound, getShadeTransparency, getShadeWidth, getStyleId, getWebUI, isPaintBackground, isPaintBottom, isPaintBottomLine, isPaintFocus, isPaintLeft, isPaintLeftLine, isPaintRight, isPaintRightLine, isPaintTop, isPaintTopLine, isUndecorated, isWebColoredBackground, provideShape, removeLanguageContainerKey, setBorderColor, setBorderStroke, setDisabledBorderColor, setLanguageContainerKey, setMargin, setMargin, setMargin, setMinimumHeight, setMinimumWidth, setPaintBackground, setPaintBottom, setPaintBottomLine, setPainter, setPaintFocus, setPaintLeft, setPaintLeftLine, setPaintRight, setPaintRightLine, setPaintSideLines, setPaintSides, setPaintTop, setPaintTopLine, setPreferredHeight, setPreferredWidth, setRound, setShadeTransparency, setShadeWidth, setStyleId, setUndecorated, setWebColoredBackground, updateUI
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected java.util.List<NotificationListener> listeners
Notification popup listeners.


clickToClose

protected boolean clickToClose
Whether notification can be closed by simple click on popup or not.


closeOnOptionSelection

protected boolean closeOnOptionSelection
Whether notification popup should be closed when some option is selected by user or not. You can disable this and provide your own behavior for options selection through NotificationListener.


displayTime

protected long displayTime
Notification display duration. If set to zero notification will be visible until closed by user.


displayTimer

protected WebTimer displayTimer
Delayed hide timer.


accepted

protected boolean accepted
Whether notification is accepted or not.


icon

protected javax.swing.Icon icon
Notification icon.


content

protected java.awt.Component content
Notification content.


options

protected java.util.List<NotificationOption> options
Notification options.


iconImage

protected WebImage iconImage
Notification visual components.


contentPanel

protected WebPanel contentPanel

optionsPanel

protected WebPanel optionsPanel
Constructor Detail

WebNotificationPopup

public WebNotificationPopup()
Constructs new notification popup.


WebNotificationPopup

public WebNotificationPopup(NotificationStyle notificationStyle)
Constructs new notification popup with the specified notification style.

Parameters:
notificationStyle - notification style

WebNotificationPopup

public WebNotificationPopup(PopupStyle popupStyle)
Constructs new notification popup with the specified style.

Parameters:
popupStyle - popup style

WebNotificationPopup

public WebNotificationPopup(Painter stylePainter)
Constructs new notification popup with the specified painter.

Parameters:
stylePainter - popup style painter
Method Detail

initializeNotificationPopup

protected void initializeNotificationPopup()
Initializes various notification popup settings.


getIcon

public javax.swing.Icon getIcon()
Returns notification icon.

Returns:
notification icon

setIcon

public void setIcon(javax.swing.Icon icon)
Sets notification icon.

Parameters:
icon - new notification icon

setIcon

public void setIcon(NotificationIcon iconType)
Sets notification icon type.

Parameters:
iconType - new notification icon type

updateIcon

protected void updateIcon()
Updates visible notification icon.


getContent

public java.awt.Component getContent()
Returns notification content.

Returns:
notification content

setContent

public void setContent(java.awt.Component content)
Sets notification content.

Parameters:
content - new notification content

setContent

public void setContent(java.lang.String content)
Sets notification text content.

Parameters:
content - new notification text content

updateContent

protected void updateContent()
Updates visible notification content.


getOptions

public java.util.List<NotificationOption> getOptions()
Returns notification options list.

Returns:
notification options list

setOptions

public void setOptions(NotificationOption... options)
Sets notification options.

Parameters:
options - new notification options

setOptions

public void setOptions(java.util.List<NotificationOption> options)
Sets notification options list.

Parameters:
options - new notification options list

updateOptions

protected void updateOptions()
Updates visible notification options.


acceptAndHide

public void acceptAndHide()
Accepts notification and closes popup.


isClickToClose

public boolean isClickToClose()
Returns whether notification can be closed by simple click on popup or not.

Returns:
true if notification can be closed by simple click on popup, false otherwise

setClickToClose

public void setClickToClose(boolean clickToClose)
Sets whether notification can be closed by simple click on popup or not.

Parameters:
clickToClose - whether notification can be closed by simple click on popup or not

isCloseOnOptionSelection

public boolean isCloseOnOptionSelection()
Whether notification popup should be closed when some option is selected by user or not.

Returns:
true if notification popup should be closed when some option is selected by user, false otherwise

setCloseOnOptionSelection

public void setCloseOnOptionSelection(boolean closeOnOptionSelection)
Returns whether notification popup should be closed when some option is selected by user or not.

Parameters:
closeOnOptionSelection - whether notification popup should be closed when some option is selected by user or not

getDisplayTime

public long getDisplayTime()
Returns notification display time.

Returns:
notification display time

setDisplayTime

public void setDisplayTime(long displayTime)
Sets notification display time.

Parameters:
displayTime - new notification display time

addNotificationListener

public void addNotificationListener(NotificationListener listener)
Adds directory chooser listener.

Parameters:
listener - directory chooser listener to add

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
Removes directory chooser listener.

Parameters:
listener - directory chooser listener to remove

fireOptionSelected

public void fireOptionSelected(NotificationOption option)
Fires when notification options is selected.


fireAccepted

public void fireAccepted()
Fires when notification accepted and closed.


fireClosed

public void fireClosed()
Fires when notification simply closed.