org.jivesoftware.spark.component
Class Notifications

java.lang.Object
  extended by org.jivesoftware.spark.component.Notifications
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, MainWindowListener

public final class Notifications
extends java.lang.Object
implements java.awt.event.ActionListener, MainWindowListener

Handles tray icon operations inside of Spark. Use to display incoming chat requests, incoming messages and general notifications.


Constructor Summary
Notifications()
          Creates a new instance of notifications.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void changePresence(org.jivesoftware.smack.packet.Presence presence)
          Change the presence of the tray.
 void mainWindowActivated()
          Invoked by the MainWindow when it has been activated, such as when it is coming out of a minimized state.
 void mainWindowDeactivated()
          Invoked by the MainWindow when it has been minimized in the toolbar.
 void showIncomingRequest()
          Notify agent that there is a new incoming chat request.
 void showMessage(java.lang.String title, java.lang.String message)
          Displays an incoming message.
 void showMessageReceived(java.lang.String from, java.lang.String message)
          Displays an incoming message.
 void showNotificationDialog(java.lang.String from, java.lang.String body)
          Shows notification dialog for incoming messages.
 void showWindow(javax.swing.JPanel panel, int timeout)
           
 void shutdown()
          Invoked by the MainWindow when it is about the shutdown.
 void stopFlashing()
          Stops the icon from flashing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Notifications

public Notifications()
Creates a new instance of notifications.

Method Detail

changePresence

public void changePresence(org.jivesoftware.smack.packet.Presence presence)
Change the presence of the tray.

Parameters:
presence - the new presence.

showMessageReceived

public void showMessageReceived(java.lang.String from,
                                java.lang.String message)
Displays an incoming message.

Parameters:
from - who the message was from.
message - the message body.

showMessage

public void showMessage(java.lang.String title,
                        java.lang.String message)
Displays an incoming message.

Parameters:
title - the title to use.
message - the message to display.

showIncomingRequest

public final void showIncomingRequest()
Notify agent that there is a new incoming chat request.


stopFlashing

public void stopFlashing()
Stops the icon from flashing.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

shutdown

public void shutdown()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it is about the shutdown. When invoked, the MainWindowListener should do anything necessary to persist their current state. MainWindowListeners authors should take care to ensure that any extraneous processing is not performed on this method, as it would cause a delay in the shutdown process.

Specified by:
shutdown in interface MainWindowListener
See Also:
MainWindow

mainWindowActivated

public void mainWindowActivated()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it has been activated, such as when it is coming out of a minimized state. When invoked, the MainWindowListener should do anything necessary to smoothly transition back to the application.

Specified by:
mainWindowActivated in interface MainWindowListener
See Also:
MainWindow

mainWindowDeactivated

public void mainWindowDeactivated()
Description copied from interface: MainWindowListener
Invoked by the MainWindow when it has been minimized in the toolbar.

Specified by:
mainWindowDeactivated in interface MainWindowListener
See Also:
MainWindow

showNotificationDialog

public void showNotificationDialog(java.lang.String from,
                                   java.lang.String body)
Shows notification dialog for incoming messages.

Parameters:
from - who the body is from.
body - the body of the body.

showWindow

public void showWindow(javax.swing.JPanel panel,
                       int timeout)