public class TranscriptWindow extends ChatArea implements ContextMenuListener
TranscriptWindow
class. Provides a default implementation
of a Chat Window. In general, extensions could override this class
to offer more support within the chat, but should not be necessary.javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
javax.swing.JComponent.AccessibleJComponent
DEFAULT_CURSOR, emoticonManager, emoticonsAvailable, forceEmoticons, HAND_CURSOR, styles
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
TranscriptWindow()
Creates a default instance of
TranscriptWindow . |
Modifier and Type | Method and Description |
---|---|
void |
addComponent(java.awt.Component component)
Inserts a component into the transcript window.
|
void |
cleanup() |
java.awt.Font |
getFont() |
protected java.util.Date |
getLastPost() |
java.util.Date |
getLastUpdated()
Return the last time the
TranscriptWindow was updated. |
protected java.awt.Color |
getMessageColor() |
protected java.text.SimpleDateFormat |
getNotificationDateFormatter() |
boolean |
handleDefaultAction(java.awt.event.MouseEvent e)
Called when the user double clicks on an item that has a popup menu.
|
void |
insertCustomText(java.lang.String text,
boolean bold,
boolean underline,
java.awt.Color foreground)
Create and insert a notification message.
|
void |
insertHistoryMessage(java.lang.String userid,
java.lang.String message,
java.util.Date date)
Inserts a history message.
|
void |
insertMessage(java.lang.String nickname,
org.jivesoftware.smack.packet.Message message,
java.awt.Color foreground)
Create and insert a message from the current user.
|
void |
insertMessage(java.lang.String nickname,
org.jivesoftware.smack.packet.Message message,
java.awt.Color foreground,
java.awt.Color background)
Create and insert a message from the current user.
|
void |
insertNotificationMessage(java.lang.String message,
java.awt.Color foregroundColor)
Create and insert a notification message.
|
void |
insertPrefixAndMessage(java.lang.String prefix,
java.lang.String message,
java.awt.Color foreground)
Inserts a full line using a prefix and message.
|
void |
poppingDown(javax.swing.JPopupMenu popup)
Called just before the context menu closed.
|
void |
poppingUp(java.lang.Object object,
javax.swing.JPopupMenu popup)
Adds Print and Clear actions.
|
void |
saveTranscript(java.lang.String fileName,
java.util.List<org.jivesoftware.smack.packet.Message> transcript,
java.lang.String headerData)
Persist a current transcript.
|
void |
setFont(java.awt.Font font) |
protected void |
setLastPost(java.util.Date lastPost) |
protected void |
setLastUpdated(java.util.Date lastUpdated) |
void |
showWindowDisabled()
Disable the entire
TranscriptWindow and visually represent
it as disabled. |
actionPerformed, addContextMenuListener, addLinkInterceptor, clear, fireLinkInterceptors, getForceEmoticons, getMarkup, insert, insertAddress, insertHorizontalLine, insertImage, insertLink, insertText, insertText, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, releaseResources, removeContextMenuListener, removeLastWord, removeLinkInterceptor, removeWordInBetween, setBold, setFont, setFontSize, setForceEmoticons, setInitialContent, setItalics, setText, setUnderlined
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public TranscriptWindow()
TranscriptWindow
.public void addComponent(java.awt.Component component)
component
- the component to insert.public void insertMessage(java.lang.String nickname, org.jivesoftware.smack.packet.Message message, java.awt.Color foreground)
nickname
- the nickname of the current user.message
- the message to insert.foreground
- the color to use for the message foreground.public void insertMessage(java.lang.String nickname, org.jivesoftware.smack.packet.Message message, java.awt.Color foreground, java.awt.Color background)
nickname
- the nickname of the current user.message
- the message to insert.foreground
- the color to use for the message foreground.background
- the color to use for the message background.public void insertPrefixAndMessage(java.lang.String prefix, java.lang.String message, java.awt.Color foreground)
prefix
- the prefix to use. If null is used, then only the message will be inserted.message
- the message to insert.foreground
- the foreground color for the message.protected java.awt.Color getMessageColor()
public void insertNotificationMessage(java.lang.String message, java.awt.Color foregroundColor)
message
- the information message to insert.foregroundColor
- the foreground color to use.public void insertCustomText(java.lang.String text, boolean bold, boolean underline, java.awt.Color foreground)
text
- the text to insert.bold
- true to use bold text.underline
- true to have text underlined.foreground
- the foreground color.public java.util.Date getLastUpdated()
TranscriptWindow
was updated.TranscriptWindow
was updated.public void insertHistoryMessage(java.lang.String userid, java.lang.String message, java.util.Date date)
userid
- the userid of the sender.message
- the message to insert.date
- the Date object created when the message was delivered.public void showWindowDisabled()
TranscriptWindow
and visually represent
it as disabled.public void saveTranscript(java.lang.String fileName, java.util.List<org.jivesoftware.smack.packet.Message> transcript, java.lang.String headerData)
fileName
- the name of the file to save the transcript as. Note: This can be modified by the user.transcript
- the collection of transcript.headerData
- the string to prepend to the transcript.ChatRoom.getTranscripts()
public void cleanup()
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
public java.awt.Font getFont()
getFont
in interface java.awt.MenuContainer
getFont
in class java.awt.Component
public void poppingUp(java.lang.Object object, javax.swing.JPopupMenu popup)
poppingUp
in interface ContextMenuListener
object
- the TransferWindowpopup
- the popup menu to add to.public void poppingDown(javax.swing.JPopupMenu popup)
ContextMenuListener
poppingDown
in interface ContextMenuListener
popup
- the popup menu in the process of closing.public boolean handleDefaultAction(java.awt.event.MouseEvent e)
ContextMenuListener
handleDefaultAction
in interface ContextMenuListener
e
- the current mouse eventprotected java.text.SimpleDateFormat getNotificationDateFormatter()
protected java.util.Date getLastPost()
protected void setLastPost(java.util.Date lastPost)
protected void setLastUpdated(java.util.Date lastUpdated)