vooga.social.chat
Class ChatPanel

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 vooga.social.chat.ChatPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ChatPanel
extends javax.swing.JPanel

A ChatWindow that functions as, basically, an IM client, imbeddable into other Swing GUIs. Will consist of: A message window, possibly a JList. A list of online 'friends', or other things - generalizable collections of displayed items that can be updated. An input field. The entire thing should be minimizable, and, preferably, it should be possible to set display preferences using a button somewhere (probably upper left corner.) The modules should be separate classes so they can be added or removed as needed. Enter, or possibly shift-enter, should be mapped to send a message. Chats should be parsed into some html, ignoring destination things stored at the beginning of the message. Using the @ symbol to send messages to different people or channels?

Author:
ajk32
See Also:
Serialized Form

Nested Class Summary
 
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.BaselineResizeBehavior, 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
ChatPanel(IVoogaGUI gui, java.awt.Dimension d)
          Creates the JPanel and adds itself to the GUI provided.
 
Method Summary
(package private)  void addPane(ChatExtrasPane p)
          adds the given ChatPane instance to this panel.
(package private)  void initialize(int frameID, VoogaUser u)
          initializes this chat pane into the gui.
(package private)  void joinChannel(long channelID)
          Joins a new channel if you have a connected client.
(package private)  void receiveErrorMessage(java.lang.String message)
          receives an error message!
(package private)  void receiveMessage(long fromChannel, java.lang.String senderName, java.lang.String message)
          sends a message from a specific channel and specific userID to the user.
(package private)  void sendMessage(java.lang.String s)
          Parses the user's outgoing chats.
(package private)  void setClient(VoogaChatClient vcc)
           
 void setHeight(int h)
           
 void setMaximumSize(java.awt.Dimension d)
          Sets size of components, then sets maximum size of JPanel.
 void setMinimized(boolean b)
          Minimizes/unminimizes the chatwindow.
 void setMinimumSize(java.awt.Dimension d)
          Sets size of components, then sets minimize size of JPanel.
 void setPreferredSize(java.awt.Dimension d)
          overrides regular setPreferredSize.
 void setSize(java.awt.Dimension d)
          Sets the size of the chat window to a specific dimension.
 void setWidth(int w)
          sets just the width and lets the pane use its current or default height.
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, setNextFocusableComponent, setOpaque, 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, 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

ChatPanel

public ChatPanel(IVoogaGUI gui,
                 java.awt.Dimension d)
Creates the JPanel and adds itself to the GUI provided. This default constructor does NOT get a user, so that has to be added using setUser() afterwards or an error is display. The constructor is overloaded to allow a user to be defined at the same time.

Method Detail

initialize

void initialize(int frameID,
                VoogaUser u)
initializes this chat pane into the gui.

Parameters:
frameID -
u -

receiveMessage

void receiveMessage(long fromChannel,
                    java.lang.String senderName,
                    java.lang.String message)
sends a message from a specific channel and specific userID to the user.

Parameters:
fromChannel - The channel the message was sent on, or -1 if it's a personal message from the user.
fromID - the ID of the user sending the message. Special system codes will be defined for achievements or system messages, probably.
message - the message sent to the user, which should not include tags with @ in it

receiveErrorMessage

void receiveErrorMessage(java.lang.String message)
receives an error message!

Parameters:
message -

sendMessage

void sendMessage(java.lang.String s)
Parses the user's outgoing chats. Planning to perform the following interpretations: "@name" becomes a personal message to the name, or to the game maybe. "@number" becomes a personal message to the number "@r" becomes a reply to the most recent personal message received. no @ field becomes a message to the last channel sent - personal or not. Stores the most recent channel talked in, the last person talked to. Sends the messages itself rather than dealing with returning multiple values. Joins channels you talk to if you're not in them. More commands later for: -joining Channels -leaving channels -away messages?


joinChannel

void joinChannel(long channelID)
Joins a new channel if you have a connected client.

Parameters:
channelID -

setClient

void setClient(VoogaChatClient vcc)

addPane

void addPane(ChatExtrasPane p)
adds the given ChatPane instance to this panel. As we imagine it now it should handle its updating on its own.

Parameters:
p -

setSize

public void setSize(java.awt.Dimension d)
Sets the size of the chat window to a specific dimension. Preferably one much wider than tall.

Overrides:
setSize in class java.awt.Component

setPreferredSize

public void setPreferredSize(java.awt.Dimension d)
overrides regular setPreferredSize. Sets size first using our more functional method, then sets the preferred size.

Overrides:
setPreferredSize in class javax.swing.JComponent

setMinimumSize

public void setMinimumSize(java.awt.Dimension d)
Sets size of components, then sets minimize size of JPanel.

Overrides:
setMinimumSize in class javax.swing.JComponent

setMaximumSize

public void setMaximumSize(java.awt.Dimension d)
Sets size of components, then sets maximum size of JPanel.

Overrides:
setMaximumSize in class javax.swing.JComponent

setWidth

public void setWidth(int w)
sets just the width and lets the pane use its current or default height.

Parameters:
w -

setHeight

public void setHeight(int h)

setMinimized

public void setMinimized(boolean b)
Minimizes/unminimizes the chatwindow. We're not sure how to do this yet but it'll work! Hopefully The chatpanes should continue updating with data while they're gone.

Parameters:
b -