com.jivesoftware.spark.ui.rooms
Class ChatRoomImpl

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.jivesoftware.spark.component.BackgroundPanel
                      extended bycom.jivesoftware.spark.ui.ChatRoom
                          extended bycom.jivesoftware.spark.ui.rooms.ChatRoomImpl
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, javax.swing.event.DocumentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, org.jivesoftware.smack.PacketListener, java.io.Serializable

public class ChatRoomImpl
extends ChatRoom

This is the Agent to Agent implementation of ChatRoom This room only allows for 1 to 1 conversations.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.jivesoftware.spark.ui.ChatRoom
ChatRoom.ChatToolBar
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
ChatRoomImpl(java.lang.String participantJID, java.lang.String participantNickname, java.lang.String title)
          Constructs a 1-to-1 ChatRoom.
 
Method Summary
 void addMessageEventListener(MessageEventListener listener)
           
 void closeChatRoom()
          Close the ChatRoom.
 void fireOutgoingMessageSending(org.jivesoftware.smack.packet.Message message)
           
 void fireReceivingIncomingMessage(org.jivesoftware.smack.packet.Message message)
           
 org.jivesoftware.smack.packet.Message.Type getChatType()
          Returns the Message.Type specific to this chat room.
 java.lang.String getJID()
          Returns the users full jid (ex.
 java.util.Collection getMessageEventListeners()
           
 java.lang.String getParticipantJID()
           
 java.lang.String getParticipantNickname()
          Returns the nickname of the user chatting with.
 java.lang.String getRoomname()
          Get the roomname to use for this ChatRoom.
 java.lang.String getRoomTitle()
          Returns the title of this room to use.
 javax.swing.Icon getTabIcon()
          Get the Icon to be used in the tab holding this ChatRoom.
 java.lang.String getTabTitle()
          Get the title to use in the tab holding this ChatRoom.
 void insertMessage(org.jivesoftware.smack.packet.Message message)
          The main entry point when receiving any messages.
 void insertUpdate(javax.swing.event.DocumentEvent e)
          The current SendField has been updated somehow.
 boolean isActive()
          Returns whether or not this ChatRoom is active.
 void leaveChatRoom()
          Disable the chat room.
 void processPacket(org.jivesoftware.smack.packet.Packet packet)
          Process incoming packets.
 void removeMessageEventListener(MessageEventListener listener)
           
 void sendMessage()
          Creates and sends a message object from the text in the Send Field, using the default nickname specified in your Chat Preferences.
 void sendMessage(org.jivesoftware.smack.packet.Message message)
          Sends a message to the appropriate jid.
 void sendMessage(java.lang.String text)
          Creates a Message object from the given text and delegates to the room for sending.
 
Methods inherited from class com.jivesoftware.spark.ui.ChatRoom
actionPerformed, addClosingListener, addFileDropListener, addMessageListener, addPacketID, addToTranscript, changedUpdate, checkForText, clearUnreadMessageCount, disableToolbar, enableToolbar, fireFileDropListeners, fireMessageSent, getBottomPanel, getChatInputEditor, getChatPanel, getChatRoom, getChatWindowPanel, getEditorBar, getNickname, getNotificationLabel, getSendFieldToolbar, getSplitPane, getToolBar, getTranscripts, getTranscriptWindow, getUnreadMessageCount, increaseUnreadMessageCount, packetIDExists, positionCursor, removeClosingListener, removeFileDropListener, removeMessageListener, removeUpdate, saveTranscript, scrollToBottom
 
Methods inherited from class com.jivesoftware.spark.component.BackgroundPanel
paintComponent, setBackgroundImage
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

ChatRoomImpl

public ChatRoomImpl(java.lang.String participantJID,
                    java.lang.String participantNickname,
                    java.lang.String title)
Constructs a 1-to-1 ChatRoom.

Parameters:
participantJID - the participants jid to chat with.
participantNickname - the nickname of the participant.
title - the title of the room.
Method Detail

closeChatRoom

public void closeChatRoom()
Description copied from class: ChatRoom
Close the ChatRoom.

Overrides:
closeChatRoom in class ChatRoom

sendMessage

public void sendMessage()
Description copied from class: ChatRoom
Creates and sends a message object from the text in the Send Field, using the default nickname specified in your Chat Preferences.

Specified by:
sendMessage in class ChatRoom

sendMessage

public void sendMessage(java.lang.String text)
Description copied from class: ChatRoom
Creates a Message object from the given text and delegates to the room for sending.

Specified by:
sendMessage in class ChatRoom
Parameters:
text - the text to send.

sendMessage

public void sendMessage(org.jivesoftware.smack.packet.Message message)
Sends a message to the appropriate jid. The message is automatically added to the transcript.

Specified by:
sendMessage in class ChatRoom
Parameters:
message - the message to send.

getRoomname

public java.lang.String getRoomname()
Description copied from class: ChatRoom
Get the roomname to use for this ChatRoom.

Specified by:
getRoomname in class ChatRoom
Returns:
- the Roomname of this ChatRoom.

getTabIcon

public javax.swing.Icon getTabIcon()
Description copied from class: ChatRoom
Get the Icon to be used in the tab holding this ChatRoom.

Specified by:
getTabIcon in class ChatRoom
Returns:
- Icon to use

getTabTitle

public java.lang.String getTabTitle()
Description copied from class: ChatRoom
Get the title to use in the tab holding this ChatRoom.

Specified by:
getTabTitle in class ChatRoom
Returns:
- the title to use.

getRoomTitle

public java.lang.String getRoomTitle()
Description copied from class: ChatRoom
Returns the title of this room to use. The title will be used in the title bar of the ChatRoom.

Specified by:
getRoomTitle in class ChatRoom
Returns:
- the title of this ChatRoom.

getChatType

public org.jivesoftware.smack.packet.Message.Type getChatType()
Description copied from class: ChatRoom
Returns the Message.Type specific to this chat room. GroupChat is Message.Type.GROUP_CHAT Normal Chat is Message.TYPE.NORMAL

Specified by:
getChatType in class ChatRoom
Returns:
the ChatRooms Message.TYPE

leaveChatRoom

public void leaveChatRoom()
Description copied from class: ChatRoom
Disable the chat room. This is called when a chat has been either transfered over or the customer has left the chat room.

Specified by:
leaveChatRoom in class ChatRoom

isActive

public boolean isActive()
Description copied from class: ChatRoom
Returns whether or not this ChatRoom is active. Note: carrying a conversation rather than being disabled, as it would be transcript mode.

Specified by:
isActive in class ChatRoom
Returns:
true if the chat room is active.

getParticipantJID

public java.lang.String getParticipantJID()

getJID

public java.lang.String getJID()
Returns the users full jid (ex. macbeth@jivesoftware.com/spark).

Returns:
the users Full JID.

processPacket

public void processPacket(org.jivesoftware.smack.packet.Packet packet)
Process incoming packets.

Specified by:
processPacket in interface org.jivesoftware.smack.PacketListener
Overrides:
processPacket in class ChatRoom
Parameters:
packet - - the packet to process

getParticipantNickname

public java.lang.String getParticipantNickname()
Returns the nickname of the user chatting with.

Returns:
the nickname of the chatting user.

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
The current SendField has been updated somehow.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
Overrides:
insertUpdate in class ChatRoom
Parameters:
e - - the DocumentEvent to respond to.

insertMessage

public void insertMessage(org.jivesoftware.smack.packet.Message message)
Description copied from class: ChatRoom
The main entry point when receiving any messages. This will either handle a message from a customer or delegate itself as an agent handler.

Overrides:
insertMessage in class ChatRoom
Parameters:
message - - the message receieved.

addMessageEventListener

public void addMessageEventListener(MessageEventListener listener)

removeMessageEventListener

public void removeMessageEventListener(MessageEventListener listener)

getMessageEventListeners

public java.util.Collection getMessageEventListeners()

fireOutgoingMessageSending

public void fireOutgoingMessageSending(org.jivesoftware.smack.packet.Message message)

fireReceivingIncomingMessage

public void fireReceivingIncomingMessage(org.jivesoftware.smack.packet.Message message)