edu.ou.kmi.buddyspace.gui
Class BSChatWindow

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--edu.ou.kmi.buddyspace.utils.DockableWindow
                          |
                          +--edu.ou.kmi.buddyspace.utils.AlertsDockableWindow
                                |
                                +--edu.ou.kmi.buddyspace.gui.BSChatWindow
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.MenuContainer, java.io.Serializable

public class BSChatWindow
extends AlertsDockableWindow
implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.ItemListener

Window including whole GUI for chat. Uses BSChatWinManager to receive and send messages.

See Also:
Serialized Form

Nested Class Summary
 
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
 int COMPOSING_TIME_OUT
           
 
Fields inherited from class edu.ou.kmi.buddyspace.utils.AlertsDockableWindow
newMsg
 
Fields inherited from class edu.ou.kmi.buddyspace.utils.DockableWindow
contentPane, DEFAULT_SIZE, docked, frame, icon, ID, moveToBack, select, title, viewSize, winMan
 
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
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Handles actions from buttons
protected  void addMessageIntoChatPane(Message msg, java.lang.String nick, boolean incoming)
          Adds message into chat pane
 void addReceivedMessage(Message msg)
          Adds received message packet into chat window
 void cancelListening()
          Removes itself from listening
protected  void focusToWriteArea()
           
 JID getJID()
          Returns jid of peer
 void handleMessageEvents(Message msg)
          Handles message events extension, if present
 boolean isShowResource()
          Returns if the resource of buddy's JID is shown
 void itemStateChanged(java.awt.event.ItemEvent evt)
           
 void keyPressed(java.awt.event.KeyEvent evt)
          Updates the composing event status
 void keyReleased(java.awt.event.KeyEvent keyEvent)
          Empty implementation
 void keyTyped(java.awt.event.KeyEvent evt)
          Handles key strokes - sends on ENTER
protected  void loadHistory()
          Loads message history
 void presenceChanged(BSPresenceInfo pi)
          Displays change of presence in chat window
protected  void sendComposing()
          Sends composing event
protected  void sendComposingCancelled()
          Sends composing cancelled event
protected  void sendDisplayedEvent(Message displayedMsg)
           
protected  void setComposing()
          Sets composing = (re)starts timer and sends composing cancelled event if necessary
 void setNick(java.lang.String nick)
          Sets nick of peer
protected  void stopComposing()
          Stops composing = stops timer and sends composing cancelled event
 
Methods inherited from class edu.ou.kmi.buddyspace.utils.AlertsDockableWindow
getNewMsg, setNewMsg
 
Methods inherited from class edu.ou.kmi.buddyspace.utils.DockableWindow
close, dockAsTab, getFrame, getFrameHeight, getFrameWidth, getFrameX, getFrameY, getID, getTitle, isDocked, isVisible, prepareOnClose, setAutoSelect, setDocked, setDocked, setFrameLocation, setFrameSize, setIcon, setTitle, showWindow, showWindow, toFront, updateLAF
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, 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
 

Field Detail

COMPOSING_TIME_OUT

public int COMPOSING_TIME_OUT
Method Detail

focusToWriteArea

protected void focusToWriteArea()

setNick

public void setNick(java.lang.String nick)
Sets nick of peer


isShowResource

public boolean isShowResource()
Returns if the resource of buddy's JID is shown


getJID

public JID getJID()
Returns jid of peer


loadHistory

protected void loadHistory()
Loads message history


addMessageIntoChatPane

protected void addMessageIntoChatPane(Message msg,
                                      java.lang.String nick,
                                      boolean incoming)
Adds message into chat pane


addReceivedMessage

public void addReceivedMessage(Message msg)
Adds received message packet into chat window


handleMessageEvents

public void handleMessageEvents(Message msg)
Handles message events extension, if present


sendDisplayedEvent

protected void sendDisplayedEvent(Message displayedMsg)

sendComposingCancelled

protected void sendComposingCancelled()
Sends composing cancelled event


sendComposing

protected void sendComposing()
Sends composing event


stopComposing

protected void stopComposing()
Stops composing = stops timer and sends composing cancelled event


setComposing

protected void setComposing()
Sets composing = (re)starts timer and sends composing cancelled event if necessary


cancelListening

public void cancelListening()
Removes itself from listening

Specified by:
cancelListening in class DockableWindow

presenceChanged

public void presenceChanged(BSPresenceInfo pi)
Displays change of presence in chat window


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Handles actions from buttons

Specified by:
actionPerformed in interface java.awt.event.ActionListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Handles key strokes - sends on ENTER

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Updates the composing event status

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent keyEvent)
Empty implementation

Specified by:
keyReleased in interface java.awt.event.KeyListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent evt)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener