talx x1.0.5

talx.view.composer
Class ReplyPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.text.JTextComponent
                  extended byjavax.swing.JEditorPane
                      extended byjavax.swing.JTextPane
                          extended bytalx.view.composer.ReplyPane
All Implemented Interfaces:
javax.accessibility.Accessible, ComposerControl, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable, TALComponent

public class ReplyPane
extends javax.swing.JTextPane
implements ComposerControl, TALComponent

Provides support for erase listeners. Whenever the user erases letters or words in the pane, objects of this class send out an erase event to all erase listeners. This class also sends out composer action commands for the following situations:

Command Reason
ComposerGUI.DIRTY_COMMAND The reply pane was clean, and the user added some alphabetic text
ComposerGUI.CLEAN_COMMAND The reply pane was dirty, and the user deleted all the text
ComposerGUI.WORD_COMMAND The user typed a word, or generated a new word using an editing gesture.
ComposerGUI.SENTENCE_COMMAND The user typed a sentence, or generated a new sentence using an editing gesture.
ComposerGUI.EDIT_COMMAND The user deleted text.
Notice in particular that an empty reply pane only becomes dirty when the user adds alphabetic text, but a dirty reply pane only becomes clean when the user deletes all the text, alphabetic or otherwise. So, a clean reply pane may have non-alphabetic characters, and a dirty reply pane may have no alphabetic characters. Thus, even using the base rules, it is still possible to send a message that consists of only punctuation marks, provided some alphabetic character was first typed and then erased.

This class also monitors the settings object to deal with mouse drag events properly and monitors the text for radio buttons.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JEditorPane
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Nested classes inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
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
static java.lang.String INCLUDES_CONTROLS_PREFIX
          If present as the first part of the text, the setText method will look for embeded controls in the body of the text.
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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
ReplyPane(ComposerGUI owner, Settings settings)
          Constructs a new reply pane with the given owner.
 
Method Summary
 void addEraseListener(EraseListener l)
           
 void clear()
          Removes any text and controls.
 void fireComposerAction(java.lang.String command, java.lang.String text)
          Sends out ActionEvent with given command directly to the ActionDispatcher.
 void fireEraseEvent()
          Sends out a new erase event if needed.
 ComposerGUI getComposer()
          Returns the owner of this reply pane.
 java.util.Enumeration getControls()
          Returns an iterator over the radio buttons.
 java.awt.Component getFocusCycleCurrent()
          Gets the current component in the focus cycle.
 java.awt.Component getFocusCycleStart()
          Resets the focus cycle and returns the first component.
static java.lang.String getLastWord(java.lang.String text)
           
 java.awt.Component getNextFocusOwner()
          Gets the next component in the focus cycle.
 java.awt.Component getPreviousFocusOwner()
          Gets the next component in the focus cycle.
 boolean isFocusable(java.awt.Component c)
          Returns true if the given component should receive focus.
 boolean isFocusCycleEnd()
          Returns true if the focus is currently on the last element of the cycle.
protected  void processKeyEvent(java.awt.event.KeyEvent e)
          Overrides JTextPane processKeyEvent method to generate action events as necessary.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Overrides JTextPane processMouseEvent method to consume any mouse events involving the middle or right buttons.
protected  void processMouseEvent(java.awt.event.MouseWheelEvent e)
          Overrides JTextPane processMouseWheelEvent method to consume them.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent e)
          Overrides this method to allow custom mouse dragging behavior.
 void removeEraseListener(EraseListener l)
           
 void setText(java.lang.String t)
          Sets the text for this control.
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.JTextPane
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, 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, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface talx.view.ComposerControl
getName
 

Field Detail

INCLUDES_CONTROLS_PREFIX

public static final java.lang.String INCLUDES_CONTROLS_PREFIX
If present as the first part of the text, the setText method will look for embeded controls in the body of the text.

See Also:
Constant Field Values
Constructor Detail

ReplyPane

public ReplyPane(ComposerGUI owner,
                 Settings settings)
Constructs a new reply pane with the given owner.

Method Detail

getComposer

public ComposerGUI getComposer()
Returns the owner of this reply pane.

Specified by:
getComposer in interface ComposerControl

clear

public void clear()
Removes any text and controls.


setText

public void setText(java.lang.String t)
Sets the text for this control. If the text begins with INCLUDES_CONTROLS_PREFIX, this method will look for embedded controls in the text. A radio button is denoted by placing the radio button text in square brackets. Each time a pipe character is encountered, all subsequent radio buttons are placed in a new button group. All resulting radio buttons are registered with the ActionDispatcher and placed in the focusable controls list.


processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
Overrides this method to allow custom mouse dragging behavior.


processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Overrides JTextPane processMouseEvent method to consume any mouse events involving the middle or right buttons.


processMouseEvent

protected void processMouseEvent(java.awt.event.MouseWheelEvent e)
Overrides JTextPane processMouseWheelEvent method to consume them.


processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent e)
Overrides JTextPane processKeyEvent method to generate action events as necessary.


addEraseListener

public void addEraseListener(EraseListener l)

removeEraseListener

public void removeEraseListener(EraseListener l)

fireEraseEvent

public void fireEraseEvent()
Sends out a new erase event if needed. Calling this method when there is no saved text (ie the pane is not in erase mode) has no effect. Therefore, this method should be called whenever the text editing has come to an end, just in case the user was erasing something before signalling an end to the edit session.


fireComposerAction

public void fireComposerAction(java.lang.String command,
                               java.lang.String text)
Sends out ActionEvent with given command directly to the ActionDispatcher.


getControls

public java.util.Enumeration getControls()
Returns an iterator over the radio buttons.


getFocusCycleStart

public java.awt.Component getFocusCycleStart()
Resets the focus cycle and returns the first component.

Specified by:
getFocusCycleStart in interface TALComponent

getNextFocusOwner

public java.awt.Component getNextFocusOwner()
Gets the next component in the focus cycle.

Specified by:
getNextFocusOwner in interface TALComponent

getPreviousFocusOwner

public java.awt.Component getPreviousFocusOwner()
Gets the next component in the focus cycle.

Specified by:
getPreviousFocusOwner in interface TALComponent

getFocusCycleCurrent

public java.awt.Component getFocusCycleCurrent()
Gets the current component in the focus cycle.

Specified by:
getFocusCycleCurrent in interface TALComponent

isFocusCycleEnd

public boolean isFocusCycleEnd()
Returns true if the focus is currently on the last element of the cycle.

Specified by:
isFocusCycleEnd in interface TALComponent

isFocusable

public boolean isFocusable(java.awt.Component c)
Returns true if the given component should receive focus.

Specified by:
isFocusable in interface TALComponent

getLastWord

public static java.lang.String getLastWord(java.lang.String text)

toString

public java.lang.String toString()

talx x1.0.5

© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.