diva.gui
Class MultipageDocument

java.lang.Object
  extended by diva.gui.AbstractDocument
      extended by diva.gui.MultipageDocument
All Implemented Interfaces:
Document

public abstract class MultipageDocument
extends AbstractDocument

A document that contains a linear sequence of Pages. This class is useful for documents which their data into logical pages. Generally this class is most useful for partitioned documents where all the partitions are stored together. For partitions that are stored separately, it is probably easiest to just use separate documents. Note that a page can contain any kind of data, and the interpretation and graphical representation of a list of page is up to the concrete document class and the corresponding application. Other than containing a sequence of pages, this class is used the same as AbstractDocument and provides the same abstract methods.

Version:
$Id: MultipageDocument.java 57046 2010-01-27 23:35:53Z cxh $
Author:
John Reekie

Field Summary
private  MultipageModel _model
          The support object for pages.
(package private)  ModelParser _modelParser
          This parser is used by the document parser to read in each model in a page.
(package private)  ModelWriter _modelWriter
          This writer is used by the document writer to write out each model in a page.
(package private)  MultipageParser _parser
          The parser that reads in a document and parses it into a Document structure.
(package private)  java.lang.String _title
          The title associated with this document.
(package private)  MultipageWriter _writer
          The writer that can write this document to a stream during a save operation.
 
Constructor Summary
MultipageDocument(java.lang.String title, Application a, ModelParser parser, ModelWriter writer)
          Construct a multipage document that is owned by the given application
 
Method Summary
 void close()
          Close the document.
 MultipageModel getMultipageModel()
          Return the model associated with this document.
 java.lang.String getTitle()
          Return the title of this document.
 void open()
          Open the document from its current file.
 void save()
          Save the document to the current file.
 void saveAs(java.io.File file)
          Save the document to the given file.
 void saveAs(java.net.URL url)
          Throw an exception, as save to URLs is not supported.
 
Methods inherited from class diva.gui.AbstractDocument
addPropertyChangeListener, getApplication, getEditSupport, getFile, getShortTitle, getUndoManager, getURL, isDirty, isEditable, isWritable, removePropertyChangeListener, setDirty, setEditable, setFile, setURL, setWritable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_model

private MultipageModel _model
The support object for pages.


_writer

MultipageWriter _writer
The writer that can write this document to a stream during a save operation.


_parser

MultipageParser _parser
The parser that reads in a document and parses it into a Document structure. In this case, it reads a sketch document and outputs a SketchDocument object.


_modelWriter

ModelWriter _modelWriter
This writer is used by the document writer to write out each model in a page.


_modelParser

ModelParser _modelParser
This parser is used by the document parser to read in each model in a page.


_title

java.lang.String _title
The title associated with this document.

Constructor Detail

MultipageDocument

public MultipageDocument(java.lang.String title,
                         Application a,
                         ModelParser parser,
                         ModelWriter writer)
Construct a multipage document that is owned by the given application

Method Detail

close

public void close()
           throws java.lang.Exception
Close the document. This method doesn't do anything, as graph data doesn't change.

Specified by:
close in interface Document
Overrides:
close in class AbstractDocument
Throws:
java.lang.Exception - If the close operation fails.

getTitle

public java.lang.String getTitle()
Return the title of this document.

Specified by:
getTitle in interface Document
Overrides:
getTitle in class AbstractDocument
Returns:
The title.

getMultipageModel

public MultipageModel getMultipageModel()
Return the model associated with this document.


open

public void open()
          throws java.lang.Exception
Open the document from its current file. If successful, add a new Page to the document containing the model parsed from the current file.

Specified by:
open in interface Document
Specified by:
open in class AbstractDocument
Throws:
java.lang.Exception - If there is no file, or if the I/O operation failed.

save

public void save()
          throws java.lang.Exception
Save the document to the current file.

Specified by:
save in interface Document
Specified by:
save in class AbstractDocument
Throws:
java.lang.Exception - If there is no file, or if the I/O operation failed.

saveAs

public void saveAs(java.io.File file)
            throws java.lang.Exception
Save the document to the given file. Do not change the file attribute to the new File object.

Specified by:
saveAs in interface Document
Specified by:
saveAs in class AbstractDocument
Throws:
java.lang.Exception - If the I/O operation failed.
See Also:
AbstractDocument.save()

saveAs

public void saveAs(java.net.URL url)
Throw an exception, as save to URLs is not supported.

Specified by:
saveAs in interface Document
Specified by:
saveAs in class AbstractDocument
Throws:
java.lang.Exception - Always
See Also:
AbstractDocument.save()