JIDE 3.5.15

com.jidesoft.alert
Class Alert

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.jidesoft.popup.JidePopup
                  extended by com.jidesoft.alert.Alert
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, WindowConstants
Direct Known Subclasses:
InputPopup

public class Alert
extends JidePopup

Alert is a special popup component which can be used to display messages such as new email notification, warning or error messages. The purpose of Alert is very similar to Swing's JOptionPanes' message box with only OK button. The problem with message box with OK button is user still has to click on the OK button to dismiss the dialog. Alert will show to tell user something and then go away automatically.

Alert supports several custom animations when entrancing and exiting. For example, it supports fly-in or fly-out, fade-in or fade-out, resizing. You can also position it any location of the screen including nice pre-set locations (four corners, four sides and center). When it flies in or out, you can also set different path - straight line or curve or wave. All those features will enhance the appearance and effect of Alert so that it can deliver the right message to end users.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.popup.JidePopup
JidePopup.AccessiblePopup
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class com.jidesoft.popup.JidePopup
_actualOwner, _actualOwnerLocation, _detached, _insets, _panel, _previousSize, _resizableSupport, _window, ATTACHABLE_PROPERTY, CLIENT_PROPERTY_POPUP_ACTUAL_OWNER, CLIENT_PROPERTY_POPUP_TYPE, CLIENT_PROPERTY_VALUE_POPUP_TYPE_COMBOBOX, CLIENT_PROPERTY_WINDOW_OPACITY, CLIENT_PROPERTY_WINDOW_OPAQUE, CLIENT_PROPERTY_WINDOW_SHAPE, CONTENT_PANE_PROPERTY, DETACHED_PROPERTY, DISTANCE_TO_SCREEN_BORDER, DO_NOTHING_ON_MOVED, GLASS_PANE_PROPERTY, HEAVY_WEIGHT_POPUP, HIDE_ON_MOVED, LAYERED_PANE_PROPERTY, LIGHT_WEIGHT_POPUP, MENU_BAR_PROPERTY, MOVABLE_PROPERTY, MOVE_ON_MOVED, OWNER_PROPERTY, PROPERTY_GRIPPER_LOCATION, RESIZABLE_PROPERTY, ROOT_PANE_PROPERTY, TRANSIENT_PROPERTY, VISIBLE_PROPERTY
 
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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Alert()
          Creates an Alert.
 
Method Summary
protected  void contentResized()
           
protected  ResizableWindow createHeavyweightPopupContainer(Component owner)
          Overrides to make Alert alwaysOnTop.
 AlertGroup getAlertGroup()
           
protected  Point getDisplayStartLocation(Rectangle screenDim, Dimension size, int location)
          Get the display start location of the popup.
 CustomAnimation getHideAnimation()
          Gets hide animation.
 CustomAnimation getShowAnimation()
          Gets hide animation.
 void hidePopup(boolean cancelled)
          Hides alert using custom animation set by setHideAnimation().
 void hidePopupImmediately(boolean cancelled)
           
protected  void internalShowPopup(int x, int y, Component owner)
          Shows alert using custom animation set by setShowAnimation().
 boolean isAlwaysOnTop()
          Returns whether this alert is an always-on-top window.
 void setAlertGroup(AlertGroup alertGroup)
           
 void setAlwaysOnTop(boolean alwaysOnTop)
          Sets whether this alert should always be above other windows.
 void setHideAnimation(CustomAnimation hideAnimation)
          Sets the hide animation.
 void setShowAnimation(CustomAnimation showAnimation)
          Sets the show animation.
protected  void showAnimationEnds()
          Handler when show animation ends.
protected  void showPopupImmediately()
           
 
Methods inherited from class com.jidesoft.popup.JidePopup
addExcludedComponent, addImpl, addPopupMenuListener, ancestorHidden, ancestorMoved, beginDragging, createLightweightPopupContainer, createRootPane, createWindow, drag, endDragging, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getActualOwner, getAdjustedRectangle, getBackToOriginalInsets, getContentPane, getDefaultFocusComponent, getDefaultMoveOperation, getDisplayScreenBounds, getFrame, getGlassPane, getGripperLocation, getJMenuBar, getLayeredPane, getOwner, getPopupBorder, getPopupBounds, getPopupLocation, getPopupMenuListeners, getPopupType, getRealParent, getRootPane, getTimeout, getTopLevelAncestor, getUI, getUIClassID, handleComponentEvent, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMousePressed, handleMouseReleased, handleWindowEvent, hidePopup, hidePopupImmediately, installBorder, installListeners, internalShowPopup, isAttachable, isClickOnPopup, isDetached, isDragging, isExcludedComponent, isKeepPreviousSize, isMovable, isPopupAncestorOf, isPopupVisible, isResizable, isReturnFocusToOwner, isRootPaneCheckingEnabled, isTransient, movePopup, packPopup, remove, removeAllExcludedComponents, removeExcludedComponent, removePopupMenuListener, setAttachable, setBackToOriginalInsets, setContentPane, setDefaultFocusComponent, setDefaultMoveOperation, setDetached, setDisplayStartLocation, setGlassPane, setGripperLocation, setJMenuBar, setKeepPreviousSize, setLayeredPane, setLayout, setMovable, setOwner, setPopupBorder, setPopupType, setPreferredPopupSize, setResizable, setReturnFocusToOwner, setRootPane, setRootPaneCheckingEnabled, setTimeout, setTransient, setUI, setupResizeCorner, setVisible, shouldAWTEventListenerBeUsed, showPopup, showPopup, showPopup, showPopup, showPopup, showPopup, showPopup, showPopup, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, getPreferredSize, getRegisteredKeyStrokes, 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, paintComponent, paintImmediately, paintImmediately, paramString, 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, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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
 

Constructor Detail

Alert

public Alert()
Creates an Alert.

Method Detail

internalShowPopup

protected void internalShowPopup(int x,
                                 int y,
                                 Component owner)
Shows alert using custom animation set by setShowAnimation().

Overrides:
internalShowPopup in class JidePopup
Parameters:
x - the x coordinate
y - the y coordinate

showAnimationEnds

protected void showAnimationEnds()
Handler when show animation ends. It simply invokes showPopupImmediately() by default.

Since:
3.2.2

hidePopup

public void hidePopup(boolean cancelled)
Hides alert using custom animation set by setHideAnimation().

Overrides:
hidePopup in class JidePopup

hidePopupImmediately

public void hidePopupImmediately(boolean cancelled)
Overrides:
hidePopupImmediately in class JidePopup

getHideAnimation

public CustomAnimation getHideAnimation()
Gets hide animation.

Returns:
a custom animation.

setHideAnimation

public void setHideAnimation(CustomAnimation hideAnimation)
Sets the hide animation. The hide animation will be used when hidePopup() method is called. If you want to hide the alert without using animation, using JidePopup.hidePopupImmediately().

Please note, CustomAnimation cannot be shared among different Alert. So you should always create a new CustomAnimation and set it to Alert.

Parameters:
hideAnimation - the hide custom animation

getShowAnimation

public CustomAnimation getShowAnimation()
Gets hide animation.

Returns:
a custom animation.

setShowAnimation

public void setShowAnimation(CustomAnimation showAnimation)
Sets the show animation. The show animation will be used when showPopup(...) method is called. If you want to show the alert without using animation, using showPopupImmediately().

Please note, CustomAnimation cannot be shared among different Alert. So you should always create a new CustomAnimation and set it to Alert.

Parameters:
showAnimation - the show custom animation

showPopupImmediately

protected void showPopupImmediately()
Overrides:
showPopupImmediately in class JidePopup

createHeavyweightPopupContainer

protected ResizableWindow createHeavyweightPopupContainer(Component owner)
Overrides to make Alert alwaysOnTop. However this is a JDK1.5 only feature.

Overrides:
createHeavyweightPopupContainer in class JidePopup
Parameters:
owner - the owner for this popup container. It will be used to find the top level ancestor and use it as the parent for this popup window.
Returns:
the top level window for the alert.

isAlwaysOnTop

public boolean isAlwaysOnTop()
Returns whether this alert is an always-on-top window.

This feature is truely available only on JDK1.5. If it is on JDK1.4, we will simply call toFront() method to make it visible but it will not always on top if user clicks on another window and covers it.

Returns:
true, if the alter is in always-on-top state, false otherwise

setAlwaysOnTop

public void setAlwaysOnTop(boolean alwaysOnTop)
Sets whether this alert should always be above other windows.

This feature is truely available only on JDK1.5. If it is on JDK1.4, we will simply call toFront() method to make it visible but it will not always on top if user clicks on another window and covers it.

Parameters:
alwaysOnTop - true if the alert should always be above other windows

getAlertGroup

public AlertGroup getAlertGroup()

setAlertGroup

public void setAlertGroup(AlertGroup alertGroup)

getDisplayStartLocation

protected Point getDisplayStartLocation(Rectangle screenDim,
                                        Dimension size,
                                        int location)
Description copied from class: JidePopup
Get the display start location of the popup. It will automatically calculate a point if the customer didn't invoke JidePopup.setDisplayStartLocation(java.awt.Point) explicitly. It will just return the location if the customer already set it.

Overrides:
getDisplayStartLocation in class JidePopup
Parameters:
screenDim - the dimension of the screen
size - the size of the popup
location - the direction to show the popup
Returns:
the display start location.

contentResized

protected void contentResized()
Overrides:
contentResized in class JidePopup

JIDE 3.5.15