public class ChatWritePanel extends TransparentPanel implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, javax.swing.event.UndoableEditListener, javax.swing.event.DocumentListener, PluginComponentListener, Skinnable, ChatSessionChangeListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ICON_UPDATED
Constructor and Description |
---|
ChatWritePanel(ChatPanel panel)
Creates an instance of ChatWritePanel.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Performs actions when typing timer has expired.
|
void |
addChatEditorMenuListener(ChatMenuListener l)
Adds the given
ChatMenuListener to this Chat. |
void |
addChatTransport(ChatTransport chatTransport)
Adds the given chatTransport to the given send via selector box.
|
void |
appendText(java.lang.String text)
Appends the given text to the end of the contained HTML document.
|
void |
changedUpdate(javax.swing.event.DocumentEvent documentevent) |
void |
changeSendCommand(boolean isEnter)
Replaces the Ctrl+Enter send command with simple Enter.
|
void |
clearWriteArea()
Clears write message area.
|
void |
currentChatTransportChanged(ChatSession chatSession)
Event in case of chat transport changed, for example because a different
transport was selected.
|
void |
currentChatTransportUpdated(int eventID)
When a property of the chatTransport has changed.
|
void |
dispose()
Runs clean-up for associated resources which need explicit disposal (e.g.
|
javax.swing.JEditorPane |
getEditorPane()
Returns the editor panel, contained in this ChatWritePanel.
|
WritePanelRightButtonMenu |
getRightButtonMenu()
Returns the WritePanelRightButtonMenu opened in this panel.
|
java.lang.String |
getText()
Returns the write area text as a plain text without any formatting.
|
java.lang.String |
getTextAsHtml()
Returns the write area text as an html text.
|
(package private) void |
initPluginComponents()
Initializes plug-in components for this container.
|
void |
insertUpdate(javax.swing.event.DocumentEvent event)
Updates write panel size and adjusts sms properties if the sms menu
is visible.
|
boolean |
isSmsSelected()
Returns true if the sms mode is enabled, otherwise returns
false.
|
void |
keyPressed(java.awt.event.KeyEvent e)
When CTRL+Z is pressed invokes the
ChatWritePanel.undo()
method, when CTRL+R is pressed invokes the
ChatWritePanel.redo() method. |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e)
Sends typing notifications when user types.
|
void |
loadSkin()
Reloads menu.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Opens the WritePanelRightButtonMenu when user clicks with the
right mouse button on the editor area.
|
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
openChatTransportSelectorBox()
Opens the selector box containing the protocol contact icons.
|
void |
pluginComponentAdded(PluginComponentEvent event)
Indicates that a new plugin component has been added.
|
void |
pluginComponentRemoved(PluginComponentEvent event)
Removes the according plug-in component from this container.
|
void |
removeChatEditorMenuListener(ChatMenuListener l)
Removes the given
ChatMenuListener to this Chat. |
void |
removeChatTransport(ChatTransport chatTransport)
Removes the given chat status state from the send via selector box.
|
void |
removeUpdate(javax.swing.event.DocumentEvent event)
Updates write panel size and adjusts sms properties if the sms menu
is visible.
|
void |
saveDefaultFontConfiguration(java.lang.String fontFamily,
int fontSize,
boolean isBold,
boolean isItalic,
boolean isUnderline,
java.awt.Color color)
Saves the given font configuration as default, thus making it the default
configuration for all chats.
|
void |
setBoldStyleEnable(boolean b)
Enables the bold style
|
void |
setEditorPaneBackground(java.awt.Color color)
Sets the background of the write area to the specified color.
|
void |
setFontColor(java.awt.Color color)
Sets the font color
|
void |
setFontFamilyAndSize(java.lang.String family,
int size)
Sets the font family and size
|
void |
setItalicStyleEnable(boolean b)
Enables the italic style
|
void |
setSelectedChatTransport(ChatTransport chatTransport,
boolean isMessageOrFileTransferReceived)
Selects the given chat transport in the send via box.
|
void |
setSmsLabelVisible(boolean isVisible)
Show the sms menu.
|
void |
setSmsSelected(boolean selected)
Enables/disables the sms mode.
|
void |
setTransportSelectorBoxVisible(boolean isVisible) |
void |
setUnderlineStyleEnable(boolean b)
Enables the underline style
|
void |
stopTypingTimer()
Stops the timer and sends a notification message.
|
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Handles the UndoableEditEvent, by adding the content edit to
the UndoManager.
|
void |
updateChatTransportStatus(ChatTransport chatTransport)
Updates the status of the given chat transport in the send via selector
box and notifies the user for the status change.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, 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, 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
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, 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, 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, transferFocusBackward, transferFocusUpCycle
public ChatWritePanel(ChatPanel panel)
panel
- The parent ChatPanel.public void dispose()
public javax.swing.JEditorPane getEditorPane()
public void changeSendCommand(boolean isEnter)
isEnter
- indicates if the new send command is enter or cmd-enterpublic void setSmsSelected(boolean selected)
selected
- true to enable sms mode, false -
otherwisepublic boolean isSmsSelected()
public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
undoableEditHappened
in interface javax.swing.event.UndoableEditListener
e
- The UndoableEditEvent.public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
e
- the event.public void keyPressed(java.awt.event.KeyEvent e)
ChatWritePanel.undo()
method, when CTRL+R is pressed invokes the
ChatWritePanel.redo()
method.keyPressed
in interface java.awt.event.KeyListener
e
- the KeyEvent that notified uspublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the ActionEvent that notified uspublic void stopTypingTimer()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- the MouseEvent that notified uspublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public WritePanelRightButtonMenu getRightButtonMenu()
public java.lang.String getTextAsHtml()
public java.lang.String getText()
public void clearWriteArea()
public void appendText(java.lang.String text)
text
- the text to append.public void setTransportSelectorBoxVisible(boolean isVisible)
isVisible
- public void setSelectedChatTransport(ChatTransport chatTransport, boolean isMessageOrFileTransferReceived)
chatTransport
- The chat transport to be selected.isMessageOrFileTransferReceived
- Boolean telling us if this change
of the chat transport correspond to an effective switch to this new
transform (a mesaage received from this transport, or a file transfer
request received, or if the resource timeouted), or just a status update
telling us a new chatTransport is now available (i.e. another device has
startup).public void addChatTransport(ChatTransport chatTransport)
chatTransport
- the transport to addpublic void updateChatTransportStatus(ChatTransport chatTransport)
chatTransport
- the chatTransport to updatepublic void openChatTransportSelectorBox()
public void removeChatTransport(ChatTransport chatTransport)
chatTransport
- the transport to removepublic void setSmsLabelVisible(boolean isVisible)
isVisible
- true to show the sms menu, false -
otherwisepublic void saveDefaultFontConfiguration(java.lang.String fontFamily, int fontSize, boolean isBold, boolean isItalic, boolean isUnderline, java.awt.Color color)
fontFamily
- the font familyfontSize
- the font sizeisBold
- indicates if the font is boldisItalic
- indicates if the font is italicisUnderline
- indicates if the font is underlinepublic void setFontFamilyAndSize(java.lang.String family, int size)
family
- the family namesize
- the sizepublic void setBoldStyleEnable(boolean b)
b
- TRUE enable - FALSE disablepublic void setItalicStyleEnable(boolean b)
b
- TRUE enable - FALSE disablepublic void setUnderlineStyleEnable(boolean b)
b
- TRUE enable - FALSE disablepublic void setFontColor(java.awt.Color color)
color
- the colorpublic void addChatEditorMenuListener(ChatMenuListener l)
ChatMenuListener
to this Chat.
The ChatMenuListener is used to determine menu elements
that should be added on right clicks.l
- the ChatMenuListener to addpublic void removeChatEditorMenuListener(ChatMenuListener l)
ChatMenuListener
to this Chat.
The ChatMenuListener is used to determine menu elements
that should be added on right clicks.l
- the ChatMenuListener to addpublic void changedUpdate(javax.swing.event.DocumentEvent documentevent)
changedUpdate
in interface javax.swing.event.DocumentListener
public void insertUpdate(javax.swing.event.DocumentEvent event)
insertUpdate
in interface javax.swing.event.DocumentListener
event
- the DocumentEvent that notified uspublic void removeUpdate(javax.swing.event.DocumentEvent event)
removeUpdate
in interface javax.swing.event.DocumentListener
event
- the DocumentEvent that notified uspublic void setEditorPaneBackground(java.awt.Color color)
color
- The color to set the background to.void initPluginComponents()
public void pluginComponentAdded(PluginComponentEvent event)
pluginComponentAdded
in interface PluginComponentListener
event
- the PluginComponentEvent that notified uspublic void pluginComponentRemoved(PluginComponentEvent event)
pluginComponentRemoved
in interface PluginComponentListener
event
- the PluginComponentEvent that notified uspublic void currentChatTransportChanged(ChatSession chatSession)
currentChatTransportChanged
in interface ChatSessionChangeListener
chatSession
- the chat sessionpublic void currentChatTransportUpdated(int eventID)
ChatSessionChangeListener
currentChatTransportUpdated
in interface ChatSessionChangeListener
eventID
- the event id representing the property of the transport
that has changed.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.