Class TextSel
- java.lang.Object
- 
- com.inductiveautomation.snap.text.TextSel
 
- 
 public class TextSel extends java.lang.ObjectA class to represent a selection of text.
- 
- 
Constructor SummaryConstructors Constructor Description TextSel(Text aText, double x1, double y1, double x2, double y2, boolean isWordSel, boolean isParaSel)Returns the selected range that would result from the given two points.TextSel(Text aText, int aStart, int anEnd)Creates a new selection.TextSel(Text aText, int aStart, int anEnd, int anAnchor)Creates a new selection.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAnchor()Returns the anchor.intgetCharDown()Moves the selection index down a line, trying preserve distance from beginning of line.intgetCharLeft()Moves the selection index backward a character (or if a range is selected, moves to beginning of range).intgetCharRight()Moves the selection index forward a character (or if a range is selected, moves to end of range).intgetCharUp()Moves the selection index up a line, trying to preserve distance from beginning of line.intgetEnd()Returns the end.TextLinegetEndLine()Returns the line at selection end.intgetLineEnd()Moves the insertion point to next newline or text end.intgetLineStart()Moves the insertion point to the beginning of line.java.awt.geom.GeneralPathgetPath(double aWidth)Returns a path for two char indexes - it will be a a simple box with extensions for first/last lines.intgetSize()The length.intgetStart()Returns the start.TextLinegetStartLine()Returns the line at selection start.java.lang.StringgetString()Returns the selected text string.TextgetText()Returns the text.booleanisEmpty()Returns whether selection is empty.protected booleanisWordChar(char c)Returns whether a character should be considered is part of a word when WordSelecting.
 
- 
- 
- 
Constructor Detail- 
TextSelpublic TextSel(Text aText, int aStart, int anEnd) Creates a new selection.
 - 
TextSelpublic TextSel(Text aText, int aStart, int anEnd, int anAnchor) Creates a new selection.
 - 
TextSelpublic TextSel(Text aText, double x1, double y1, double x2, double y2, boolean isWordSel, boolean isParaSel) Returns the selected range that would result from the given two points.
 
- 
 - 
Method Detail- 
getTextpublic Text getText() Returns the text.
 - 
getStartpublic int getStart() Returns the start.
 - 
getEndpublic int getEnd() Returns the end.
 - 
getAnchorpublic int getAnchor() Returns the anchor.
 - 
getSizepublic int getSize() The length.
 - 
isEmptypublic boolean isEmpty() Returns whether selection is empty.
 - 
getStringpublic java.lang.String getString() Returns the selected text string.
 - 
getCharRightpublic int getCharRight() Moves the selection index forward a character (or if a range is selected, moves to end of range).
 - 
getCharLeftpublic int getCharLeft() Moves the selection index backward a character (or if a range is selected, moves to beginning of range).
 - 
getCharUppublic int getCharUp() Moves the selection index up a line, trying to preserve distance from beginning of line.
 - 
getCharDownpublic int getCharDown() Moves the selection index down a line, trying preserve distance from beginning of line.
 - 
getLineStartpublic int getLineStart() Moves the insertion point to the beginning of line.
 - 
getLineEndpublic int getLineEnd() Moves the insertion point to next newline or text end.
 - 
getStartLinepublic TextLine getStartLine() Returns the line at selection start.
 - 
getEndLinepublic TextLine getEndLine() Returns the line at selection end.
 - 
getPathpublic java.awt.geom.GeneralPath getPath(double aWidth) Returns a path for two char indexes - it will be a a simple box with extensions for first/last lines.
 - 
isWordCharprotected boolean isWordChar(char c) Returns whether a character should be considered is part of a word when WordSelecting.
 
- 
 
-