org.odftoolkit.simple.common.navigation
Class Selection

java.lang.Object
  extended by org.odftoolkit.simple.common.navigation.Selection
Direct Known Subclasses:
FieldSelection, ImageSelection, ParagraphSelection, TableSelection, TextDocumentSelection, TextSelection

public abstract class Selection
extends Object

Selection describes one of the matched results, which is recognized by the container element, the start index of the text content in this element and the text content.


Field Summary
protected  Navigation search
           
 
Constructor Summary
Selection()
           
 
Method Summary
abstract  void cut()
          Cut current Selection.
 OdfElement getElement()
          Get the container element of this Selection.
 int getIndex()
          Get the start index of the text content in the container element.
 Navigation getNavigation()
           
abstract  void pasteAtEndOf(Selection positionItem)
          Paste current Selection at end of the specified position Selection.
abstract  void pasteAtFrontOf(Selection positionItem)
          Paste current Selection at front of the specified position Selection.
protected abstract  void refresh(int offset)
          A quick method to update the index of this Selection.
protected abstract  void refreshAfterFrontalDelete(Selection deletedItem)
          When a selected item has been deleted, the Selections after this deleted Selection should be refreshed, as these Selections index have been changed.
protected abstract  void refreshAfterFrontalInsert(Selection insertedItem)
          When a selected item has been inserted, the Selection after the inserted item should be refresh, as these Selections index have been changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

search

protected Navigation search
Constructor Detail

Selection

public Selection()
Method Detail

getNavigation

public Navigation getNavigation()

getElement

public OdfElement getElement()
Get the container element of this Selection.

Returns:
the container element

getIndex

public int getIndex()
Get the start index of the text content in the container element. This is only meaningful for TextSelection and its sub classes, other type of Selection will return 0.

Returns:
the start index of the container element

cut

public abstract void cut()
                  throws InvalidNavigationException
Cut current Selection.

Throws:
InvalidNavigationException

pasteAtFrontOf

public abstract void pasteAtFrontOf(Selection positionItem)
                             throws InvalidNavigationException
Paste current Selection at front of the specified position Selection.

Parameters:
positionItem - the position Selection
Throws:
InvalidNavigationException

pasteAtEndOf

public abstract void pasteAtEndOf(Selection positionItem)
                           throws InvalidNavigationException
Paste current Selection at end of the specified position Selection.

Parameters:
positionItem - the position Selection
Throws:
InvalidNavigationException

refreshAfterFrontalDelete

protected abstract void refreshAfterFrontalDelete(Selection deletedItem)
When a selected item has been deleted, the Selections after this deleted Selection should be refreshed, as these Selections index have been changed.

Parameters:
deletedItem - the deleted Selection

refreshAfterFrontalInsert

protected abstract void refreshAfterFrontalInsert(Selection insertedItem)
When a selected item has been inserted, the Selection after the inserted item should be refresh, as these Selections index have been changed.

Parameters:
insertedItem - the inserted Selection

refresh

protected abstract void refresh(int offset)
A quick method to update the index of this Selection.

Parameters:
offset - the offset that the index should be added.


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.