Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat.history
Class HistoryWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by net.java.sip.communicator.util.swing.SIPCommFrame
                          extended by net.java.sip.communicator.impl.gui.main.chat.history.HistoryWindow
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Observer, Accessible, RootPaneContainer, WindowConstants, ChatConversationContainer, HistorySearchProgressListener, ChatRoomMessageListener, MessageListener, Skinnable

public class HistoryWindow
extends SIPCommFrame
implements ChatConversationContainer, HistorySearchProgressListener, MessageListener, ChatRoomMessageListener, Skinnable

The HistoryWindow is the window, where user could view or search in the message history. The HistoryWindow could contain the history for one or a group of MetaContacts.

Author:
Yana Stamcheva, Lubomir Marinov, Adam Netocny
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.java.sip.communicator.util.swing.SIPCommFrame
SIPCommFrame.MainContentPane
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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 javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface net.java.sip.communicator.service.history.event.HistorySearchProgressListener
PROGRESS_MAXIMUM_VALUE, PROGRESS_MINIMUM_VALUE
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HistoryWindow(Object historyContact)
          Creates an instance of the HistoryWindow.
 
Method Summary
 void addTypingNotification(String message)
          Implements ChatConversationContainer.setStatusMessage method.
protected  void close(boolean isEscaped)
          Implements the SIPCommFrame close method, which is invoked when user presses the Esc key.
 Window getConversationContainerWindow()
          Implements ChatConversationContainer.getWindow method.
 Date getNextDateFromHistory(Date date)
          Returns the next date from the history.
 void loadSkin()
          Re-process history.
 void messageDelivered(ChatRoomMessageDeliveredEvent evt)
          Called when the underlying implementation has received an indication that a message, sent earlier has been successfully received by the destination.
 void messageDelivered(MessageDeliveredEvent evt)
          Implements MessageListener.messageDelivered method in order to refresh the history when new message is sent.
 void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
          Called to indicate that delivery of a message sent earlier to the chat room has failed.
 void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
          Called to indicated that delivery of a message sent earlier has failed.
 void messageReceived(ChatRoomMessageReceivedEvent evt)
          Called when a new incoming Message has been received.
 void messageReceived(MessageReceivedEvent evt)
          Implements MessageListener.messageReceived method in order to refresh the history when new message is received.
 void progressChanged(ProgressEvent evt)
          Handles the ProgressEvent triggered from the history when processing a query.
 void showHistoryByKeyword(String keyword)
          Shows a history for a given keyword.
 void showHistoryByPeriod(Date startDate, Date endDate)
          Shows a history for a given period.
protected  void windowClosing(WindowEvent e)
          Indicates that the window is closing.
 
Methods inherited from class net.java.sip.communicator.util.swing.SIPCommFrame
addKeybindingAction, dispose, setKeybindingInput, setSizeAndLocation, setVisible, setVisible, update, validate
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

HistoryWindow

public HistoryWindow(Object historyContact)
Creates an instance of the HistoryWindow.

Parameters:
historyContact - the MetaContact or the ChatRoom
Method Detail

showHistoryByPeriod

public void showHistoryByPeriod(Date startDate,
                                Date endDate)
Shows a history for a given period.

Parameters:
startDate - the start date of the period
endDate - the end date of the period

showHistoryByKeyword

public void showHistoryByKeyword(String keyword)
Shows a history for a given keyword.

Parameters:
keyword - the keyword to search

addTypingNotification

public void addTypingNotification(String message)
Implements ChatConversationContainer.setStatusMessage method.

Specified by:
addTypingNotification in interface ChatConversationContainer
Parameters:
message - the status message to set

getConversationContainerWindow

public Window getConversationContainerWindow()
Implements ChatConversationContainer.getWindow method.

Specified by:
getConversationContainerWindow in interface ChatConversationContainer
Returns:
this window

windowClosing

protected void windowClosing(WindowEvent e)
Indicates that the window is closing. Removes all message listeners when closing.

Overrides:
windowClosing in class SIPCommFrame
Parameters:
e - the WindowEvent that notified us

getNextDateFromHistory

public Date getNextDateFromHistory(Date date)
Returns the next date from the history.

Parameters:
date - The date which indicates where to start.
Returns:
the date after the given date

progressChanged

public void progressChanged(ProgressEvent evt)
Handles the ProgressEvent triggered from the history when processing a query.

Specified by:
progressChanged in interface HistorySearchProgressListener
Parameters:
evt - the ProgressEvent that notified us

close

protected void close(boolean isEscaped)
Implements the SIPCommFrame close method, which is invoked when user presses the Esc key. Checks if the popup menu is visible and if this is the case hides it, otherwise saves the current history window size and location and disposes the window.

Overrides:
close in class SIPCommFrame
Parameters:
isEscaped - indicates if the window has been closed by pressing the Esc key

messageReceived

public void messageReceived(MessageReceivedEvent evt)
Implements MessageListener.messageReceived method in order to refresh the history when new message is received.

Specified by:
messageReceived in interface MessageListener
Parameters:
evt - the MessageReceivedEvent containing the newly received message, its sender and other details.

messageDelivered

public void messageDelivered(MessageDeliveredEvent evt)
Implements MessageListener.messageDelivered method in order to refresh the history when new message is sent.

Specified by:
messageDelivered in interface MessageListener
Parameters:
evt - the MessageDeliveredEvent containing the id of the message that has caused the event.

messageDeliveryFailed

public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
Description copied from interface: MessageListener
Called to indicated that delivery of a message sent earlier has failed. Reason code and phrase are contained by the MessageFailedEvent

Specified by:
messageDeliveryFailed in interface MessageListener
Parameters:
evt - the MessageFailedEvent containing the ID of the message whose delivery has failed.

messageDelivered

public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
Description copied from interface: ChatRoomMessageListener
Called when the underlying implementation has received an indication that a message, sent earlier has been successfully received by the destination.

Specified by:
messageDelivered in interface ChatRoomMessageListener
Parameters:
evt - the ChatRoomMessageDeliveredEvent containing the id of the message that has caused the event.

messageDeliveryFailed

public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
Description copied from interface: ChatRoomMessageListener
Called to indicate that delivery of a message sent earlier to the chat room has failed. Reason code and phrase are contained by the MessageFailedEvent

Specified by:
messageDeliveryFailed in interface ChatRoomMessageListener
Parameters:
evt - the ChatroomMessageDeliveryFailedEvent containing the ID of the message whose delivery has failed.

messageReceived

public void messageReceived(ChatRoomMessageReceivedEvent evt)
Description copied from interface: ChatRoomMessageListener
Called when a new incoming Message has been received.

Specified by:
messageReceived in interface ChatRoomMessageListener
Parameters:
evt - the ChatRoomMessageReceivedEvent containing the newly received message, its sender and other details.

loadSkin

public void loadSkin()
Re-process history.

Specified by:
loadSkin in interface Skinnable

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.