org.jopendocument.dom.spreadsheet
Class MutableCell<D extends ODDocument>

java.lang.Object
  extended by org.jopendocument.dom.ODNode
      extended by org.jopendocument.dom.StyledNode<S,D>
          extended by org.jopendocument.dom.ImmutableDocStyledNode<S,D>
              extended by org.jopendocument.dom.spreadsheet.Cell<D>
                  extended by org.jopendocument.dom.spreadsheet.MutableCell<D>
Type Parameters:
D - type of document

public class MutableCell<D extends ODDocument>
extends Cell<D>

A cell whose value can be changed.

Author:
Sylvain

Method Summary
 void clearValue()
           
static java.lang.String formatCurrency(java.lang.Number n, CellStyle defaultStyle)
           
static java.lang.String formatNumber(java.lang.Number n, CellStyle defaultStyle)
           
static java.lang.String formatPercent(java.lang.Number n, CellStyle defaultStyle)
           
 DataStyle getDataStyle()
           
 java.awt.Point getPoint()
           
 java.lang.String getStyleName()
           
 CellStyle.StyleTableCellProperties getTableCellProperties()
           
 int getX()
           
 int getY()
           
 void merge(int columnsSpanned, int rowsSpanned)
          Merge this cell and the following ones.
 void replaceBy(java.lang.String oldValue, java.lang.String newValue)
           
 void setBackgroundColor(java.awt.Color color)
           
 void setImage(java.io.File pic)
           
 void setImage(java.io.File pic, boolean keepRatio)
           
 void setImage(java.lang.String name, java.awt.Image img)
           
 void setValue(java.lang.Object obj)
           
 void setValue(java.lang.Object obj, boolean allowTypeChange)
           
 void setValue(java.lang.Object obj, ODValueType vt, boolean allowTypeChange, boolean lenient)
          Change the value of this cell.
 void unmerge()
           
 
Methods inherited from class org.jopendocument.dom.spreadsheet.Cell
getColumnsSpanned, getError, getFormula, getRowsSpanned, getTextValue, getTextValue, getTextValueMode, getValue, getValueType, isEmpty, isValid, setTextValueMode
 
Methods inherited from class org.jopendocument.dom.ImmutableDocStyledNode
getODDocument
 
Methods inherited from class org.jopendocument.dom.StyledNode
getPrivateStyle, getStyle, getStyleDesc, getStyleDesc, getStyleStyleDesc, setStyleName, setStyleName
 
Methods inherited from class org.jopendocument.dom.ODNode
getElement, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

formatNumber

public static java.lang.String formatNumber(java.lang.Number n,
                                            CellStyle defaultStyle)

formatPercent

public static java.lang.String formatPercent(java.lang.Number n,
                                             CellStyle defaultStyle)

formatCurrency

public static java.lang.String formatCurrency(java.lang.Number n,
                                              CellStyle defaultStyle)

getX

public final int getX()

getY

public final int getY()

getPoint

public final java.awt.Point getPoint()

clearValue

public void clearValue()

setValue

public void setValue(java.lang.Object obj)

setValue

public void setValue(java.lang.Object obj,
                     boolean allowTypeChange)
              throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

setValue

public void setValue(java.lang.Object obj,
                     ODValueType vt,
                     boolean allowTypeChange,
                     boolean lenient)
              throws java.lang.UnsupportedOperationException
Change the value of this cell.

Parameters:
obj - the new cell value.
vt - the value type.
allowTypeChange - if true obj and vt might be changed to allow the data style to format, e.g. from Boolean.FALSE to 0.
lenient - false to throw an exception if we can't format according to the ODF, true to try best-effort.
Throws:
java.lang.UnsupportedOperationException - if obj couldn't be formatted.

getDataStyle

public final DataStyle getDataStyle()

replaceBy

public void replaceBy(java.lang.String oldValue,
                      java.lang.String newValue)

unmerge

public final void unmerge()

merge

public final void merge(int columnsSpanned,
                        int rowsSpanned)
Merge this cell and the following ones. If this cell already spanned multiple columns/rows this method un-merge any additional cells.

Parameters:
columnsSpanned - number of columns to merge.
rowsSpanned - number of rows to merge.

getStyleName

public final java.lang.String getStyleName()

getTableCellProperties

public final CellStyle.StyleTableCellProperties getTableCellProperties()

setImage

public void setImage(java.io.File pic)
              throws java.io.IOException
Throws:
java.io.IOException

setImage

public void setImage(java.io.File pic,
                     boolean keepRatio)
              throws java.io.IOException
Throws:
java.io.IOException

setImage

public void setImage(java.lang.String name,
                     java.awt.Image img)
              throws java.io.IOException
Throws:
java.io.IOException

setBackgroundColor

public final void setBackgroundColor(java.awt.Color color)