Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat
Class ChatPanel

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 net.java.sip.communicator.util.swing.TransparentPanel
                      extended by net.java.sip.communicator.impl.gui.main.chat.ChatPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChatConversationContainer, ChatSessionRenderer, Chat, ChatRoomLocalUserRoleListener, ChatRoomMemberPropertyChangeListener, ChatRoomMemberRoleListener, FileTransferStatusListener, Skinnable

public class ChatPanel
extends TransparentPanel
implements ChatSessionRenderer, Chat, ChatConversationContainer, ChatRoomMemberRoleListener, ChatRoomLocalUserRoleListener, ChatRoomMemberPropertyChangeListener, FileTransferStatusListener, Skinnable

The ChatPanel is the panel, where users can write and send messages, view received messages. A ChatPanel is created for a contact or for a group of contacts in case of a chat conference. There is always one default contact for the chat, which is the first contact which was added to the chat. When chat is in mode "open all messages in new window", each ChatPanel corresponds to a ChatWindow. When chat is in mode "group all messages in one chat window", each ChatPanel corresponds to a tab in the ChatWindow.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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
 ChatSession chatSession
           
protected static int MESSAGES_PER_PAGE
          The number of messages shown per page.
static int TYPING_NOTIFICATION_SEND_FAILED
          Indicates that sending a typing notification event has failed.
static int TYPING_NOTIFICATION_SUCCESSFULLY_SENT
          Indicates that a typing notification event is successfully sent.
 int unreadMessageNumber
           
 
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 net.java.sip.communicator.service.gui.Chat
ACTION_MESSAGE, CHAT_BUFFER_SIZE, ERROR_MESSAGE, HISTORY_INCOMING_MESSAGE, HISTORY_OUTGOING_MESSAGE, INCOMING_MESSAGE, OUTGOING_MESSAGE, SMS_MESSAGE, STATUS_MESSAGE, SYSTEM_MESSAGE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ChatPanel(ChatContainer chatContainer)
          Creates a ChatPanel which is added to the given chat window.
 
Method Summary
 void addActiveFileTransfer(String id, Object descriptor)
          Adds the given file transfer id to the list of active file transfers.
 void addChatContact(ChatContact<?> chatContact)
          Adds the given chatContact to the list of chat contacts participating in the corresponding to this chat panel chat.
 void addChatEditorCaretListener(CaretListener l)
          Adds the given CaretListener to this Chat.
 void addChatEditorDocumentListener(DocumentListener l)
          Adds the given DocumentListener to this Chat.
 void addChatEditorKeyListener(KeyListener l)
          Adds the given KeyListener to this Chat.
 void addChatEditorMenuListener(ChatMenuListener l)
          Adds the given ChatMenuListener to this Chat.
 void addChatFocusListener(ChatFocusListener listener)
          Implements Chat.addChatFocusListener method.
 void addChatHistoryListener(ChatHistoryListener l)
          Adds the given ChatHistoryListener to the list of listeners notified when a change occurs in the history shown in this chat panel.
 void addChatLinkClickedListener(ChatLinkClickedListener listener)
          Add a new ChatLinkClickedListener
 void addChatTransport(ChatTransport chatTransport)
          Adds the given chatTransport to the given send via selector box.
 void addErrorMessage(String contactName, String message)
          Adds the given error message to the chat window conversation area.
 void addErrorMessage(String contactName, String title, String message)
          Adds the given error message to the chat window conversation area.
 void addIncomingFileTransferRequest(OperationSetFileTransfer fileTransferOpSet, IncomingFileTransferRequest request, Date date)
          Adds the given IncomingFileTransferRequest to the conversation panel in order to notify the user of the incoming file.
 void addMessage(String contactName, long date, String messageType, String message, String contentType)
          Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.
 void addMessage(String contactName, long date, String messageType, String title, String message, String contentType)
          Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.
 void addMessage(String contactName, String displayName, long date, String messageType, String message, String contentType)
          Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.
 void addTextInWriteArea(String text)
          Adds text to the write area editor.
 void addTypingNotification(String typingNotification)
          Adds a typing notification message to the conversation panel.
 void cancelActiveFileTransfers()
          Cancels all active file transfers.
 void chatRoomPropertyChanged(ChatRoomMemberPropertyChangeEvent event)
          Notifies the user if any member of the chatroom changes nickname.
 boolean containsActiveFileTransfers()
          Returns true if there are active file transfers, otherwise returns false.
 void copy()
          Copies either the selected write area content or the selected conversation panel content to the clipboard.
 void copyWriteArea()
          Copies the selected write panel content to the clipboard.
 void cut()
          Cuts the write area selected content to the clipboard.
 void dispose()
          Runs clean-up for associated resources which need explicit disposal (e.g.
 ChatTransport findFileTransferChatTransport()
          Returns the first chat transport for the current chat session that supports file transfer.
 ChatTransport findInviteChatTransport()
          Returns the first chat transport for the current chat session that supports group chat.
 void fireChatFocusEvent(int eventID)
          Informs all ChatFocusListeners that a ChatFocusEvent has been triggered.
 int getCaretPosition()
          Gets the caret position in the chat editor.
 ChatContainer getChatContainer()
          Returns the chat window, where this chat panel is added.
 ChatConversationPanel getChatConversationPanel()
          Returns the conversation panel, contained in this chat panel.
 ChatSession getChatSession()
          Returns the chat session associated with this chat panel.
 ChatWritePanel getChatWritePanel()
          Returns the write area panel, contained in this chat panel.
 Window getConversationContainerWindow()
          Returns the chat window, where this chat panel is located.
 int getDividerLocation()
          Returns the contained divider location.
 int getDividerSize()
          Returns the contained divider size.
 long getFirstHistoryMsgTimestamp()
          Returns the date of the first message in history for this chat.
 Highlighter getHighlighter()
          Provides the Highlighter used in rendering the chat editor.
 long getLastHistoryMsgTimestamp()
          Returns the date of the last message in history for this chat.
 String getMessage()
          Returns the message written by user in the chat write area.
 String getRoleDescription(ChatRoomMemberRole role)
          Returns the corresponding role description to the given role index.
 String getTextFromWriteArea(String mimeType)
          Returns the text contained in the write area editor.
 void inviteContacts(ChatTransport inviteChatTransport, Collection<String> chatContacts, String reason)
          Invites the given chatContacts to this chat.
 boolean isChatFocused()
          Implements the Chat.isChatFocused method.
 boolean isShown()
          Returns TRUE if this chat panel is added to a container (window or tabbed pane), which is shown on the screen, FALSE - otherwise.
 boolean isWriteAreaEmpty()
          Checks if the editor contains text.
 void loadHistory()
          Loads history for the chat meta contact in a separate thread.
 void loadHistory(String escapedMessageID)
          Loads history messages ignoring the message with the specified id.
 void loadNextPageFromHistory()
          Implements ChatPanel.loadNextFromHistory.
 void loadPreviousPageFromHistory()
          Implements ChatPanel.loadPreviousFromHistory.
 void loadSkin()
          Reloads chat messages.
 void localUserRoleChanged(ChatRoomLocalUserRoleChangeEvent evt)
          Implements the localUserRoleChanged() method.
 void memberRoleChanged(ChatRoomMemberRoleChangeEvent evt)
          Implements the memberRoleChanged() method.
 void paste()
          Pastes the content of the clipboard to the write area.
 void promptRepaint()
          Causes the chat to validate its appearance (suggests a repaint operation may be necessary).
 void refreshWriteArea()
          Refreshes write area editor pane.
 void removeActiveFileTransfer(String id)
          Removes the given file transfer id from the list of active file transfers.
 void removeAllChatContacts()
          Removes all chat contacts from the contact list of the chat.
 void removeChatContact(ChatContact<?> chatContact)
          Removes the given chatContact from the list of chat contacts participating in the corresponding to this chat panel chat.
 void removeChatEditorCaretListener(CaretListener l)
          Removes the given CaretListener from this Chat.
 void removeChatEditorDocumentListener(DocumentListener l)
          Removes the given DocumentListener from this Chat.
 void removeChatEditorKeyListener(KeyListener l)
          Removes the given KeyListener from this Chat.
 void removeChatEditorMenuListener(ChatMenuListener l)
          Removes the given ChatMenuListener to this Chat.
 void removeChatFocusListener(ChatFocusListener listener)
          Implements Chat.removeChatFocusListener method.
 void removeChatHistoryListener(ChatHistoryListener l)
          Removes the given ChatHistoryListener from the list of listeners notified when a change occurs in the history shown in this chat panel.
 void removeChatLinkClickedListener(ChatLinkClickedListener listener)
          Remove existing ChatLinkClickedListener
 void removeChatTransport(ChatTransport chatTransport)
          Removes the given chat status state from the send via selector box.
 void removeTypingNotification()
          Removes the typing notification message from the conversation panel.
 void requestFocusInWriteArea()
          Requests the focus in the write message area.
 void sendButtonDoClick()
          Sends current write area content.
 void sendFile(File file)
          Sends the given file through the currently selected chat transport.
 void sendFile(File file, SendFileConversationComponent fileComponent)
          Sends the given file through the currently selected chat transport by using the given fileComponent to visualize the transfer process in the chat conversation panel.
protected  void sendInstantMessage()
          Implements the ChatPanel.sendMessage method.
protected  void sendMessage()
          Sends the text contained in the write area as an SMS message or an instance message depending on the "send SMS" check box.
 void sendSmsMessage()
          Sends the text contained in the write area as an SMS message.
 void setChatSession(ChatSession chatSession)
          Sets the chat session to associate to this chat panel.
 void setChatSubject(String subject)
          Sets the given subject to this chat.
 void setChatVisible(boolean isVisible)
          Brings the ChatWindow containing this ChatPanel to the front if isVisble is true; hides it, otherwise.
 void setContactName(ChatContact<?> chatContact, String name)
          Renames all occurrences of the given chatContact in this chat panel.
 void setDividerLocation(int location)
          Sets the location of the split pane divider.
 void setMessage(String message)
          Sets the given message as a message in the chat write area.
 void setSelectedChatTransport(ChatTransport chatTransport)
          Selects the given chat transport in the send via box.
 void setShown(boolean isShown)
          Marks this chat panel as shown or hidden.
 void setSmsSelected(boolean isSmsSelected)
          Changes the "Send as SMS" check box state.
 void showFontChooserDialog()
          Shows the font chooser dialog
 void statusChanged(FileTransferStatusChangeEvent event)
          Handles file transfer status changed in order to remove completed file transfers from the list of active transfers.
 void updateChatContactStatus(ChatContact<?> chatContact, String statusMessage)
          Updates the contact status.
 void updateChatTransportStatus(ChatTransport chatTransport)
          Updates the status of the given chat transport in the send via selector box and notifies the user for the status change.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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, paintComponent, 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

unreadMessageNumber

public int unreadMessageNumber

TYPING_NOTIFICATION_SUCCESSFULLY_SENT

public static final int TYPING_NOTIFICATION_SUCCESSFULLY_SENT
Indicates that a typing notification event is successfully sent.

See Also:
Constant Field Values

TYPING_NOTIFICATION_SEND_FAILED

public static final int TYPING_NOTIFICATION_SEND_FAILED
Indicates that sending a typing notification event has failed.

See Also:
Constant Field Values

MESSAGES_PER_PAGE

protected static final int MESSAGES_PER_PAGE
The number of messages shown per page.

See Also:
Constant Field Values

chatSession

public ChatSession chatSession
Constructor Detail

ChatPanel

public ChatPanel(ChatContainer chatContainer)
Creates a ChatPanel which is added to the given chat window.

Parameters:
chatContainer - The parent window of this chat panel.
Method Detail

setChatSession

public void setChatSession(ChatSession chatSession)
Sets the chat session to associate to this chat panel.

Parameters:
chatSession - the chat session to associate to this chat panel

getChatSession

public ChatSession getChatSession()
Returns the chat session associated with this chat panel.

Returns:
the chat session associated with this chat panel

dispose

public void dispose()
Runs clean-up for associated resources which need explicit disposal (e.g. listeners keeping this instance alive because they were added to the model which operationally outlives this instance).


getChatContainer

public ChatContainer getChatContainer()
Returns the chat window, where this chat panel is added.

Returns:
the chat window, where this chat panel is added

getConversationContainerWindow

public Window getConversationContainerWindow()
Returns the chat window, where this chat panel is located. Implements the ChatConversationContainer.getConversationContainerWindow() method.

Specified by:
getConversationContainerWindow in interface ChatConversationContainer
Returns:
ChatWindow The chat window, where this chat panel is located.

addTypingNotification

public void addTypingNotification(String typingNotification)
Adds a typing notification message to the conversation panel.

Specified by:
addTypingNotification in interface ChatConversationContainer
Parameters:
typingNotification - the typing notification to show

removeTypingNotification

public void removeTypingNotification()
Removes the typing notification message from the conversation panel.


getChatConversationPanel

public ChatConversationPanel getChatConversationPanel()
Returns the conversation panel, contained in this chat panel.

Returns:
the conversation panel, contained in this chat panel

getChatWritePanel

public ChatWritePanel getChatWritePanel()
Returns the write area panel, contained in this chat panel.

Returns:
the write area panel, contained in this chat panel

getRoleDescription

public String getRoleDescription(ChatRoomMemberRole role)
Returns the corresponding role description to the given role index.

Parameters:
role - to role index to analyse
Returns:
String the corresponding role description

memberRoleChanged

public void memberRoleChanged(ChatRoomMemberRoleChangeEvent evt)
Implements the memberRoleChanged() method.

Specified by:
memberRoleChanged in interface ChatRoomMemberRoleListener
Parameters:
evt -

localUserRoleChanged

public void localUserRoleChanged(ChatRoomLocalUserRoleChangeEvent evt)
Implements the localUserRoleChanged() method.

Specified by:
localUserRoleChanged in interface ChatRoomLocalUserRoleListener
Parameters:
evt -

requestFocusInWriteArea

public void requestFocusInWriteArea()
Requests the focus in the write message area.


isWriteAreaEmpty

public boolean isWriteAreaEmpty()
Checks if the editor contains text.

Returns:
TRUE if editor contains text, FALSE otherwise.

addMessage

public void addMessage(String contactName,
                       long date,
                       String messageType,
                       String message,
                       String contentType)
Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.

Specified by:
addMessage in interface Chat
Parameters:
contactName - the name of the contact sending the message
date - the time at which the message is sent or received
messageType - the type of the message. One of OUTGOING_MESSAGE or INCOMING_MESSAGE
message - the message text
contentType - the content type

addMessage

public void addMessage(String contactName,
                       String displayName,
                       long date,
                       String messageType,
                       String message,
                       String contentType)
Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.

Parameters:
contactName - the name of the contact sending the message
displayName - the display name of the contact
date - the time at which the message is sent or received
messageType - the type of the message. One of OUTGOING_MESSAGE or INCOMING_MESSAGE
message - the message text
contentType - the content type

addMessage

public void addMessage(String contactName,
                       long date,
                       String messageType,
                       String title,
                       String message,
                       String contentType)
Passes the message to the contained ChatConversationPanel for processing and appends it at the end of the conversationPanel document.

Parameters:
contactName - the name of the contact sending the message
date - the time at which the message is sent or received
messageType - the type of the message. One of OUTGOING_MESSAGE or INCOMING_MESSAGE
title - the title of the message
message - the message text
contentType - the content type

addErrorMessage

public void addErrorMessage(String contactName,
                            String message)
Adds the given error message to the chat window conversation area.

Parameters:
contactName - the name of the contact, for which the error occured
message - the error message

addErrorMessage

public void addErrorMessage(String contactName,
                            String title,
                            String message)
Adds the given error message to the chat window conversation area.

Parameters:
contactName - the name of the contact, for which the error occurred
title - the title of the error
message - the error message

refreshWriteArea

public void refreshWriteArea()
Refreshes write area editor pane. Deletes all existing text content.


addTextInWriteArea

public void addTextInWriteArea(String text)
Adds text to the write area editor.

Parameters:
text - The text to add.

getTextFromWriteArea

public String getTextFromWriteArea(String mimeType)
Returns the text contained in the write area editor.

Parameters:
mimeType - the mime type
Returns:
The text contained in the write area editor.

cut

public void cut()
Cuts the write area selected content to the clipboard.


copy

public void copy()
Copies either the selected write area content or the selected conversation panel content to the clipboard.


copyWriteArea

public void copyWriteArea()
Copies the selected write panel content to the clipboard.


paste

public void paste()
Pastes the content of the clipboard to the write area.


sendButtonDoClick

public void sendButtonDoClick()
Sends current write area content.


isShown

public boolean isShown()
Returns TRUE if this chat panel is added to a container (window or tabbed pane), which is shown on the screen, FALSE - otherwise.

Returns:
TRUE if this chat panel is added to a container (window or tabbed pane), which is shown on the screen, FALSE - otherwise

setShown

public void setShown(boolean isShown)
Marks this chat panel as shown or hidden.

Parameters:
isShown - TRUE to mark this chat panel as shown, FALSE - otherwise

setChatVisible

public void setChatVisible(boolean isVisible)
Brings the ChatWindow containing this ChatPanel to the front if isVisble is true; hides it, otherwise.

Specified by:
setChatVisible in interface Chat
Parameters:
isVisible - true to bring the ChatWindow of this ChatPanel to the front; false to close this ChatPanel

isChatFocused

public boolean isChatFocused()
Implements the Chat.isChatFocused method. Returns TRUE if this chat panel is the currently selected panel and if the chat window, where it's contained is active.

Specified by:
isChatFocused in interface Chat
Returns:
true if this chat panel has the focus and false otherwise.

addChatEditorKeyListener

public void addChatEditorKeyListener(KeyListener l)
Adds the given KeyListener to this Chat. The KeyListener is used to inform other bundles when a user has typed in the chat editor area.

Specified by:
addChatEditorKeyListener in interface Chat
Parameters:
l - the KeyListener to add

removeChatEditorKeyListener

public void removeChatEditorKeyListener(KeyListener l)
Removes the given KeyListener from this Chat. The KeyListener is used to inform other bundles when a user has typed in the chat editor area.

Specified by:
removeChatEditorKeyListener in interface Chat
Parameters:
l - the ChatFocusListener to remove

getMessage

public String getMessage()
Returns the message written by user in the chat write area.

Specified by:
getMessage in interface Chat
Returns:
the message written by user in the chat write area

setMessage

public void setMessage(String message)
Sets the given message as a message in the chat write area.

Specified by:
setMessage in interface Chat
Parameters:
message - the text that would be set to the chat write area

sendFile

public void sendFile(File file,
                     SendFileConversationComponent fileComponent)
Sends the given file through the currently selected chat transport by using the given fileComponent to visualize the transfer process in the chat conversation panel.

Parameters:
file - the file to send
fileComponent - the file component to use for visualization

sendFile

public void sendFile(File file)
Sends the given file through the currently selected chat transport.

Parameters:
file - the file to send

sendMessage

protected void sendMessage()
Sends the text contained in the write area as an SMS message or an instance message depending on the "send SMS" check box.


sendSmsMessage

public void sendSmsMessage()
Sends the text contained in the write area as an SMS message.


sendInstantMessage

protected void sendInstantMessage()
Implements the ChatPanel.sendMessage method. Obtains the appropriate operation set and sends the message, contained in the write area, through it.


getFirstHistoryMsgTimestamp

public long getFirstHistoryMsgTimestamp()
Returns the date of the first message in history for this chat.

Returns:
the date of the first message in history for this chat.

getLastHistoryMsgTimestamp

public long getLastHistoryMsgTimestamp()
Returns the date of the last message in history for this chat.

Returns:
the date of the last message in history for this chat.

loadHistory

public void loadHistory(String escapedMessageID)
Loads history messages ignoring the message with the specified id.

Parameters:
escapedMessageID - the id of the message to be ignored; null if no message is to be ignored

loadHistory

public void loadHistory()
Loads history for the chat meta contact in a separate thread. Equivalent to calling loadHistory(String) with null for escapedMessageID.


setSmsSelected

public void setSmsSelected(boolean isSmsSelected)
Changes the "Send as SMS" check box state.

Parameters:
isSmsSelected - true to set the "Send as SMS" check box selected, false - otherwise.

setContactName

public void setContactName(ChatContact<?> chatContact,
                           String name)
Renames all occurrences of the given chatContact in this chat panel.

Specified by:
setContactName in interface ChatSessionRenderer
Parameters:
chatContact - the contact to rename
name - the new name

addChatTransport

public void addChatTransport(ChatTransport chatTransport)
Adds the given chatTransport to the given send via selector box.

Specified by:
addChatTransport in interface ChatSessionRenderer
Parameters:
chatTransport - the transport to add

removeChatTransport

public void removeChatTransport(ChatTransport chatTransport)
Removes the given chat status state from the send via selector box.

Specified by:
removeChatTransport in interface ChatSessionRenderer
Parameters:
chatTransport - the transport to remove

setSelectedChatTransport

public void setSelectedChatTransport(ChatTransport chatTransport)
Selects the given chat transport in the send via box.

Parameters:
chatTransport - the chat transport to be selected

updateChatTransportStatus

public void updateChatTransportStatus(ChatTransport chatTransport)
Updates the status of the given chat transport in the send via selector box and notifies the user for the status change.

Specified by:
updateChatTransportStatus in interface ChatSessionRenderer
Parameters:
chatTransport - the chatTransport to update

loadPreviousPageFromHistory

public void loadPreviousPageFromHistory()
Implements ChatPanel.loadPreviousFromHistory. Loads previous page from history.


loadNextPageFromHistory

public void loadNextPageFromHistory()
Implements ChatPanel.loadNextFromHistory. Loads next page from history.


addChatContact

public void addChatContact(ChatContact<?> chatContact)
Adds the given chatContact to the list of chat contacts participating in the corresponding to this chat panel chat.

Specified by:
addChatContact in interface ChatSessionRenderer
Parameters:
chatContact - the contact to add

removeChatContact

public void removeChatContact(ChatContact<?> chatContact)
Removes the given chatContact from the list of chat contacts participating in the corresponding to this chat panel chat.

Specified by:
removeChatContact in interface ChatSessionRenderer
Parameters:
chatContact - the contact to remove

removeAllChatContacts

public void removeAllChatContacts()
Removes all chat contacts from the contact list of the chat.

Specified by:
removeAllChatContacts in interface ChatSessionRenderer

updateChatContactStatus

public void updateChatContactStatus(ChatContact<?> chatContact,
                                    String statusMessage)
Updates the contact status.

Specified by:
updateChatContactStatus in interface ChatSessionRenderer
Parameters:
chatContact - the chat contact to update
statusMessage - the status message to show

setChatSubject

public void setChatSubject(String subject)
Sets the given subject to this chat.

Specified by:
setChatSubject in interface ChatSessionRenderer
Parameters:
subject - the subject to set

addIncomingFileTransferRequest

public void addIncomingFileTransferRequest(OperationSetFileTransfer fileTransferOpSet,
                                           IncomingFileTransferRequest request,
                                           Date date)
Adds the given IncomingFileTransferRequest to the conversation panel in order to notify the user of the incoming file.

Parameters:
fileTransferOpSet - the file transfer operation set
request - the request to display in the conversation panel
date - the date on which the request has been received

addChatFocusListener

public void addChatFocusListener(ChatFocusListener listener)
Implements Chat.addChatFocusListener method. Adds the given ChatFocusListener to the list of listeners.

Specified by:
addChatFocusListener in interface Chat
Parameters:
listener - the listener that we'll be adding.

removeChatFocusListener

public void removeChatFocusListener(ChatFocusListener listener)
Implements Chat.removeChatFocusListener method. Removes the given ChatFocusListener from the list of listeners.

Specified by:
removeChatFocusListener in interface Chat
Parameters:
listener - the listener to remove.

findFileTransferChatTransport

public ChatTransport findFileTransferChatTransport()
Returns the first chat transport for the current chat session that supports file transfer.

Returns:
the first chat transport for the current chat session that supports file transfer.

findInviteChatTransport

public ChatTransport findInviteChatTransport()
Returns the first chat transport for the current chat session that supports group chat.

Returns:
the first chat transport for the current chat session that supports group chat.

inviteContacts

public void inviteContacts(ChatTransport inviteChatTransport,
                           Collection<String> chatContacts,
                           String reason)
Invites the given chatContacts to this chat.

Parameters:
inviteChatTransport - the chat transport to use to send the invite
chatContacts - the contacts to invite
reason - the reason of the invitation

fireChatFocusEvent

public void fireChatFocusEvent(int eventID)
Informs all ChatFocusListeners that a ChatFocusEvent has been triggered.

Parameters:
eventID - the type of the ChatFocusEvent

statusChanged

public void statusChanged(FileTransferStatusChangeEvent event)
Handles file transfer status changed in order to remove completed file transfers from the list of active transfers.

Specified by:
statusChanged in interface FileTransferStatusListener
Parameters:
event - the file transfer status change event the notified us for the change

containsActiveFileTransfers

public boolean containsActiveFileTransfers()
Returns true if there are active file transfers, otherwise returns false.

Returns:
true if there are active file transfers, otherwise returns false

cancelActiveFileTransfers

public void cancelActiveFileTransfers()
Cancels all active file transfers.


setDividerLocation

public void setDividerLocation(int location)
Sets the location of the split pane divider.

Parameters:
location - the location of the divider given by the pixel count between the left bottom corner and the left bottom divider location

getDividerLocation

public int getDividerLocation()
Returns the contained divider location.

Returns:
the contained divider location

getDividerSize

public int getDividerSize()
Returns the contained divider size.

Returns:
the contained divider size

addActiveFileTransfer

public void addActiveFileTransfer(String id,
                                  Object descriptor)
Adds the given file transfer id to the list of active file transfers.

Parameters:
id - the identifier of the file transfer to add
descriptor - the descriptor of the file transfer

removeActiveFileTransfer

public void removeActiveFileTransfer(String id)
Removes the given file transfer id from the list of active file transfers.

Parameters:
id - the identifier of the file transfer to remove

addChatEditorMenuListener

public void addChatEditorMenuListener(ChatMenuListener l)
Adds the given ChatMenuListener to this Chat. The ChatMenuListener is used to determine menu elements that should be added on right clicks.

Specified by:
addChatEditorMenuListener in interface Chat
Parameters:
l - the ChatMenuListener to add

addChatEditorCaretListener

public void addChatEditorCaretListener(CaretListener l)
Adds the given CaretListener to this Chat. The CaretListener is used to inform other bundles when a user has moved the caret in the chat editor area.

Specified by:
addChatEditorCaretListener in interface Chat
Parameters:
l - the CaretListener to add

addChatEditorDocumentListener

public void addChatEditorDocumentListener(DocumentListener l)
Adds the given DocumentListener to this Chat. The DocumentListener is used to inform other bundles when a user has modified the document in the chat editor area.

Specified by:
addChatEditorDocumentListener in interface Chat
Parameters:
l - the DocumentListener to add

removeChatEditorCaretListener

public void removeChatEditorCaretListener(CaretListener l)
Removes the given CaretListener from this Chat. The CaretListener is used to inform other bundles when a user has moved the caret in the chat editor area.

Specified by:
removeChatEditorCaretListener in interface Chat
Parameters:
l - the CaretListener to remove

removeChatEditorMenuListener

public void removeChatEditorMenuListener(ChatMenuListener l)
Removes the given ChatMenuListener to this Chat. The ChatMenuListener is used to determine menu elements that should be added on right clicks.

Specified by:
removeChatEditorMenuListener in interface Chat
Parameters:
l - the ChatMenuListener to add

removeChatEditorDocumentListener

public void removeChatEditorDocumentListener(DocumentListener l)
Removes the given DocumentListener from this Chat. The DocumentListener is used to inform other bundles when a user has modified the document in the chat editor area.

Specified by:
removeChatEditorDocumentListener in interface Chat
Parameters:
l - the DocumentListener to remove

addChatHistoryListener

public void addChatHistoryListener(ChatHistoryListener l)
Adds the given ChatHistoryListener to the list of listeners notified when a change occurs in the history shown in this chat panel.

Parameters:
l - the ChatHistoryListener to add

removeChatHistoryListener

public void removeChatHistoryListener(ChatHistoryListener l)
Removes the given ChatHistoryListener from the list of listeners notified when a change occurs in the history shown in this chat panel.

Parameters:
l - the ChatHistoryListener to remove

getHighlighter

public Highlighter getHighlighter()
Provides the Highlighter used in rendering the chat editor.

Specified by:
getHighlighter in interface Chat
Returns:
highlighter used to render message being composed

getCaretPosition

public int getCaretPosition()
Gets the caret position in the chat editor.

Specified by:
getCaretPosition in interface Chat
Returns:
index of caret in message being composed

promptRepaint

public void promptRepaint()
Causes the chat to validate its appearance (suggests a repaint operation may be necessary).

Specified by:
promptRepaint in interface Chat

showFontChooserDialog

public void showFontChooserDialog()
Shows the font chooser dialog


loadSkin

public void loadSkin()
Reloads chat messages.

Specified by:
loadSkin in interface Skinnable

chatRoomPropertyChanged

public void chatRoomPropertyChanged(ChatRoomMemberPropertyChangeEvent event)
Notifies the user if any member of the chatroom changes nickname.

Specified by:
chatRoomPropertyChanged in interface ChatRoomMemberPropertyChangeListener
Parameters:
event - a ChatRoomMemberPropertyChangeEvent which carries the specific of the change

addChatLinkClickedListener

public void addChatLinkClickedListener(ChatLinkClickedListener listener)
Add a new ChatLinkClickedListener

Specified by:
addChatLinkClickedListener in interface Chat
Parameters:
listener - ChatLinkClickedListener

removeChatLinkClickedListener

public void removeChatLinkClickedListener(ChatLinkClickedListener listener)
Remove existing ChatLinkClickedListener

Specified by:
removeChatLinkClickedListener in interface Chat
Parameters:
listener - ChatLinkClickedListener

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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