|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.core.client.JavaScriptObject
org.xwiki.gwt.dom.client.internal.ie.NativeRange
org.xwiki.gwt.dom.client.internal.ie.TextRange
public final class TextRange
A text range is a DOM fragment that usually starts and ends inside a text node. It can be used to visually select a continuous text fragment.
| Nested Class Summary | |
|---|---|
static class |
TextRange.Unit
A unit defining a fragment of a text range. |
| Constructor Summary | |
|---|---|
protected |
TextRange()
Default constructor. |
| Method Summary | |
|---|---|
void |
collapse(boolean toStart)
Moves the insertion point to the beginning or end of the current range. |
short |
compareEndPoints(RangeCompare how,
TextRange range)
Compares an end point of a TextRange object with an end point of another range. |
TextRange |
duplicate()
|
boolean |
expand(TextRange.Unit unit)
Expands the range so that partial units are completely contained. |
boolean |
findText(java.lang.String text,
int searchScope,
int flags)
Searches for text in the document and positions the start and end points of the range to encompass the search string. The value passed for the searchScope parameter controls the part of the document, relative to the range, that is searched. |
java.lang.String |
getHTML()
|
int |
getOffsetLeft()
Retrieves the calculated left position of this range's start point relative to the layout or coordinate parent, as specified by the offsetParent property. |
int |
getOffsetTop()
Retrieves the calculated top position of this range's start point relative to the layout or coordinate parent, as specified by the offsetParent property. |
Element |
getParentElement()
The parent element is the element that completely encloses the text in the range. |
java.lang.String |
getText()
|
boolean |
inRange(TextRange other)
Tests whether one range is contained within another. |
boolean |
isEqual(TextRange other)
Tests if this text range equals the given text range. |
int |
move(TextRange.Unit unit,
int count)
Collapses the given text range and moves the empty range by the given number of units. |
int |
moveEnd(TextRange.Unit unit,
int count)
Moves the end of this range by the given number of units. |
int |
moveStart(TextRange.Unit unit,
int count)
Moves the start of this range by the given number of units. |
void |
moveToElementText(Element element)
Moves the text range so that the start and end positions of the range encompass the text in the given element. |
void |
moveToPoint(int x,
int y)
Moves the start and end positions of this text range to the given point. |
static TextRange |
newInstance(Document doc)
Creates a new text range for the given document. |
void |
setEndPoint(RangeCompare how,
TextRange range)
Sets the end point of this range based on the end point of another range. |
void |
setHTML(java.lang.String html)
Pastes HTML text into this text range, replacing any previous text and HTML elements in the range. |
void |
setText(java.lang.String text)
|
| Methods inherited from class org.xwiki.gwt.dom.client.internal.ie.NativeRange |
|---|
getOwnerDocument, isTextRange, select |
| Methods inherited from class com.google.gwt.core.client.JavaScriptObject |
|---|
cast, createArray, createFunction, createObject, equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected TextRange()
| Method Detail |
|---|
public static TextRange newInstance(Document doc)
doc - The owner document of the created range.
public java.lang.String getHTML()
public void setHTML(java.lang.String html)
html - The HTML text to paste. The string can contain text and any combination of the HTML tags.public java.lang.String getText()
public void setText(java.lang.String text)
text - The text to be placed inside the range.public void collapse(boolean toStart)
toStart - if true moves the insertion point to the beginning of the text range. Otherwise, moves the
insertion point to the end of the text range.
public short compareEndPoints(RangeCompare how,
TextRange range)
how - Specifies which end points to compare.range - The range object to compare with this object.
public TextRange duplicate()
public int move(TextRange.Unit unit,
int count)
unit - Specifies the units to movecount - Specifies the number of units to move. This can be positive or negative.
public int moveEnd(TextRange.Unit unit,
int count)
unit - Specifies the units to move.count - Specifies the number of units to move. This can be positive or negative.
public int moveStart(TextRange.Unit unit,
int count)
unit - Specifies the units to move.count - Specifies the number of units to move. This can be positive or negative.
public void moveToElementText(Element element)
element - The element object to move to.public Element getParentElement()
public void setEndPoint(RangeCompare how,
TextRange range)
how - Specifies which end point of this text range should be moved and which of the given text range's end
points is the reference.range - The text range used as the reference.
public boolean findText(java.lang.String text,
int searchScope,
int flags)
text - The text to find.searchScope - The number of characters to search from the starting point of the range. A positive integer
indicates a forward search; a negative integer indicates a backward search.flags - One or more of the following flags to indicate the type of search:
| 0 | Default. Match partial words. |
| 1 | Match backwards. |
| 2 | Match whole words only. |
| 4 | Match case. |
| 131072 | Match bytes. |
| 536870912 | Match diacritical marks. |
| 1073741824 | Match Kashida character. |
| 2147483648 | Match AlefHamza character. |
public boolean isEqual(TextRange other)
other - the text range to compare with this text range.
public boolean inRange(TextRange other)
other - The text range that might be contained in this text range.
public boolean expand(TextRange.Unit unit)
unit - specifies the units that have to be completely included in the range
true if the range was successfully expanded, false otherwise
public void moveToPoint(int x,
int y)
The coordinates of the point must be in pixels and be relative to the upper-left corner of the window. The
resulting text range is empty, but you can expand and move the range using methods such as expand(Unit)
and moveEnd(Unit, int).
x - integer that specifies the horizontal offset relative to the upper-left corner of the window, in pixelsy - integer that specifies the vertical offset relative to the upper-left corner of the window, in pixelspublic int getOffsetLeft()
public int getOffsetTop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||