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

Class SSheetData

Subject --+
          |
         SSheetData


Class encapsulating the data of a spreadsheet. SSheetData is the Subject in the Observer pattern and communicates with a set of Observers. SSheetData objects are created by a SubjectManager.
Method Summary
  __init__(self, subjectManager, ID, minCol, minRow, maxCol, maxRow)
  attach(self, observer)
Attach the specified observer to this subject.
  canRedo(self)
Returns True if an action can be redone
  canUndo(self)
Returns True if an action can be undone
  copy(self, cellCoordA, cellCoordB)
Backup the cells located within the specified cell coordinates.
  detach(self, observer)
Detach the specified observer from this subject.
  exportToFile(self, filename)
Export the contents of the spreadsheet to a file.
  notify(self)
Notify all observers that a change has been performed on this subject.
  redo(self)
Redo the most recent action performed, if possible.
  undo(self)
Undo the previous action performed, if possible
    Accessors
SubjectManager getSubjectManager(self)
Returns the subject manager managing this subject
  getState(self, cellCoordA, cellCoordB)
Return a SSheetState object encapsulating each cell contained in the requested cell range.
Tuple (CellCoord , CellCoord) getLimits(self)
Returns a tuple of cell coordinates representing the boundaries of the spreadsheet.
int getID(self)
Returns the ID of this SSheetData
    Undoable/Redoable Actions
  paste(self, cellCoordA, cellCoordB)
Paste the cells saved previously with a call to copy() into the requested range.
bool importFromFile(self, filename)
Import the contents of filename into the spreadsheet, which is emptied first.
  setState(self, state)
Update the state of this object, evaluate the formulas and notify the observers.

Method Details

getID(self)

Returns the ID of this SSheetData
Returns:
int

getLimits(self)

Returns a tuple of cell coordinates representing the boundaries of the spreadsheet.
Returns:
Tuple (CellCoord , CellCoord)

getState(self, cellCoordA=None, cellCoordB=None)

Return a SSheetState object encapsulating each cell contained in the requested cell range. If no cell coordinates are specified, return the complete state. Note: cells AST are NOT returned. Order is not important.
Parameters:
cellCoordA - first conrner of the range (facultative)
           (type=CellCoord)
cellCoordB - second corner of the range (facultative)
           (type=CellCoord)
Overrides:
subjectdata.Subject.Subject.getState

getSubjectManager(self)

Returns the subject manager managing this subject
Returns:
SubjectManager

paste(self, cellCoordA, cellCoordB)

Paste the cells saved previously with a call to copy() into the requested range. Copy all cells even if rangeTuple is smaller than the saved range. Note: The order of the cell coordinates is not important TODO: Copy multiple times if the height/width of the range is a multiple of the saved height/width
Parameters:
cellCoordA - The first cell coordinate
           (type=CellCoord)
cellCoordB - The second cell coordinate
           (type=CellCoord)

importFromFile(self, filename)

Import the contents of filename into the spreadsheet, which is emptied first. Returns True on success, False otherwise.
Parameters:
filename - The name of the file
Returns:
bool

setState(self, state)

Update the state of this object, evaluate the formulas and notify the observers. Note: Cell Coordinates that are not present in state are NOT modified. To explicitely delete the data of a cell coordinate, it must be present in state (pointing to empty formula, value, ast).
Parameters:
state - The state to be setted
           (type=SSheetState)
Overrides:
subjectdata.Subject.Subject.setState

attach(self, observer)

Attach the specified observer to this subject. It will now be notified when this subject is modified.
Parameters:
observer - The observer to be attached
           (type=Observer)

canRedo(self)

Returns True if an action can be redone

canUndo(self)

Returns True if an action can be undone

copy(self, cellCoordA, cellCoordB)

Backup the cells located within the specified cell coordinates. Note: The order is not important.
Parameters:
cellCoordA - The first cell coordinate
           (type=CellCoord)
cellCoordB - The second cell coordinate
           (type=CellCoord)

detach(self, observer)

Detach the specified observer from this subject. It will no longer be notified of changes to this subject.
Parameters:
observer - The observer to be detached
           (type=Observer)

exportToFile(self, filename)

Export the contents of the spreadsheet to a file. Returns True on success, False otherwise.
Parameters:
filename - The name of the file
           (type=string @rtype bool)

notify(self)

Notify all observers that a change has been performed on this subject. The observers will now retrieve the state and update themselves.
Overrides:
subjectdata.Subject.Subject.notify

redo(self)

Redo the most recent action performed, if possible.

undo(self)

Undo the previous action performed, if possible

Generated by Epydoc 2.1 on Tue Aug 17 18:20:06 2004 http://epydoc.sf.net