|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.4.0) E13403-05 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OffsetMark
The OffsetMark
is used by the TextBuffer
to provide bookmark services. An OffsetMark
is
created by the client for a given offset, and will stick to
that offset across buffer modications.
As an example, let's suppose that a client (such as a Caret, for marking the beginning and ending of a selection region for highlighting) creates an OffsetMark #1 at offset 10 and OffsetMark #2 at offset 20. If a subsequent insert of 5 characters occurs at offset 15, then OffsetMark #1 will still point to offset 10, but OffsetMark #2 will now point to offset 25.
When removal of text occurs from the buffer, OffsetMarks which are located within the removed region will be adjusted to point to the beginning of the region. In the above example, if (after the insert) a subsequent remove of 10 characters occurs at offset 5, then OffsetMark #1 will now point to offset 5 (since it was in the removed region), while OffsetMark #2 will point to offset 15.
OffsetMarks are created by calling
with
the requested offset. They are maintained until clients explicitly
remove them by calling TextBuffer.addOffsetMark
. It is the clients
responsibility to ensure removal of unneeded OffsetMarks. This
frees the buffer from maintaining the removed Offsetmarks and also
allows the object to be properly garbage collected. TextBuffer.removeOffsetMark
OffsetMarks do not have finalizers to guarantee removal as finalizers are expensive (20-40 bytes per object with finalizer), and because both the client and buffer both maintain a reference to the mark. Because of the latter case, a separate object is required if proper release is implemented through finalizers (which means higher resource/object cost.) The moral of the story is that clients must remove OffsetMarks they no longer need.
Note that by default, marks bias to the right, or after the offset. This means that insertions at the offset will cause the offset mark to shift to the right. You can specify BIAS_LEFT when creating the mark to cause the bias to be to the left, or before the offset.
Field Summary | |
---|---|
static boolean |
BIAS_AFTER
Constant indicating that the bias of the mark is after the offset. |
static boolean |
BIAS_BEFORE
Constant indicating that the bias of the mark is before the offset. |
static boolean |
BIAS_DEFAULT
Constant for the default bias for marks. |
static boolean |
BIAS_LEFT
Constant indicating that the bias of the mark is to the left of the mark offset. |
static boolean |
BIAS_RIGHT
Constant indicating that the bias of the mark is to the right of the mark offset. |
Method Summary | |
---|---|
boolean |
getBias()
Fetches the bias of the mark. |
int |
getOffset()
Fetches the offset that this mark is currently pointing to. |
void |
setBias(boolean bias)
Sets the bias of the mark. |
void |
setOffset(int offset)
Sets the offset that this mark sticks to. |
Field Detail |
---|
static final boolean BIAS_LEFT
static final boolean BIAS_BEFORE
static final boolean BIAS_RIGHT
static final boolean BIAS_AFTER
static final boolean BIAS_DEFAULT
Method Detail |
---|
boolean getBias()
void setBias(boolean bias)
bias
- the bias to set for this markint getOffset()
OffsetMark
points tovoid setOffset(int offset)
offset
- the new offset
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.4.0) E13403-05 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |