public class ChatRoomImpl extends ChatRoom
ChatRoom
This room only allows for 1 to 1 conversations.ChatRoom.ChatToolBar
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ChatRoomImpl(java.lang.String participantJID,
java.lang.String participantNickname,
java.lang.String title) |
ChatRoomImpl(java.lang.String participantJID,
java.lang.String participantNickname,
java.lang.String title,
boolean initUi)
Constructs a 1-to-1 ChatRoom.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
addMessageEventListener(MessageEventListener listener) |
void |
authenticated(org.jivesoftware.smack.XMPPConnection xmppConnection,
boolean b) |
void |
closeChatRoom()
Close the ChatRoom.
|
void |
connected(org.jivesoftware.smack.XMPPConnection xmppConnection) |
void |
connectionClosed() |
void |
connectionClosedOnError(java.lang.Exception ex) |
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.
|
long |
getLastActivity()
The last time this chat room sent or received a message.
|
java.util.Collection<MessageEventListener> |
getMessageEventListeners() |
java.lang.String |
getParticipantJID()
Returns the Bare-Participant JID
user@server.com
for retrieving the full Jid use ChatRoomImpl.getJID() |
java.lang.String |
getParticipantNickname()
Returns the nickname of the user chatting with.
|
org.jivesoftware.smack.packet.Presence |
getPresence()
Returns the current presence of the client this room was created for.
|
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.
|
protected void |
loadHistory() |
void |
notifyChatStateChange(org.jivesoftware.smackx.chatstates.ChatState state) |
void |
processPacket(org.jivesoftware.smack.packet.Stanza stanza)
Process incoming packets.
|
void |
reconnectionSuccessful() |
protected void |
removeListeners() |
void |
removeMessageEventListener(MessageEventListener listener) |
protected void |
sendChatState(org.jivesoftware.smackx.chatstates.ChatState state)
Sends a chat state to all peers.
|
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.
|
void |
setRoomTitle(java.lang.String roomTitle) |
void |
setTabIcon(javax.swing.Icon icon) |
void |
setTabTitle(java.lang.String tabTitle) |
void |
showTyping(boolean typing)
Show the typing notification.
|
addChatRoomButton, addChatRoomButton, addChatRoomComponent, addClosingListener, addControllerButton, addEditorComponent, addFileDropListener, addMessageListener, addPacketID, addToolbar, addToTranscript, addToTranscript, changedUpdate, checkForText, clearUnreadMessageCount, createChatStateTimerTask, disableToolbar, enableToolbar, fireFileDropListeners, fireMessageSent, focusGained, focusLost, getBottomPanel, getChatAreaInsets, getChatInputEditor, getChatPanel, getChatPanelInsets, getChatRoom, getChatWindowPanel, getEditorBar, getEditorBarLeft, getEditorBarRight, getEditorWrapperBar, getEditorWrapperInsets, getNickname, getNotificationLabel, getRoomControllerBar, getScrollPaneForTranscriptWindow, getSendButton, getSplitPane, getTextScroller, getToolBar, getTranscripts, getTranscriptWindow, getUnreadMessageCount, getVerticalSlipPane, handleDefaultAction, hideToolbar, increaseUnreadMessageCount, packetIDExists, poppingDown, poppingUp, positionCursor, reconnectingIn, reconnectionFailed, registeredToFrame, removeClosingListener, removeEditorComponent, removeFileDropListener, removeMessageListener, removeUpdate, saveTranscript, scrollToBottom, setChatState, showToolbar, updateStatus
paintComponent
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public ChatRoomImpl(java.lang.String participantJID, java.lang.String participantNickname, java.lang.String title)
public ChatRoomImpl(java.lang.String participantJID, java.lang.String participantNickname, java.lang.String title, boolean initUi)
participantJID
- the participants jid to chat with.participantNickname
- the nickname of the participant.title
- the title of the room.public void closeChatRoom()
ChatRoom
closeChatRoom
in class ChatRoom
protected void removeListeners()
public void sendMessage()
ChatRoom
sendMessage
in class ChatRoom
public void sendMessage(java.lang.String text)
ChatRoom
sendMessage
in class ChatRoom
text
- the text to send.public void sendMessage(org.jivesoftware.smack.packet.Message message)
sendMessage
in class ChatRoom
message
- the message to send.public java.lang.String getRoomname()
ChatRoom
getRoomname
in class ChatRoom
public javax.swing.Icon getTabIcon()
ChatRoom
Icon
to be used in the tab holding
this ChatRoom.getTabIcon
in class ChatRoom
Icon
to usepublic void setTabIcon(javax.swing.Icon icon)
public java.lang.String getTabTitle()
ChatRoom
getTabTitle
in class ChatRoom
public void setTabTitle(java.lang.String tabTitle)
public void setRoomTitle(java.lang.String roomTitle)
public java.lang.String getRoomTitle()
ChatRoom
getRoomTitle
in class ChatRoom
public org.jivesoftware.smack.packet.Message.Type getChatType()
ChatRoom
Message.Type
specific to this
chat room.
GroupChat is Message.Type.groupchat
Normal Chat is Message.TYPE.NORMALgetChatType
in class ChatRoom
public void leaveChatRoom()
ChatRoom
leaveChatRoom
in class ChatRoom
public boolean isActive()
ChatRoom
public java.lang.String getParticipantJID()
public java.lang.String getJID()
public void processPacket(org.jivesoftware.smack.packet.Stanza stanza)
processPacket
in interface org.jivesoftware.smack.StanzaListener
processPacket
in class ChatRoom
stanza
- - the packet to processpublic java.lang.String getParticipantNickname()
public void insertUpdate(javax.swing.event.DocumentEvent e)
insertUpdate
in interface javax.swing.event.DocumentListener
insertUpdate
in class ChatRoom
e
- - the DocumentEvent to respond to.public void insertMessage(org.jivesoftware.smack.packet.Message message)
ChatRoom
insertMessage
in class ChatRoom
message
- - the message receieved.public void addMessageEventListener(MessageEventListener listener)
public void removeMessageEventListener(MessageEventListener listener)
public java.util.Collection<MessageEventListener> getMessageEventListeners()
public void fireOutgoingMessageSending(org.jivesoftware.smack.packet.Message message)
public void fireReceivingIncomingMessage(org.jivesoftware.smack.packet.Message message)
public void showTyping(boolean typing)
typing
- true if the typing notification should show, otherwise hide it.public long getLastActivity()
getLastActivity
in class ChatRoom
public org.jivesoftware.smack.packet.Presence getPresence()
public void connected(org.jivesoftware.smack.XMPPConnection xmppConnection)
public void authenticated(org.jivesoftware.smack.XMPPConnection xmppConnection, boolean b)
public void connectionClosed()
connectionClosed
in interface org.jivesoftware.smack.ConnectionListener
connectionClosed
in class ChatRoom
public void connectionClosedOnError(java.lang.Exception ex)
connectionClosedOnError
in interface org.jivesoftware.smack.ConnectionListener
connectionClosedOnError
in class ChatRoom
public void reconnectionSuccessful()
reconnectionSuccessful
in interface org.jivesoftware.smack.ConnectionListener
reconnectionSuccessful
in class ChatRoom
protected void loadHistory()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class ChatRoom
public void notifyChatStateChange(org.jivesoftware.smackx.chatstates.ChatState state)
protected void sendChatState(org.jivesoftware.smackx.chatstates.ChatState state) throws org.jivesoftware.smack.SmackException.NotConnectedException
ChatRoom
sendChatState
in class ChatRoom
state
- the chat state.org.jivesoftware.smack.SmackException.NotConnectedException