|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel org.jivesoftware.spark.component.BackgroundPanel org.jivesoftware.spark.ui.ChatRoom
public abstract class ChatRoom
The base implementation of all ChatRoom conversations. You would implement this class to have most types of Chat.
Nested Class Summary | |
---|---|
class |
ChatRoom.ChatToolBar
Used for the top toolbar. |
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 | |
---|---|
protected |
ChatRoom()
Initializes the base layout and base background color. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
void |
addClosingListener(ChatRoomClosingListener listener)
|
void |
addFileDropListener(FileDropListener listener)
Adds a new FileDropListener to allow for Drag and Drop notifications
of objects onto the ChatWindow. |
void |
addMessageListener(MessageListener listener)
Add a MessageListener to the current ChatRoom. |
void |
addPacketID(java.lang.String packetID)
Adds a packetID to the packedIDList. |
void |
addToTranscript(org.jivesoftware.smack.packet.Message message,
boolean updateDate)
Add a ChatResponse to the current discussion chat area. |
void |
changedUpdate(javax.swing.event.DocumentEvent docEvent)
Checks to see if the Send button should be enabled. |
protected void |
checkForText(javax.swing.event.DocumentEvent e)
Checks to see if the Send button should be enabled. |
void |
clearUnreadMessageCount()
Resets the number of unread messages. |
void |
closeChatRoom()
Close the ChatRoom. |
void |
connectionClosed()
|
void |
connectionClosedOnError(java.lang.Exception e)
|
void |
disableToolbar()
Disables the ChatRoom toolbar. |
void |
enableToolbar()
Enable the ChatRoom toolbar. |
void |
fireFileDropListeners(java.util.Collection files)
Notify all users that a collection of files has been dropped onto the ChatRoom. |
protected void |
fireMessageSent(org.jivesoftware.smack.packet.Message message)
|
javax.swing.JPanel |
getBottomPanel()
Returns the bottom panel used in the ChatRoom. |
ChatInputEditor |
getChatInputEditor()
Returns the SendField component. |
javax.swing.JPanel |
getChatPanel()
Returns the ChatPanel that contains the ChatWindow and SendField. |
ChatRoom |
getChatRoom()
Returns this instance of the chatroom. |
abstract org.jivesoftware.smack.packet.Message.Type |
getChatType()
Returns the Message.Type specific to this
chat room. |
javax.swing.JPanel |
getChatWindowPanel()
Returns the Container which holds the ChatWindow. |
javax.swing.JPanel |
getEditorBar()
Returns the panel which contains the toolbar items, such as spell checker. |
abstract long |
getLastActivity()
Implementation of this method should return the last time this chat room sent or recieved a message. |
java.lang.String |
getNickname()
Returns the nickname of the current agent as specified in Chat Preferences. |
javax.swing.JLabel |
getNotificationLabel()
Returns the notification label. |
abstract java.lang.String |
getRoomname()
Get the roomname to use for this ChatRoom. |
abstract java.lang.String |
getRoomTitle()
Returns the title of this room to use. |
javax.swing.JScrollPane |
getScrollPaneForTranscriptWindow()
|
javax.swing.JButton |
getSendButton()
Return the "Send" button. |
javax.swing.JPanel |
getSendFieldToolbar()
Returns the button panel. |
javax.swing.JSplitPane |
getSplitPane()
Return the splitpane used in this chat room. |
abstract javax.swing.Icon |
getTabIcon()
Get the Icon to be used in the tab holding
this ChatRoom. |
abstract java.lang.String |
getTabTitle()
Get the title to use in the tab holding this ChatRoom. |
ChatRoom.ChatToolBar |
getToolBar()
Returns the toolbar used on top of the chat room. |
java.util.List |
getTranscripts()
Returns a map of the current Chat Transcript which is a list of all ChatResponses and their order. |
TranscriptWindow |
getTranscriptWindow()
Returns the chatWindow components. |
int |
getUnreadMessageCount()
Returns the number of unread messages in this ChatRoom. |
javax.swing.JSplitPane |
getVerticalSlipPane()
|
void |
increaseUnreadMessageCount()
Increases the number of unread messages by 1. |
void |
insertMessage(org.jivesoftware.smack.packet.Message message)
The main entry point when receiving any messages. |
void |
insertUpdate(javax.swing.event.DocumentEvent e)
|
abstract boolean |
isActive()
Returns whether or not this ChatRoom is active. |
abstract void |
leaveChatRoom()
Disable the chat room. |
boolean |
packetIDExists(java.lang.String packetID)
Checks if the packetID has already been used. |
void |
positionCursor()
Requests valid focus to the SendField. |
void |
processPacket(org.jivesoftware.smack.packet.Packet packet)
Process incoming packets. |
void |
reconnectingIn(int seconds)
|
void |
reconnectionFailed(java.lang.Exception e)
|
void |
reconnectionSuccessful()
|
void |
removeClosingListener(ChatRoomClosingListener listener)
|
void |
removeFileDropListener(FileDropListener listener)
Remove the FileDropListener from ChatRoom. |
void |
removeMessageListener(MessageListener listener)
Remove the specified MessageListener from the current ChatRoom. |
void |
removeUpdate(javax.swing.event.DocumentEvent event)
Checks to see if the Send Button should be enabled depending on the current update in SendField. |
void |
saveTranscript()
Override to save transcript in preferred room style. |
void |
scrollToBottom()
Scrolls the chat window to the bottom. |
protected abstract void |
sendMessage()
Creates and sends a message object from the text in the Send Field, using the default nickname specified in your Chat Preferences. |
abstract void |
sendMessage(org.jivesoftware.smack.packet.Message message)
Sends the current message. |
protected abstract 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 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 |
---|
protected ChatRoom()
Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected abstract void sendMessage()
protected abstract void sendMessage(java.lang.String text)
text
- the text to send.public abstract void sendMessage(org.jivesoftware.smack.packet.Message message)
message
- - the message to send.public java.lang.String getNickname()
public void insertMessage(org.jivesoftware.smack.packet.Message message)
message
- - the message receieved.public void addToTranscript(org.jivesoftware.smack.packet.Message message, boolean updateDate)
ChatResponse to the current discussion chat area.
- Parameters:
message
- the message to add to the transcript listupdateDate
- true if you wish the date label to be updated with the
date and time the message was received.
public void scrollToBottom()
protected void checkForText(javax.swing.event.DocumentEvent e)
e
- - the documentevent to react to.public void positionCursor()
public abstract void leaveChatRoom()
public void processPacket(org.jivesoftware.smack.packet.Packet packet)
processPacket
in interface org.jivesoftware.smack.PacketListener
packet
- - the packet to processpublic ChatInputEditor getChatInputEditor()
public TranscriptWindow getTranscriptWindow()
public void addMessageListener(MessageListener listener)
MessageListener
to the current ChatRoom.
listener
- - the MessageListener to add to the current ChatRoom.public void removeMessageListener(MessageListener listener)
MessageListener
from the current ChatRoom.
listener
- - the MessageListener to remove from the current ChatRoom.protected void fireMessageSent(org.jivesoftware.smack.packet.Message message)
public java.util.List getTranscripts()
public void disableToolbar()
public void enableToolbar()
public void removeUpdate(javax.swing.event.DocumentEvent event)
removeUpdate
in interface javax.swing.event.DocumentListener
event
- the DocumentEvent from the sendField.public void changedUpdate(javax.swing.event.DocumentEvent docEvent)
changedUpdate
in interface javax.swing.event.DocumentListener
docEvent
- the document event.public javax.swing.JSplitPane getSplitPane()
public javax.swing.JPanel getChatPanel()
public void closeChatRoom()
public abstract javax.swing.Icon getTabIcon()
Icon
to be used in the tab holding
this ChatRoom.
Icon
to usepublic abstract java.lang.String getRoomname()
public abstract java.lang.String getTabTitle()
public abstract java.lang.String getRoomTitle()
public abstract org.jivesoftware.smack.packet.Message.Type getChatType()
Message.Type
specific to this
chat room.
GroupChat is Message.Type.GROUP_CHAT
Normal Chat is Message.TYPE.NORMAL
public abstract boolean isActive()
public javax.swing.JLabel getNotificationLabel()
public void addPacketID(java.lang.String packetID)
packetID
- the packetID to add.public boolean packetIDExists(java.lang.String packetID)
packetID
- the packetID to check for.
public ChatRoom getChatRoom()
public ChatRoom.ChatToolBar getToolBar()
public void insertUpdate(javax.swing.event.DocumentEvent e)
insertUpdate
in interface javax.swing.event.DocumentListener
public void saveTranscript()
public javax.swing.JPanel getSendFieldToolbar()
public int getUnreadMessageCount()
public void increaseUnreadMessageCount()
public void clearUnreadMessageCount()
public javax.swing.JPanel getBottomPanel()
public javax.swing.JPanel getChatWindowPanel()
public void addFileDropListener(FileDropListener listener)
FileDropListener
to allow for Drag and Drop notifications
of objects onto the ChatWindow.
listener
- the listener.public void removeFileDropListener(FileDropListener listener)
FileDropListener
from ChatRoom.
listener
- the listener.public void fireFileDropListeners(java.util.Collection files)
files
- the files dropped.public javax.swing.JPanel getEditorBar()
public void addClosingListener(ChatRoomClosingListener listener)
public void removeClosingListener(ChatRoomClosingListener listener)
public javax.swing.JScrollPane getScrollPaneForTranscriptWindow()
public javax.swing.JButton getSendButton()
public javax.swing.JSplitPane getVerticalSlipPane()
public abstract long getLastActivity()
public void connectionClosed()
connectionClosed
in interface org.jivesoftware.smack.ConnectionListener
public void connectionClosedOnError(java.lang.Exception e)
connectionClosedOnError
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectingIn(int seconds)
reconnectingIn
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectionSuccessful()
reconnectionSuccessful
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectionFailed(java.lang.Exception e)
reconnectionFailed
in interface org.jivesoftware.smack.ConnectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |