Class Selection
java.lang.Object
org.odftoolkit.odfdom.incubator.search.Selection
- Direct Known Subclasses:
TextSelection
Abstract class Selection describe one of the matched results The selection can be recognized by
the container mElement, the start mIndex of the text content of this mElement and the text
content.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
cut()
cut the current selectionget the container mElement of this selectionint
getIndex()
get the start mIndex of the text content of the container mElement this is only meaningful for TextSelection.abstract void
pasteAtEndOf
(Selection positionitem) paste the current selection at end of the specified position selectionabstract void
pasteAtFrontOf
(Selection positionitem) paste the current selection at front of the specified position selectionprotected abstract void
refresh
(int offset) A quick method to update the mIndex of this selectionprotected abstract void
refreshAfterFrontalDelete
(Selection deleteditem) when a selected item has been delete, the selections after this deleted selection should be refresh because these selections mIndex will be changedprotected abstract void
refreshAfterFrontalInsert
(Selection inserteditem) when a selected item has been inserted, the selection after the inserted item should be refresh because these selections mIndex will be changed
-
Constructor Details
-
Selection
public Selection()
-
-
Method Details
-
getElement
get the container mElement of this selection- Returns:
- the container mElement
-
getIndex
public int getIndex()get the start mIndex of the text content of the container mElement this is only meaningful for TextSelection. other type Selection will return 0.- Returns:
- the start mIndex of the container mElement
-
cut
cut the current selection- Throws:
InvalidNavigationException
-
pasteAtFrontOf
paste the current selection at front of the specified position selection- Parameters:
positionitem
- the position selection- Throws:
InvalidNavigationException
-
pasteAtEndOf
paste the current selection at end of the specified position selection- Parameters:
positionitem
- the position selection- Throws:
InvalidNavigationException
-
refreshAfterFrontalDelete
when a selected item has been delete, the selections after this deleted selection should be refresh because these selections mIndex will be changed- Parameters:
deleteditem
- the deleted selection
-
refreshAfterFrontalInsert
when a selected item has been inserted, the selection after the inserted item should be refresh because these selections mIndex will be changed- Parameters:
inserteditem
- the inserted selection
-
refresh
protected abstract void refresh(int offset) A quick method to update the mIndex of this selection- Parameters:
offset
- the offset that the mIndex should be added
-