org.odftoolkit.simple.common.navigation
Class CellSelection

java.lang.Object
  extended by org.odftoolkit.simple.common.navigation.Selection
      extended by org.odftoolkit.simple.common.navigation.TextSelection
          extended by org.odftoolkit.simple.common.navigation.CellSelection

public class CellSelection
extends TextSelection

Based on TextSelection, CellSelection updates table cell value and value type when the cell text is replaced by other content. This is a more complete realization than TextSelection for cell content replacement, which keeps the synchronization among cell value, value type and display text.

Since:
0.3
See Also:
TextSelection, CellValueAdapter

Method Summary
 void advancedReplaceWith(String newText)
          Replace the text content of selection with a new string.
 void advancedReplaceWith(String newText, CellValueAdapter adapter)
          Replace the text content of selection with a new string.
 Cell getCell()
          Get the selected table cell.
 void replaceWith(String newText)
          Replace the text content of selection with a new string.
 
Methods inherited from class org.odftoolkit.simple.common.navigation.TextSelection
addComment, addHref, applyStyle, createSpanElement, cut, getContainerElement, getElement, getIndex, getText, newTextSelection, pasteAtEndOf, pasteAtFrontOf, refresh, refreshAfterFrontalDelete, refreshAfterFrontalInsert, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

replaceWith

public void replaceWith(String newText)
                 throws InvalidNavigationException
Replace the text content of selection with a new string. The cell value type will be updated as "string" after replacement.

Overrides:
replaceWith in class TextSelection
Parameters:
newText - the replace text String
Throws:
InvalidNavigationException - if the selection is unavailable.
See Also:
Cell.setValueType(String), Cell.setStringValue(String)

advancedReplaceWith

public void advancedReplaceWith(String newText,
                                CellValueAdapter adapter)
                         throws InvalidNavigationException
Replace the text content of selection with a new string. The cell value and value type will be updated follow by the rules which are designed in the CellValueAdapter.

Parameters:
newText - the replace text String
adapter - the CellValueAdapter used to adapt cell value and value type
Throws:
InvalidNavigationException - if the selection is unavailable.
See Also:
replaceWith(String), CellValueAdapter

advancedReplaceWith

public void advancedReplaceWith(String newText)
                         throws InvalidNavigationException
Replace the text content of selection with a new string. The cell value and value type will be updated follow by the rules which are designed in the DefaultCellValueAdapter.

Parameters:
newText - the replace text String
Throws:
InvalidNavigationException - if the selection is unavailable.
See Also:
DefaultCellValueAdapter

getCell

public Cell getCell()
Get the selected table cell.

Returns:
the selected table cell


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