public abstract class CellExtension extends Object implements Cell, CellListener
Constructor and Description |
---|
CellExtension(Cell delegate,
String name)
Creates a new cell extension.
|
Modifier and Type | Method and Description |
---|---|
void |
addCellListener(CellListener listener)
Registers the given listener on the cell.
|
void |
cellCleared(Cell cell)
Invoked when a cell has been cleared.
|
void |
cellCopied(Cell cell,
Cell source)
Invoked when a cell has been copied.
|
void |
clear()
Clears the content of the cell.
|
int |
compareTo(Cell cell) |
void |
contentChanged(Cell cell)
Invoked when the content of a cell has been changed.
|
void |
copyFrom(Cell source)
Copies all data from the source cell to this one.
|
void |
dependentsChanged(Cell cell)
Invoked when a new dependent has been registered on a cell,
or when an old one has been removed.
|
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.
|
Cell |
getDelegate()
Returns the extension's delegate.
|
SortedSet<Cell> |
getDependents()
Returns the dependents of the cell, i.e. the cells that contain a reference
to the cell in their formula.
|
Cell |
getExtension(String name)
Returns the extension with the given key.
|
Formula |
getFormula()
Returns an expression representing the cell's formula.
|
String |
getName()
Returns the name of the extension to which the cell extension belongs.
|
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.
|
String |
toString() |
void |
valueChanged(Cell cell)
Invoked when the value of a cell has changed, either by a change in
its content, or by a change of value in one of its precedents.
|
public CellExtension(Cell delegate, String name)
delegate
- the delegate of the extensionname
- the name of the extension to which the cell extension belongspublic final Cell getDelegate()
public final String getName()
public final Spreadsheet getSpreadsheet()
Cell
getSpreadsheet
in interface Cell
public final Address getAddress()
Cell
getAddress
in interface Cell
public final Value getValue()
Cell
public final String getContent()
Cell
getContent
in interface Cell
public final Formula getFormula()
Cell
getFormula
in interface Cell
public final void setContent(String content) throws FormulaCompilationException
Cell
setContent
in interface Cell
FormulaCompilationException
- if an incorrectly formatted formula was enteredpublic final SortedSet<Cell> getPrecedents()
Cell
getPrecedents
in interface Cell
public final SortedSet<Cell> getDependents()
Cell
getDependents
in interface Cell
public final void copyFrom(Cell source)
Cell
public final void moveFrom(Cell source)
Cell
public final void addCellListener(CellListener listener)
Cell
addCellListener
in interface Cell
listener
- the listener to be addedpublic final void removeCellListener(CellListener listener)
Cell
removeCellListener
in interface Cell
listener
- the listener to be removedpublic final CellListener[] getCellListeners()
Cell
getCellListeners
in interface Cell
public final Cell getExtension(String name)
Extensible
getExtension
in interface Extensible<Cell>
name
- the name of the extension (case-insensitive)public final int compareTo(Cell cell)
compareTo
in interface Comparable<Cell>
public void valueChanged(Cell cell)
CellListener
valueChanged
in interface CellListener
cell
- the cell that was modifiedpublic void contentChanged(Cell cell)
CellListener
contentChanged
in interface CellListener
cell
- the cell that was modifiedpublic void dependentsChanged(Cell cell)
CellListener
dependentsChanged
in interface CellListener
cell
- the cell that was modifiedpublic void cellCleared(Cell cell)
CellListener
cellCleared
in interface CellListener
cell
- the cell that was modifiedpublic void cellCopied(Cell cell, Cell source)
CellListener
cellCopied
in interface CellListener
cell
- the cell that was modifiedsource
- the cell from which data was copied