org.jivesoftware.spark.ui.rooms
Class GroupChatRoom

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 org.jivesoftware.spark.component.BackgroundPanel
                      extended by org.jivesoftware.spark.ui.ChatRoom
                          extended by org.jivesoftware.spark.ui.rooms.GroupChatRoom
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.DocumentListener, org.jivesoftware.smack.ConnectionListener, org.jivesoftware.smack.PacketListener

public final class GroupChatRoom
extends ChatRoom

GroupChatRoom is the conference chat room UI used to have Multi-User Chats.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jivesoftware.spark.ui.ChatRoom
ChatRoom.ChatToolBar
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces 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
GroupChatRoom(org.jivesoftware.smackx.muc.MultiUserChat chat)
          Creates a GroupChatRoom from a MultiUserChat.
 
Method Summary
 void addBlockedUser(java.lang.String usersJID)
          Adds a user to the blocked user list.
 void closeChatRoom()
          Have the user leave this chat room and then close it.
 void connectionClosed()
           
 void connectionClosedOnError(java.lang.Exception ex)
           
 org.jivesoftware.smack.packet.Message.Type getChatType()
          Return the type of chat we are in.
 ConferenceRoomInfo getConferenceRoomInfo()
           
 java.lang.String getConferenceService()
          Returns the conference service associated with this Conference Chat.
 long getLastActivity()
          Implementation of this method should return the last time this chat room sent or recieved a message.
 org.jivesoftware.smackx.muc.MultiUserChat getMultiUserChat()
          Returns a MultiUserChat object associated with this room.
 java.lang.String getNickname()
          Retrieve the nickname of the user in this groupchat.
 org.jivesoftware.smack.filter.PacketFilter getPacketFilter()
          Returns the ChatFilter.
 int getParticipantCount()
          Returns the number of participants in this room.
 java.util.Collection getParticipants()
          Returns the user format (e.g.
 java.lang.String getRoomname()
          Return name of the room specified when the room was created.
 java.lang.String getRoomTitle()
          Return the title of this room.
 javax.swing.Icon getTabIcon()
          Return the Icon that should be used in the tab of this GroupChat Pane.
 java.lang.String getTabTitle()
          Return the title that should be used in the tab.
 void hideParticipantList()
          Call this method if you wish to hide the participant list.
 void insertText(java.lang.String text)
          Inserts a notification message within the TranscriptWindow.
 void insertUpdate(javax.swing.event.DocumentEvent e)
          The current SendField has been updated somehow.
 void inviteUser(java.lang.String jid, java.lang.String message)
           
 boolean isActive()
          Returns whether or not this ChatRoom is active.
 boolean isBlocked(java.lang.String usersJID)
          Returns true if the user is in the blocked user list.
 void leaveChatRoom()
          Implementation of leaveChatRoom.
 void processPacket(org.jivesoftware.smack.packet.Packet packet)
          Implementation of processPacket to handle muc related packets.
 void removeBlockedUser(java.lang.String usersJID)
          Removes a user from the blocked user list.
 void sendMessage()
          Sends the message that is currently in the send field.
 void sendMessage(org.jivesoftware.smack.packet.Message message)
          Sends a message.
 void sendMessage(java.lang.String text)
          Creates a Message object from the given text and delegates to the room for sending.
 void sendMessageWithoutNotification(org.jivesoftware.smack.packet.Message message)
          Sends a message.
 void setSendAndReceiveTypingNotifications(boolean sendAndReceiveTypingNotifications)
          Specifies whether to use typing notifications or not.
 void setTabIcon(javax.swing.Icon tabIcon)
          Sets the icon to use on the tab.
 void setTabTitle(java.lang.String tabTitle)
          Sets the title to use on the tab describing the Conference room.
 void showPresenceMessages(boolean showMessages)
          If true, will display all presence messages.
 
Methods inherited from class org.jivesoftware.spark.ui.ChatRoom
actionPerformed, addClosingListener, addFileDropListener, addMessageListener, addPacketID, addToTranscript, changedUpdate, checkForText, clearUnreadMessageCount, disableToolbar, enableToolbar, fireFileDropListeners, fireMessageSent, getBottomPanel, getChatInputEditor, getChatPanel, getChatRoom, getChatWindowPanel, getEditorBar, getNotificationLabel, getScrollPaneForTranscriptWindow, getSendButton, getSendFieldToolbar, getSplitPane, getToolBar, getTranscripts, getTranscriptWindow, getUnreadMessageCount, getVerticalSlipPane, increaseUnreadMessageCount, insertMessage, packetIDExists, positionCursor, reconnectingIn, reconnectionFailed, reconnectionSuccessful, removeClosingListener, removeFileDropListener, removeMessageListener, removeUpdate, saveTranscript, scrollToBottom
 
Methods inherited from class org.jivesoftware.spark.component.BackgroundPanel
paintComponent
 
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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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
 

Constructor Detail

GroupChatRoom

public GroupChatRoom(org.jivesoftware.smackx.muc.MultiUserChat chat)
Creates a GroupChatRoom from a MultiUserChat.

Parameters:
chat - the MultiUserChat to create a GroupChatRoom from.
Method Detail

setTabTitle

public void setTabTitle(java.lang.String tabTitle)
Sets the title to use on the tab describing the Conference room.

Parameters:
tabTitle - the title to use on the tab.

hideParticipantList

public void hideParticipantList()
Call this method if you wish to hide the participant list.


closeChatRoom

public void closeChatRoom()
Have the user leave this chat room and then close it.

Overrides:
closeChatRoom in class ChatRoom

sendMessage

public void sendMessage(org.jivesoftware.smack.packet.Message message)
Sends a message.

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

sendMessageWithoutNotification

public void sendMessageWithoutNotification(org.jivesoftware.smack.packet.Message message)
Sends a message.

Parameters:
message - - the message to send.

getRoomname

public java.lang.String getRoomname()
Return name of the room specified when the room was created.

Specified by:
getRoomname in class ChatRoom
Returns:
the roomname.

getNickname

public java.lang.String getNickname()
Retrieve the nickname of the user in this groupchat.

Overrides:
getNickname in class ChatRoom
Returns:
the nickname of the agent in this groupchat

getPacketFilter

public org.jivesoftware.smack.filter.PacketFilter getPacketFilter()
Returns the ChatFilter.

Returns:
the chatfilter for this groupchat.

setTabIcon

public void setTabIcon(javax.swing.Icon tabIcon)
Sets the icon to use on the tab.

Parameters:
tabIcon - the icon to use on the tab.

getTabIcon

public javax.swing.Icon getTabIcon()
Return the Icon that should be used in the tab of this GroupChat Pane.

Specified by:
getTabIcon in class ChatRoom
Returns:
the Icon to use in tab.

getTabTitle

public java.lang.String getTabTitle()
Return the title that should be used in the tab.

Specified by:
getTabTitle in class ChatRoom
Returns:
the title to be used on the tab.

getRoomTitle

public java.lang.String getRoomTitle()
Return the title of this room.

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

getChatType

public org.jivesoftware.smack.packet.Message.Type getChatType()
Return the type of chat we are in.

Specified by:
getChatType in class ChatRoom
Returns:
the type of chat we are in.

leaveChatRoom

public void leaveChatRoom()
Implementation of leaveChatRoom.

Specified by:
leaveChatRoom in class ChatRoom

showPresenceMessages

public void showPresenceMessages(boolean showMessages)
If true, will display all presence messages. Set to false to turn off presence notifications.

Parameters:
showMessages - true to display presence messages, otherwise false.

isActive

public boolean isActive()
Returns whether or not this ChatRoom is active. To be active means to have the agent still engaged in a conversation with a customer.

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

getParticipantCount

public int getParticipantCount()
Returns the number of participants in this room.

Returns:
the number of participants in this room.

processPacket

public void processPacket(org.jivesoftware.smack.packet.Packet packet)
Implementation of processPacket to handle muc related packets.

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

insertText

public void insertText(java.lang.String text)
Inserts a notification message within the TranscriptWindow.

Parameters:
text - the text to insert.

getParticipants

public java.util.Collection getParticipants()
Returns the user format (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch) of each user in the room.

Returns:
the user format (e.g. darkcave@macbeth.shakespeare.lit/thirdwitch) of each user in the room.

sendMessage

public void sendMessage()
Sends the message that is currently in the send field. The message is automatically added to the transcript for later retrieval.

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.

getMultiUserChat

public org.jivesoftware.smackx.muc.MultiUserChat getMultiUserChat()
Returns a MultiUserChat object associated with this room.

Returns:
the MultiUserChat object associated with this room.

getConferenceService

public java.lang.String getConferenceService()
Returns the conference service associated with this Conference Chat.

Returns:
the conference service associated with this Conference Chat.

addBlockedUser

public void addBlockedUser(java.lang.String usersJID)
Adds a user to the blocked user list. Blocked users is NOT a MUC related item, but rather used by the client to not display messages from certain people.

Parameters:
usersJID - the room jid of the user (ex.spark@conference.jivesoftware.com/Dan)

removeBlockedUser

public void removeBlockedUser(java.lang.String usersJID)
Removes a user from the blocked user list.

Parameters:
usersJID - the jid of the user (ex. spark@conference.jivesoftware.com/Dan)

isBlocked

public boolean isBlocked(java.lang.String usersJID)
Returns true if the user is in the blocked user list.

Parameters:
usersJID - the jid of the user (ex. spark@conference.jivesoftware.com/Dan)
Returns:
true if the user is blocked, otherwise false.

setSendAndReceiveTypingNotifications

public void setSendAndReceiveTypingNotifications(boolean sendAndReceiveTypingNotifications)
Specifies whether to use typing notifications or not. By default, group chat rooms will NOT use typing notifications.

Parameters:
sendAndReceiveTypingNotifications - true to use typing notifications.

inviteUser

public void inviteUser(java.lang.String jid,
                       java.lang.String message)

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.

getConferenceRoomInfo

public ConferenceRoomInfo getConferenceRoomInfo()

getLastActivity

public long getLastActivity()
Description copied from class: ChatRoom
Implementation of this method should return the last time this chat room sent or recieved a message.

Specified by:
getLastActivity in class ChatRoom
Returns:
the last time (in system milliseconds) that the room last recieved a message.

connectionClosed

public void connectionClosed()
Specified by:
connectionClosed in interface org.jivesoftware.smack.ConnectionListener
Overrides:
connectionClosed in class ChatRoom

connectionClosedOnError

public void connectionClosedOnError(java.lang.Exception ex)
Specified by:
connectionClosedOnError in interface org.jivesoftware.smack.ConnectionListener
Overrides:
connectionClosedOnError in class ChatRoom