public interface RangeMarker extends UserDataHolder, Segment
Document
which is automatically adjusted
as the document text is modified. Adding or deleting text before the marker
shifts the marker forward or backward; adding or deleting text within the marker
increases or decreases the length of the marked range by the respective offset. Adding
text at the start or end of the marker optionally extends the marker, depending on
setGreedyToLeft(boolean)
and setGreedyToRight(boolean)
settings. Deleting
the entire text range containing the marker causes the marker to become invalid.Document.createRangeMarker(int, int)
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<? super RangeMarker> |
BY_START_OFFSET |
BY_START_OFFSET_THEN_END_OFFSET, EMPTY_ARRAY
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
Document |
getDocument()
Returns the document to which the marker belongs.
|
int |
getEndOffset()
Returns the end offset of the text range covered by the marker.
|
int |
getStartOffset()
Returns the start offset of the text range covered by the marker.
|
boolean |
isGreedyToLeft() |
boolean |
isGreedyToRight() |
boolean |
isValid()
Checks if the marker has been invalidated by deleting the entire fragment of text
containing the marker.
|
void |
setGreedyToLeft(boolean greedy)
Sets the value indicating whether the text added exactly at the beginning of the
marker should be included in the text range of the marker.
|
void |
setGreedyToRight(boolean greedy)
Sets the value indicating whether the text added exactly at the end of the
marker should be included in the text range of the marker.
|
getUserData, putUserData
static final java.util.Comparator<? super RangeMarker> BY_START_OFFSET
Document getDocument()
int getStartOffset()
getStartOffset
in interface Segment
int getEndOffset()
getEndOffset
in interface Segment
boolean isValid()
void setGreedyToLeft(boolean greedy)
greedy
- true if text added at the beginning is included in the range, false otherwise.void setGreedyToRight(boolean greedy)
greedy
- true if text added at the end is included in the range, false otherwise.boolean isGreedyToRight()
boolean isGreedyToLeft()
void dispose()