csheets.core
Interface Cell

All Superinterfaces:
Comparable<Cell>, Extensible<Cell>, Serializable
All Known Implementing Classes:
AssertableCell, CellExtension, CellImpl, StylableCell, TestableCell

public interface Cell
extends Comparable<Cell>, Extensible<Cell>, Serializable

A cell in a spreadsheet.

The cell has content, which can be interpreted in different ways:

Author:
Einar Pehrson

Method Summary
 void addCellListener(CellListener listener)
          Registers the given listener on the cell.
 void clear()
          Clears the content of the cell.
 void copyFrom(Cell source)
          Copies all data from the source cell to this one.
 Address getAddress()
          Returns the address of the cell.
 CellListener[] getCellListeners()
          Returns the listeners that have been registered on the cell.
 String getContent()
          Returns the content of the cell, as entered by the user.
 SortedSet<Cell> getDependents()
          Returns the dependents of the cell, i.e. the cells that contain a reference to the cell in their formula.
 Formula getFormula()
          Returns an expression representing the cell's formula.
 SortedSet<Cell> getPrecedents()
          Returns the precedents of the cell, i.e. the cells that the formula in the cell references.
 Spreadsheet getSpreadsheet()
          Returns the spreadsheet to which the cell belongs.
 Value getValue()
          Returns the value of the cell.
 void moveFrom(Cell source)
          Moves all data from the source cell to this one.
 void removeCellListener(CellListener listener)
          Removes the given listener from the cell.
 void setContent(String content)
          Sets the content of the cell and if it starts with the assignment operator attempts to parse a formula from it.
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface csheets.ext.Extensible
getExtension
 

Method Detail

getSpreadsheet

Spreadsheet getSpreadsheet()
Returns the spreadsheet to which the cell belongs.

Returns:
the spreadsheet to which the cell belongs

getAddress

Address getAddress()
Returns the address of the cell.

Returns:
the address of the cell

getValue

Value getValue()
Returns the value of the cell.

Returns:
the value of the cell

getContent

String getContent()
Returns the content of the cell, as entered by the user.

Returns:
the content of the cell

getFormula

Formula getFormula()
Returns an expression representing the cell's formula.

Returns:
the cell's formula, or null if the cell does not contain one

setContent

void setContent(String content)
                throws FormulaCompilationException
Sets the content of the cell and if it starts with the assignment operator attempts to parse a formula from it.

Throws:
FormulaCompilationException - if an incorrectly formatted formula was entered

clear

void clear()
Clears the content of the cell.


getPrecedents

SortedSet<Cell> getPrecedents()
Returns the precedents of the cell, i.e. the cells that the formula in the cell references.

Returns:
a set of the cell's precedents

getDependents

SortedSet<Cell> getDependents()
Returns the dependents of the cell, i.e. the cells that contain a reference to the cell in their formula.

Returns:
a set of the cells which depend on the cell

copyFrom

void copyFrom(Cell source)
Copies all data from the source cell to this one.

Parameters:
source - the cell from which data should be copied

moveFrom

void moveFrom(Cell source)
Moves all data from the source cell to this one.

Parameters:
source - the cell from which data should be moved

addCellListener

void addCellListener(CellListener listener)
Registers the given listener on the cell.

Parameters:
listener - the listener to be added

removeCellListener

void removeCellListener(CellListener listener)
Removes the given listener from the cell.

Parameters:
listener - the listener to be removed

getCellListeners

CellListener[] getCellListeners()
Returns the listeners that have been registered on the cell.

Returns:
the listeners that have been registered on the cell