Package subjectdata :: Module SetCells :: Class SetCells
[show private | hide private]
[frames | no frames]

Class SetCells

Command --+
          |
         SetCells


Command that execute all the actions that modify the dictionnary holding the cells of a SSheetData object.
Method Summary
  __init__(self, cells)
SetCells's constructor.
bool canRedo(self)
Returns true if it is possible to redo
bool canUndo(self)
Returns true if it is possible to undo
tuple (bool, string) execute(self, nextState)
Update __cells with the data in nextState.
  reexecute(self)
Redo the next action.
  unexecute(self)
Undo the last action.
bool __areCurCellsAffected(self, nextCells)
Before applying an action on __cells, verify that there is at least one cell that is modified.
  __backupAffectedCells(self, nextCells)
Remember an action to be able to undo/redo it.
tuple (list of SSheetCell, string) __createCells(self, state)
Transform a SSheetState into an equivalent list of SSheetCell.
SSheetCell __getCell(self, cellCoord)
Return the cell mapped by cellCoord.
CellValue __getCellAST(self, cellCoord)
Return the ast of the cell located at cellCoord.
string __getCellFormula(self, cellCoord)
Return the formula of the cell located at cellCoord.
CellValue __getCellValue(self, cellCoord)
Return the value of the cell located at cellCoord.
  __hasCell(self, cellCoord)
Returns true if __cells has a key cellCoord
  __putCell(self, cell)
Put cell into __cells.
list of SSheetCell __retrieveNextCells(self)
Get the cells of the next action (to redo)
list of SSheetCell __retrievePreviousCells(self)
Get the cells of the previous action (to undo)
  __setNextCellsAsCurrent(self)
Set the next state (in history) as being current.
  __setPreviousCellsAsCurrent(self)
Set the previous state (in history) as being current.

Method Details

__init__(self, cells)
(Constructor)

SetCells's constructor. Takes a reference to the dictionnary holding the cells of a SSheetData object.
Parameters:
cells - Dictionnary holding cell information.
           (type=hashtable mapping CellCoord to SSheetCell)
Overrides:
subjectdata.Command.Command.__init__

canRedo(self)

Returns true if it is possible to redo
Returns:
bool

canUndo(self)

Returns true if it is possible to undo
Returns:
bool

execute(self, nextState)

Update __cells with the data in nextState. Return a tuple to propagate parse errors. The first element of the tuple is true if the execute was a success, false otherwise. The second element is the error message.
Parameters:
nextState - state that updates __cells
           (type=SSheetState)
Returns:
tuple (bool, string)
Overrides:
subjectdata.Command.Command.execute

reexecute(self)

Redo the next action.
Overrides:
subjectdata.Command.Command.reexecute

unexecute(self)

Undo the last action.
Overrides:
subjectdata.Command.Command.unexecute

__areCurCellsAffected(self, nextCells)

Before applying an action on __cells, verify that there is at least one cell that is modified. To prevent from undoing/redoing an action that changed nothing!
Parameters:
nextCells - list of the cells that will be putted in __cells
           (type=list of SSheetCell)
Returns:
bool

__backupAffectedCells(self, nextCells)

Remember an action to be able to undo/redo it.
Parameters:
nextCells - cells that will be putted in __cells
           (type=list of SSheetCell)

__createCells(self, state)

Transform a SSheetState into an equivalent list of SSheetCell. If the list Of SSheetCells is None, creating the cells failed due to a parse error. errMsg describe the parse error.
Parameters:
state - The state to be transformed into cells
           (type=SSheetState)
Returns:
tuple (list of SSheetCell, string)

__getCell(self, cellCoord)

Return the cell mapped by cellCoord. Returns an empty cell if cellCoord is not present in __cells.
Parameters:
cellCoord - cell coordinate
           (type=CellCoord)
Returns:
SSheetCell

__getCellAST(self, cellCoord)

Return the ast of the cell located at cellCoord. Returns None if cellCoord is not present in __cells.
Parameters:
cellCoord - cell coordinate
           (type=CellCoord)
Returns:
CellValue

__getCellFormula(self, cellCoord)

Return the formula of the cell located at cellCoord. Returns an empty string if cellCoord is not present in __cells.
Parameters:
cellCoord - cell coordinate
           (type=CellCoord)
Returns:
string

__getCellValue(self, cellCoord)

Return the value of the cell located at cellCoord. Returns an empty value if cellCoord is not present in __cells.
Parameters:
cellCoord - cell coordinate
           (type=CellCoord)
Returns:
CellValue

__hasCell(self, cellCoord)

Returns true if __cells has a key cellCoord
Parameters:
cellCoord - cell coordinate
           (type=CellCoord)

__putCell(self, cell)

Put cell into __cells. If cell is empty, delete the corresponding cell located in __cells.
Parameters:
cell - cell
           (type=SSheetCell)

__retrieveNextCells(self)

Get the cells of the next action (to redo)
Returns:
list of SSheetCell

__retrievePreviousCells(self)

Get the cells of the previous action (to undo)
Returns:
list of SSheetCell

__setNextCellsAsCurrent(self)

Set the next state (in history) as being current. (used just after redo)

__setPreviousCellsAsCurrent(self)

Set the previous state (in history) as being current. (used just after undo)

Generated by Epydoc 2.1 on Thu Aug 26 22:55:24 2004 http://epydoc.sf.net