com.valhalla.jbother.groupchat
Class ChatRoomPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.valhalla.jbother.groupchat.ChatRoomPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, LogViewerCaller, java.awt.MenuContainer, java.io.Serializable, TabFramePanel

public class ChatRoomPanel
extends javax.swing.JPanel
implements LogViewerCaller, TabFramePanel

This is the panel that contains a groupchat conversation. It is placed in a JTabbedPane in GroupChat frame.

Author:
Adam Olsen
See Also:
Serialized Form

Nested Class Summary
(package private)  class ChatRoomPanel.JoinChatThread
          Joins the chatroom and adds this chatroomwindow to the TabFrame
(package private)  class ChatRoomPanel.RightClickListener
          Look for a right click, and show a pop up menu
 
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.Container
 
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
ChatRoomPanel(java.lang.String chatroom, java.lang.String nickname)
          This sets up the appearance of the chatroom window
 
Method Summary
 void addBuddy(java.lang.String buddy)
          Adds a buddy to the nickname list
 void addListeners()
          Adds the event listeners for the various components in this chatwindows
 void closeLog()
          Closes the log file
 void focusYourself()
          Focuses the text entry area
 BuddyStatus getBuddyStatus(java.lang.String user)
          Gets the BuddyStatus represending a user in the room
 java.util.Hashtable getBuddyStatuses()
          Gets all the buddy statuses in the room
 java.lang.String getDate()
           
 java.awt.Component getInputComponent()
           
 javax.swing.JList getNickList()
           
 java.lang.String getNickname()
          Gets the nickname currently being used in the chat room
 java.lang.String getPanelName()
          Returns the tab name for the TabFramePanel
 java.lang.String getRoomName()
          Gets the entire room name, server included
 java.lang.String getShortRoomName()
          Gets the short room name - for example, if you are talking in jdev@conference.jabber.org, it would return "jdev"
 java.lang.String getSubject()
          Returns the current room subject
 javax.swing.JTextField getTextEntryArea()
           
 java.lang.String getTooltip()
          Returns the tooltip for the tab in the TabFrame
 java.lang.String getWindowTitle()
          Returns the window title
 void leave()
          Leaves this room and removes it from the groupchat frame
 boolean listenersAdded()
           
 void openLogWindow()
          Opens the log window for this chat room
 void recieveMessage(java.lang.String from, java.lang.String message)
          Recieves a message
 void removeBuddy(java.lang.String buddy)
          Removes a buddy from the nick list
 void setListenersAdded(boolean added)
          Sets whether or not the TabFrame panel listeners have been added
 void setSubject(java.lang.String subject)
          Sets the subject of the room
 void startChat()
          Starts the groupchat.
 void startLog()
          Opens the log file
 void updateStyle(java.awt.Font font)
          Updates the font in the ConversationArea
 
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, paintComponent, 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

ChatRoomPanel

public ChatRoomPanel(java.lang.String chatroom,
                     java.lang.String nickname)
This sets up the appearance of the chatroom window

Parameters:
chatroom - the chatroom address
nickname - the nickname to use when joining
Method Detail

listenersAdded

public boolean listenersAdded()
Specified by:
listenersAdded in interface TabFramePanel
Returns:
true if the TabFrame panel listeners have already been added to this panel

setListenersAdded

public void setListenersAdded(boolean added)
Sets whether or not the TabFrame panel listeners have been added

Specified by:
setListenersAdded in interface TabFramePanel
Parameters:
added - true if they have been added

getInputComponent

public java.awt.Component getInputComponent()
Specified by:
getInputComponent in interface TabFramePanel
Returns:
the input area of this panel

getNickList

public javax.swing.JList getNickList()
Returns:
the JList representing the nicklist

getTextEntryArea

public javax.swing.JTextField getTextEntryArea()
Returns:
the text entry area

updateStyle

public void updateStyle(java.awt.Font font)
Updates the font in the ConversationArea

Specified by:
updateStyle in interface TabFramePanel
Parameters:
font - the font to update to

openLogWindow

public void openLogWindow()
Opens the log window for this chat room

Specified by:
openLogWindow in interface LogViewerCaller

addBuddy

public void addBuddy(java.lang.String buddy)
Adds a buddy to the nickname list

Parameters:
buddy - the buddy to add

removeBuddy

public void removeBuddy(java.lang.String buddy)
Removes a buddy from the nick list

Parameters:
buddy - the buddy to remove

startLog

public void startLog()
Opens the log file

Specified by:
startLog in interface LogViewerCaller

getBuddyStatus

public BuddyStatus getBuddyStatus(java.lang.String user)
Gets the BuddyStatus represending a user in the room

Parameters:
user - the BuddyStatus to get
Returns:
the requested BuddyStatus

getPanelName

public java.lang.String getPanelName()
Returns the tab name for the TabFramePanel

Specified by:
getPanelName in interface TabFramePanel
Returns:
the panel name

getTooltip

public java.lang.String getTooltip()
Returns the tooltip for the tab in the TabFrame

Specified by:
getTooltip in interface TabFramePanel
Returns:
the tooltip for this tab in the tab frame

getWindowTitle

public java.lang.String getWindowTitle()
Returns the window title

Specified by:
getWindowTitle in interface TabFramePanel
Returns:
the window title for the TabFrame when this tab is selected

getShortRoomName

public java.lang.String getShortRoomName()
Gets the short room name - for example, if you are talking in jdev@conference.jabber.org, it would return "jdev"

Returns:
short room name

getRoomName

public java.lang.String getRoomName()
Gets the entire room name, server included

Returns:
gets the room address

startChat

public void startChat()
Starts the groupchat. Sets up a thread to connect, and start that thread


addListeners

public void addListeners()
Adds the event listeners for the various components in this chatwindows


leave

public void leave()
Leaves this room and removes it from the groupchat frame


focusYourself

public void focusYourself()
Focuses the text entry area

Specified by:
focusYourself in interface TabFramePanel

getNickname

public java.lang.String getNickname()
Gets the nickname currently being used in the chat room

Returns:
the nickname being used in the chatroom

recieveMessage

public void recieveMessage(java.lang.String from,
                           java.lang.String message)
Recieves a message

Parameters:
from - who it's from
message - the message

closeLog

public void closeLog()
Closes the log file

Specified by:
closeLog in interface LogViewerCaller

getDate

public java.lang.String getDate()
Returns:
a String representing the current time the format: [Hour:Minute:Second]

setSubject

public void setSubject(java.lang.String subject)
Sets the subject of the room

Parameters:
subject - the subject to set

getSubject

public java.lang.String getSubject()
Returns the current room subject

Returns:
the current room subject

getBuddyStatuses

public java.util.Hashtable getBuddyStatuses()
Gets all the buddy statuses in the room

Returns:
all BuddyStatuses