Package com.reportmill.text
Class RMTextEditor
- java.lang.Object
- 
- com.reportmill.text.RMTextEditor
 
- 
- Direct Known Subclasses:
- RMEditorTextEditor
 
 public class RMTextEditor extends java.lang.ObjectThis class provides all of the event and drawing code necessary to edit text in the form of an RMXString (separated from an actual UI Component).
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRMTextEditor.ListenerListener class so other objects can track changes to text editor.
 - 
Field SummaryFields Modifier and Type Field Description static booleanisHyphenatingstatic booleanisSpellChecking
 - 
Constructor SummaryConstructors Constructor Description RMTextEditor()Creates a plain text editor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(RMTextEditor.Listener aTEL)Adds a listener.voidcopy()Copies the current selection onto the clipboard.voidcut()Copies the current selection onto the clip board, then deletes the current selection.voiddelete()Deletes the current selection.voiddeleteForward()Deletes the character in front of the insertion point.voiddeleteToLineEnd()Deletes the characters from the insertion point to the end of the line.bytegetAlign()Returns the alignment for current selection.RMRectgetBounds()Returns the bounds of the text editor.floatgetCharSpacing()Returns the character spacing of the current selection or cursor.RMColorgetColor()Returns the color of the current selection or cursor.RMFontgetFont()Returns the font of the current selection or cursor.floatgetFontScale()Returns the scale applied to text when editing.RMFormatgetFormat()Returns the format of the current selection or cursor.floatgetHeightToFit()Returns the height needed to display all characters.java.util.MapgetInputAttributes()Returns the map of attributes applied to any inputted characters.RMParagraphgetInputParagraph()Returns the paragraph of the current selection or cursor position.floatgetLineGap()Returns the line gap for current selection.floatgetLineHeightMax()Returns the maximum line height for a line of text (even if font size would dictate higher).floatgetLineHeightMin()Returns the min line height for current selection.floatgetLineSpacing()Returns the line spacing for current selection.RMTextEditor.ListenergetListener(int anIndex)Return the listener at the given index.RMXString.OutlinegetOutline()Returns whether current selection is outlined.static java.awt.geom.GeneralPathgetSelectionPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout)Returns a path for the current selection.intgetSelEnd()Returns the character index of the end of the text selection.intgetSelStart()Returns the character index of the start of the text selection.static java.awt.geom.GeneralPathgetSpellingPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout)Returns a path for misspelled word underlining.java.lang.StringgetString()Returns the plain string of the xstring being edited.RMTextLayoutgetTextLayout()Returns the configured text layout used to layout text.RMXStringgetXString()Returns the xstring that is being edited.booleanisUnderlined()Returns whether current selection is underlined.voidkeyBackward()Moves the insertion point backward a character (or if a range is selected, moves to beginning of range).voidkeyDown()Moves the insertion point down a line, trying preserve distance from beginning of line.voidkeyForward()Moves the insertion point forward a character (or if a range is selected, moves to end of range).voidkeyUp()Moves the insertion point up a line, trying to preserve distance from beginning of line.intlength()Returns the number of characters in the text string.voidlineEnd()Moves the insertion point to the end of line.voidlineStart()Moves the insertion point to the beginning of line.voidmouseDragged(java.awt.event.MouseEvent e, RMPoint location)Handles mouse dragged.voidmousePressed(java.awt.event.MouseEvent e, RMPoint location)Handles mouse pressed.voidmouseReleased(java.awt.event.MouseEvent e, RMPoint location)Handles mouse released.static voidpaintLayout(RMTextEditor aTextEditor, RMTextLayout aTextLayout, java.awt.Graphics2D g, float opacity)Paints a given layout in a given graphics.voidpaintLayout(java.awt.Graphics2D g, float opacity)Paints the text editor (with an opacity value).voidpaste()Pasts the current clipboard data over the current selection.voidprocessKeyEvent(java.awt.event.KeyEvent e)Handles key events.voidremoveListener(RMTextEditor.Listener aTEL)Removes a listener.voidreplace(RMXString aString)Replaces the current selection with the given xstring.voidreplace(java.lang.String aString)Replaces the current selection with the given string.voidselectAll()Selects all the characters in the text editor.voidsetAlign(int align)Sets the alignment for current selection.voidsetBounds(float x, float y, float w, float h)Set the bounds of the text editor.voidsetCharSpacing(float aValue)Returns the character spacing of the current selection or cursor.voidsetColor(RMColor color)Sets the color of the current selection or cursor.voidsetFont(RMFont font)Sets the font of the current selection or cursor.voidsetFontScale(float aScale)Sets the scale applied to text when editing.voidsetFormat(RMFormat aFormat)Sets the format of the current selection or cursor, after trying to expand the selection to encompase currently selected, @-sign deliniated key.voidsetInputAttribute(java.lang.String aKey, java.lang.Object aValue)Sets the attributes that are applied to current selection or newly typed chars.voidsetInputParagraph(RMParagraph ps)Sets the paragraph of the current selection or cursor position.voidsetLineGap(float aHeight)Sets the line gap for current selection.voidsetLineHeightMax(float aHeight)Sets the maximum line height for a line of text (even if font size would dictate higher).voidsetLineHeightMin(float aHeight)Sets the min line height for current selection.voidsetLineSpacing(float aHeight)Sets the line spacing for current selection.voidsetNeedsRepaint()Tell the text editor listener that editor needs repaint.voidsetOutline(RMXString.Outline anOutline)Sets whether current selection is outlined.voidsetSelection(int newStartEnd)Sets the character index of the text cursor.voidsetSelection(int newStart, int newEnd)Sets the character index of the start and end of the text selection.voidsetSelEnd(int newEnd)Sets the character index of the end of the text selection.voidsetSelStart(int newStart)Sets the character index of the start of the text selection.voidsetSubscript()Sets current selection to subscript.voidsetSuperscript()Sets current selection to superscript.voidsetTextLayout(RMTextLayout aLayout)Sets the text layout for this text editor.voidsetUnderlined(boolean aFlag)Sets whether current selection is underlined.voidsetXString(RMXString aString)Sets the xstring that is to be edited.RMRangesmartFindFormatRange()This method returns the range of the @-sign delinated key closest to the current selection (or null if not found).voidtextDidChange()Called when characters where added, updated or deleted.
 
- 
- 
- 
Method Detail- 
getXStringpublic RMXString getXString() Returns the xstring that is being edited.
 - 
setXStringpublic void setXString(RMXString aString) Sets the xstring that is to be edited.
 - 
getBoundspublic RMRect getBounds() Returns the bounds of the text editor.
 - 
setBoundspublic void setBounds(float x, float y, float w, float h)Set the bounds of the text editor.
 - 
lengthpublic int length() Returns the number of characters in the text string.
 - 
getSelStartpublic int getSelStart() Returns the character index of the start of the text selection.
 - 
setSelStartpublic void setSelStart(int newStart) Sets the character index of the start of the text selection.
 - 
getSelEndpublic int getSelEnd() Returns the character index of the end of the text selection.
 - 
setSelEndpublic void setSelEnd(int newEnd) Sets the character index of the end of the text selection.
 - 
setSelectionpublic void setSelection(int newStartEnd) Sets the character index of the text cursor.
 - 
setSelectionpublic void setSelection(int newStart, int newEnd)Sets the character index of the start and end of the text selection.
 - 
getFontScalepublic float getFontScale() Returns the scale applied to text when editing.
 - 
setFontScalepublic void setFontScale(float aScale) Sets the scale applied to text when editing.
 - 
getTextLayoutpublic RMTextLayout getTextLayout() Returns the configured text layout used to layout text.
 - 
setTextLayoutpublic void setTextLayout(RMTextLayout aLayout) Sets the text layout for this text editor.
 - 
getInputAttributespublic java.util.Map getInputAttributes() Returns the map of attributes applied to any inputted characters.
 - 
setInputAttributepublic void setInputAttribute(java.lang.String aKey, java.lang.Object aValue)Sets the attributes that are applied to current selection or newly typed chars.
 - 
getInputParagraphpublic RMParagraph getInputParagraph() Returns the paragraph of the current selection or cursor position.
 - 
setInputParagraphpublic void setInputParagraph(RMParagraph ps) Sets the paragraph of the current selection or cursor position.
 - 
getStringpublic java.lang.String getString() Returns the plain string of the xstring being edited.
 - 
getColorpublic RMColor getColor() Returns the color of the current selection or cursor.
 - 
setColorpublic void setColor(RMColor color) Sets the color of the current selection or cursor.
 - 
getFontpublic RMFont getFont() Returns the font of the current selection or cursor.
 - 
setFontpublic void setFont(RMFont font) Sets the font of the current selection or cursor.
 - 
getFormatpublic RMFormat getFormat() Returns the format of the current selection or cursor.
 - 
setFormatpublic void setFormat(RMFormat aFormat) Sets the format of the current selection or cursor, after trying to expand the selection to encompase currently selected, @-sign deliniated key.
 - 
smartFindFormatRangepublic RMRange smartFindFormatRange() This method returns the range of the @-sign delinated key closest to the current selection (or null if not found).
 - 
isUnderlinedpublic boolean isUnderlined() Returns whether current selection is underlined.
 - 
setUnderlinedpublic void setUnderlined(boolean aFlag) Sets whether current selection is underlined.
 - 
getOutlinepublic RMXString.Outline getOutline() Returns whether current selection is outlined.
 - 
setOutlinepublic void setOutline(RMXString.Outline anOutline) Sets whether current selection is outlined.
 - 
setSuperscriptpublic void setSuperscript() Sets current selection to superscript.
 - 
setSubscriptpublic void setSubscript() Sets current selection to subscript.
 - 
getAlignpublic byte getAlign() Returns the alignment for current selection.
 - 
setAlignpublic void setAlign(int align) Sets the alignment for current selection.
 - 
getCharSpacingpublic float getCharSpacing() Returns the character spacing of the current selection or cursor.
 - 
setCharSpacingpublic void setCharSpacing(float aValue) Returns the character spacing of the current selection or cursor.
 - 
getLineSpacingpublic float getLineSpacing() Returns the line spacing for current selection.
 - 
setLineSpacingpublic void setLineSpacing(float aHeight) Sets the line spacing for current selection.
 - 
getLineGappublic float getLineGap() Returns the line gap for current selection.
 - 
setLineGappublic void setLineGap(float aHeight) Sets the line gap for current selection.
 - 
getLineHeightMinpublic float getLineHeightMin() Returns the min line height for current selection.
 - 
setLineHeightMinpublic void setLineHeightMin(float aHeight) Sets the min line height for current selection.
 - 
getLineHeightMaxpublic float getLineHeightMax() Returns the maximum line height for a line of text (even if font size would dictate higher).
 - 
setLineHeightMaxpublic void setLineHeightMax(float aHeight) Sets the maximum line height for a line of text (even if font size would dictate higher).
 - 
getListenerpublic RMTextEditor.Listener getListener(int anIndex) Return the listener at the given index.
 - 
addListenerpublic void addListener(RMTextEditor.Listener aTEL) Adds a listener.
 - 
removeListenerpublic void removeListener(RMTextEditor.Listener aTEL) Removes a listener.
 - 
textDidChangepublic void textDidChange() Called when characters where added, updated or deleted.
 - 
setNeedsRepaintpublic void setNeedsRepaint() Tell the text editor listener that editor needs repaint.
 - 
replacepublic void replace(java.lang.String aString) Replaces the current selection with the given string.
 - 
replacepublic void replace(RMXString aString) Replaces the current selection with the given xstring.
 - 
cutpublic void cut() Copies the current selection onto the clip board, then deletes the current selection.
 - 
copypublic void copy() Copies the current selection onto the clipboard.
 - 
pastepublic void paste() Pasts the current clipboard data over the current selection.
 - 
deletepublic void delete() Deletes the current selection.
 - 
selectAllpublic void selectAll() Selects all the characters in the text editor.
 - 
keyForwardpublic void keyForward() Moves the insertion point forward a character (or if a range is selected, moves to end of range).
 - 
keyBackwardpublic void keyBackward() Moves the insertion point backward a character (or if a range is selected, moves to beginning of range).
 - 
keyUppublic void keyUp() Moves the insertion point up a line, trying to preserve distance from beginning of line.
 - 
keyDownpublic void keyDown() Moves the insertion point down a line, trying preserve distance from beginning of line.
 - 
lineStartpublic void lineStart() Moves the insertion point to the beginning of line.
 - 
lineEndpublic void lineEnd() Moves the insertion point to the end of line.
 - 
deleteForwardpublic void deleteForward() Deletes the character in front of the insertion point.
 - 
deleteToLineEndpublic void deleteToLineEnd() Deletes the characters from the insertion point to the end of the line.
 - 
getHeightToFitpublic float getHeightToFit() Returns the height needed to display all characters.
 - 
processKeyEventpublic void processKeyEvent(java.awt.event.KeyEvent e) Handles key events.
 - 
mousePressedpublic void mousePressed(java.awt.event.MouseEvent e, RMPoint location)Handles mouse pressed.
 - 
mouseDraggedpublic void mouseDragged(java.awt.event.MouseEvent e, RMPoint location)Handles mouse dragged.
 - 
mouseReleasedpublic void mouseReleased(java.awt.event.MouseEvent e, RMPoint location)Handles mouse released.
 - 
paintLayoutpublic void paintLayout(java.awt.Graphics2D g, float opacity)Paints the text editor (with an opacity value).
 - 
paintLayoutpublic static void paintLayout(RMTextEditor aTextEditor, RMTextLayout aTextLayout, java.awt.Graphics2D g, float opacity) Paints a given layout in a given graphics.
 - 
getSelectionPathpublic static java.awt.geom.GeneralPath getSelectionPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout) Returns a path for the current selection.
 - 
getSpellingPathpublic static java.awt.geom.GeneralPath getSpellingPath(RMTextEditor aTextEditor, RMTextLayout aTextLayout) Returns a path for misspelled word underlining.
 
- 
 
-