com.mindfusion.diagramming
Class DiagramDocument

java.lang.Object
  extended by com.mindfusion.diagramming.DiagramBase
      extended by com.mindfusion.diagramming.DiagramDocument

public class DiagramDocument
extends DiagramBase

Represents a collection of diagram pages.


Constructor Summary
DiagramDocument()
           
 
Method Summary
 void addDiagramListener(DiagramListener listener)
          Registers listener so that it will receive events when users create, modify or delete diagram items.
 boolean getDirty()
          Gets a value indicating whether the document has changed since the last save.
 com.mindfusion.common.ObservableList<DiagramPage> getPages()
          Gets a list of the diagram pages contained in this document.
 void loadFrom(java.io.InputStream in)
          Loads the document contents from a stream.
 void loadFromFile(java.lang.String fileName)
          Loads the document from the specified file.
 void loadFromString(java.lang.String str)
          Loads a diagram from the specified string.
 void loadFromXml(org.w3c.dom.Document document)
          Loads the document from the specified Document object.
 void loadFromXml(java.lang.String fileName)
          Loads the document from the specified XML file.
 void removeDiagramListener(DiagramListener listener)
          Unregisters listener so that it will no longer receive diagram events.
 void saveTo(java.io.OutputStream out)
          Saves the diagram contents into a stream.
 void saveToFile(java.lang.String fileName)
          Saves the document to the specified file in a binary format.
 java.lang.String saveToString()
          Saves the diagram contents into a string.
 java.lang.String saveToString(int format, boolean includeUnalteredProperties)
          Saves the diagram contents into a string.
 void saveToXml(org.w3c.dom.Document document)
          Saves the document to the specified Document object.
 void saveToXml(org.w3c.dom.Document document, boolean includeUnalteredProperties)
          Saves the document to the specified Document object.
 void saveToXml(java.io.OutputStream stream, boolean includeUnalteredProperties)
          Saves the diagram to the specified XML document.
 void saveToXml(java.lang.String fileName)
          Saves the diagram to the specified XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramDocument

public DiagramDocument()
Method Detail

saveToFile

public void saveToFile(java.lang.String fileName)
                throws java.io.FileNotFoundException,
                       java.io.IOException
Saves the document to the specified file in a binary format.

Parameters:
fileName - The full path and name of the disk file where the document should be saved.
Throws:
java.io.FileNotFoundException
java.io.IOException

saveToXml

public void saveToXml(java.lang.String fileName)
               throws java.io.IOException,
                      XmlException
Saves the diagram to the specified XML document.

Parameters:
fileName - The full path and name of the disk file where the diagram should be saved.
Throws:
java.io.IOException
XmlException

saveToXml

public void saveToXml(java.io.OutputStream stream,
                      boolean includeUnalteredProperties)
               throws XmlException,
                      java.io.UnsupportedEncodingException
Saves the diagram to the specified XML document.

Parameters:
stream - An OutputStream where the XML markup should be serialized.
Throws:
XmlException
java.io.UnsupportedEncodingException

saveToXml

public void saveToXml(org.w3c.dom.Document document)
Saves the document to the specified Document object.

Parameters:
document - A Document object where the document should be saved.

saveToXml

public void saveToXml(org.w3c.dom.Document document,
                      boolean includeUnalteredProperties)
Saves the document to the specified Document object.

Parameters:
document - A XmlDocument object where the document should be saved.
includeUnalteredProperties - true if properties that have their default value should be saved; otherwise, false.

loadFromXml

public void loadFromXml(java.lang.String fileName)
                 throws XmlException,
                        java.io.IOException,
                        org.xml.sax.SAXException
Loads the document from the specified XML file.

Parameters:
fileName - The name of the XML file the data should be read from.
Throws:
XmlException
java.io.IOException
org.xml.sax.SAXException

loadFromXml

public void loadFromXml(org.w3c.dom.Document document)
Loads the document from the specified Document object.

Parameters:
document - A Document object from which to load the diagram data.

loadFromFile

public void loadFromFile(java.lang.String fileName)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Loads the document from the specified file.

Parameters:
fileName - The name of the file to load from.
Throws:
java.io.FileNotFoundException
java.io.IOException

saveTo

public void saveTo(java.io.OutputStream out)
            throws java.io.IOException
Saves the diagram contents into a stream.

Parameters:
out - An OutputStream where the diagram contents should be saved.
Throws:
java.io.IOException

loadFrom

public void loadFrom(java.io.InputStream in)
              throws java.io.IOException
Loads the document contents from a stream.

Parameters:
in - An InputStream from which to load the diagram contents.
Throws:
java.io.IOException

saveToString

public java.lang.String saveToString()
Saves the diagram contents into a string.

Returns:
A String containing the base64 encoded diagram contents.

saveToString

public java.lang.String saveToString(int format,
                                     boolean includeUnalteredProperties)
Saves the diagram contents into a string.

Parameters:
format - A SaveToStringFormat constant indicating the output format.
includeUnalteredProperties - true to serialize all property; false to serialize only properties with non-default values.
Returns:
A String containing the serialized form of the diagram.

loadFromString

public void loadFromString(java.lang.String str)
Loads a diagram from the specified string.


addDiagramListener

public void addDiagramListener(DiagramListener listener)
Description copied from class: DiagramBase
Registers listener so that it will receive events when users create, modify or delete diagram items.

Specified by:
addDiagramListener in class DiagramBase
Parameters:
listener - An object implementing the DiagramListener interface.

removeDiagramListener

public void removeDiagramListener(DiagramListener listener)
Description copied from class: DiagramBase
Unregisters listener so that it will no longer receive diagram events.

Specified by:
removeDiagramListener in class DiagramBase
Parameters:
listener - An object implementing the DiagramListener interface.

getPages

public com.mindfusion.common.ObservableList<DiagramPage> getPages()
Gets a list of the diagram pages contained in this document.


getDirty

public boolean getDirty()
Gets a value indicating whether the document has changed since the last save.