|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.im.TextHitInfo
public final class TextHitInfo
Information about a document position returned by an enquiry ('hit-test') function, for example one taking an x-y point as its input. The information consists of a position, and a flag indicating whether the position is in left-to-right or right-to-left text. This flag
The position itself consists of an index into the document, which is a character edge defined by the number of UTF16 characters from the start of the document, and whether the position is a leading or trailing edge. In a document containing the three characters 'abc' the following distinct positions exist (l = leading, t = trailing)
0l a 1t 1l b 2t 2l c 3t
If the document contains bidirectional text, shown here as capitals, leading and trailing edges allow us to decide where to position the caret for editing text in one or the other script. For example, for the text 'abcDEFghi', displayed as 'abcFEDghi', we have
0l a 1t 1l b 2t 2l c 3t 6t F 5l 5t E 4l 4t D 3l 6l g 7t 7l h 8t 8l i 9t
Constructor Summary | ||
---|---|---|
TextHitInfo(int aIndex,
boolean aLeadingEdge)
Create a TextHitInfo instance given an index and a boolean
indicating whether or not the index is a leading edge. |
||
TextHitInfo(int aIndex,
boolean aLeadingEdge,
boolean aRightToLeft)
Create a TextHitInfo instance given an index and booleans
indicating whether or not the index is a leading edge, and whether or
not the position is in right-to-left text. |
Method Summary | ||
---|---|---|
Object |
clone()
Create a new TextHitInfo object by copying this object. |
|
boolean |
docPosLess(TextHitInfo aInfo)
Return a boolean indicating whether or not the document position of this TextHitInfo object
is less than the document position of the specified TextHitInfo object. |
|
boolean |
equals(TextHitInfo aInfo)
Return a boolean indicating whether or not the specified TextHitInfo 's document position is equal to this object. |
|
int |
getIndex()
Returns the current index. |
|
boolean |
getLeadingEdge()
Returns the leading edge of the current TextHitInfo
instance. |
|
static TextHitInfo |
leading(int aIndex)
Return a TextHitInfo on the leading edge of the
character at the specified charIndex . |
|
void |
set(int aIndex,
boolean aLeadingEdge)
Set the TextHitInfo instance given the new index and
leading edge values. |
|
void |
set(int aIndex,
boolean aLeadingEdge,
boolean aRightToLeft)
Set the TextHitInfo instance given the new index,
leading edge and right-to-left values. |
|
String |
toString()
Returns a string representation of the current TextHitInfo instance. |
|
static TextHitInfo |
trailing(int aIndex)
Return a TextHitInfo on the trailing edge of the character at
the specified aIndex . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TextHitInfo(int aIndex, boolean aLeadingEdge)
TextHitInfo
instance given an index and a boolean
indicating whether or not the index is a leading edge.
Set the flag indicating whether the position is in a right-to-left run of text, to false.
aIndex
- An index.aLeadingEdge
- true if the index is a leading edge, otherwise false.public TextHitInfo(int aIndex, boolean aLeadingEdge, boolean aRightToLeft)
TextHitInfo
instance given an index and booleans
indicating whether or not the index is a leading edge, and whether or
not the position is in right-to-left text.
aIndex
- An index.aLeadingEdge
- true if the index is a leading edge, otherwise false.aRightToLeft
- true if the position is in right-to-left text, otherwise false.Method Detail |
---|
public void set(int aIndex, boolean aLeadingEdge)
TextHitInfo
instance given the new index and
leading edge values.
Set the flag indicating whether the position is in a right-to-left run of text, to false.
aIndex
- The index value to set.aLeadingEdge
- true if the index is a leading edge, false otherwise.public void set(int aIndex, boolean aLeadingEdge, boolean aRightToLeft)
TextHitInfo
instance given the new index,
leading edge and right-to-left values.
aIndex
- The index value to set.aLeadingEdge
- true if the index is a leading edge, false otherwise.aRightToLeft
- true if the position is in right-to-left text, otherwise false.public boolean docPosLess(TextHitInfo aInfo)
TextHitInfo
object
is less than the document position of the specified TextHitInfo
object.
The value of the flag indicating whether the position is in a right-to-left run of text is irrelevant for this function because
in a particular state of a document it will be invariant for a given position.
aInfo
- The TextHitInfo
instance to compare.
public Object clone()
TextHitInfo
object by copying this object.
public boolean equals(TextHitInfo aInfo)
TextHitInfo
's document position is equal to this object.
The value of the flag indicating whether the position is in a right-to-left run of text is irrelevant for this function because
in a particular state of a document it will be invariant for a given position.
aInfo
- The TextHitInfo
instance to check.
public int getIndex()
public boolean getLeadingEdge()
TextHitInfo
instance.
TextHitInfo
object has a leading edge.public static TextHitInfo leading(int aIndex)
TextHitInfo
on the leading edge of the
character at the specified charIndex
. The same object is returned
for every call of this function.
aIndex
- The index of the character hit.
TextHitInfo
on the leading edge of the
character at the specified charIndex
.public static TextHitInfo trailing(int aIndex)
TextHitInfo
on the trailing edge of the character at
the specified aIndex
. The same object is returned
for every call of this function.
aIndex
- The index of the character hit.
TextHitInfo
on the trailing edge of the
character at the specified charIndex
.public String toString()
TextHitInfo
instance.
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal