| java.lang.Object com.ibm.richtext.textformat.TextOffset
TextOffset | final public class TextOffset (Code) | | A TextOffset indicates both an integer offset into text and a placement
on one of the characters adjacent to the offset. An offset is a
position between two characters; offset n
is between character n-1 and character n. The placement specifies whether
it is associated with the character
after the offset
(character n) or the character before the offset (character n-1).
Knowing which character the TextOffset is associated with is necessary
when displaying carets. In bidirectional text, a single offset may
have two distinct carets. Also, in multiline text, an offset at a line
break has a possible caret on each line.
Most clients will not be interested in the placement, and will just use
the offset.
|
Field Summary | |
final public static boolean | AFTER_OFFSET Indicates that the TextOffset is associated with character
fOffset - ie the character after its offset. | final public static boolean | BEFORE_OFFSET Indicates that the TextOffset is associated with character
fOffset - 1 - ie the character before its offset. | final static String | COPYRIGHT | public int | fOffset The offset into the text. | public boolean | fPlacement The placement - before or after. |
Constructor Summary | |
public | TextOffset(int offset) Constructs a new TextOffset
Parameters: offset - the offset into the text to represent. | public | TextOffset() Constructs a new TextOffset at 0, with placement AFTER_OFFSET. | public | TextOffset(int offset, boolean placement) Constructs a new TextOffset with the given offset and placement. | public | TextOffset(TextOffset rhs) Constructs a new TextOffset from an existing one. |
AFTER_OFFSET | final public static boolean AFTER_OFFSET(Code) | | Indicates that the TextOffset is associated with character
fOffset - ie the character after its offset.
|
BEFORE_OFFSET | final public static boolean BEFORE_OFFSET(Code) | | Indicates that the TextOffset is associated with character
fOffset - 1 - ie the character before its offset.
|
fOffset | public int fOffset(Code) | | The offset into the text.
|
fPlacement | public boolean fPlacement(Code) | | The placement - before or after.
|
TextOffset | public TextOffset(int offset)(Code) | | Constructs a new TextOffset
Parameters: offset - the offset into the text to represent. Placement is implicitly AFTER_OFFSET. |
TextOffset | public TextOffset()(Code) | | Constructs a new TextOffset at 0, with placement AFTER_OFFSET.
|
TextOffset | public TextOffset(int offset, boolean placement)(Code) | | Constructs a new TextOffset with the given offset and placement.
Parameters: offset - the offset into the text Parameters: placement - indicates the position of the caret; one of BEFORE_OFFSET or AFTER_OFFSET |
TextOffset | public TextOffset(TextOffset rhs)(Code) | | Constructs a new TextOffset from an existing one.
Parameters: rhs - the TextOffset to copy |
assign | public void assign(TextOffset other)(Code) | | Copy the value of another TextOffset into this
Parameters: other - the TextOffset to copy |
equals | public boolean equals(Object other)(Code) | | Compare this to another Object.
|
equals | public boolean equals(TextOffset other)(Code) | | Return true if offset and placement are the same.
Parameters: other - offset to compare against true if both offsets are equal |
greaterThan | public boolean greaterThan(TextOffset other)(Code) | | Return true if this offset is 'greaterThan' other. If the fOffset fields are equal, the
placement field is considered, and AFTER_OFFSET is considered 'greaterThan' BEFORE_OFFSET.
Parameters: other - the other offset true if this offset appears after other |
hashCode | public int hashCode()(Code) | | Return the hashCode for this object.
|
lessThan | public boolean lessThan(TextOffset other)(Code) | | Return true if this offset is 'lessThan' other. If the fOffset fields are equal, the
placement field is considered, and BEFORE_OFFSET is considered 'lessThan' AFTER_OFFSET.
Parameters: other - the other offset true if this offset appears before other |
setOffset | public void setOffset(int offset, boolean placement)(Code) | | Set the value of the TextOffset
Parameters: offset - the offset into the text Parameters: placement - indicates the position of the caret; one of BEFORE_OFFSET or AFTER_OFFSET |
toString | public String toString()(Code) | | Return a string representation of this object.
|
|
|