public class DiagramDocument extends DiagramBase
| Constructor and Description |
|---|
DiagramDocument() |
| Modifier and Type | Method and Description |
|---|---|
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 |
loadFromJson(java.io.InputStream stream)
Loads the diagram document from a stream in JSON format.
|
void |
loadFromJson(com.mindfusion.common.JsonObject documentObj)
Loads the diagram document from a JSON object.
|
void |
loadFromJson(java.lang.String fileName)
Loads the diagram document from a JSON file.
|
void |
loadFromJsonString(java.lang.String json)
Loads the diagram document from a JSON-formatted string.
|
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.io.InputStream stream)
Loads the contents of the XML diagram document.
|
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.
|
void |
saveToJson(com.mindfusion.common.JsonObject documentObj,
JsonPersistContext context)
Saves the diagram document to a JSON object.
|
void |
saveToJson(java.io.OutputStream stream)
Saves the diagram document into a stream in JSON format.
|
void |
saveToJson(java.lang.String fileName)
Saves the diagram document into a JSON file.
|
java.lang.String |
saveToJsonString()
Saves the diagram document to a JSON-formatted string.
|
java.lang.String |
saveToString()
Saves the diagram contents into a string.
|
java.lang.String |
saveToString(SaveToStringFormat 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.
|
public void saveToFile(java.lang.String fileName)
throws java.io.FileNotFoundException,
java.io.IOException
fileName - The full path and name of the disk file where
the document should be saved.java.io.FileNotFoundExceptionjava.io.IOExceptionpublic void saveToXml(java.lang.String fileName)
throws java.io.IOException,
com.mindfusion.common.XmlException
fileName - The full path and name of the disk file where the diagram should be saved.java.io.IOExceptioncom.mindfusion.common.XmlExceptionpublic void saveToXml(java.io.OutputStream stream,
boolean includeUnalteredProperties)
throws com.mindfusion.common.XmlException,
java.io.UnsupportedEncodingException
stream - An OutputStream where the XML markup should be serialized.com.mindfusion.common.XmlExceptionjava.io.UnsupportedEncodingExceptionpublic void saveToXml(org.w3c.dom.Document document)
Document object.document - A Document object where the document should be saved.public void saveToXml(org.w3c.dom.Document document,
boolean includeUnalteredProperties)
Document object.document - An XML Document object where the document should be saved.includeUnalteredProperties - true if properties that have their
default value should be saved; otherwise, false.public void loadFromXml(java.lang.String fileName)
throws com.mindfusion.common.XmlException,
java.io.IOException,
org.xml.sax.SAXException
fileName - The name of the XML file the data should be read from.com.mindfusion.common.XmlExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionpublic void loadFromXml(java.io.InputStream stream)
throws com.mindfusion.common.XmlException
stream - An InputStream where the XML markup should be read from.com.mindfusion.common.XmlExceptionpublic void loadFromXml(org.w3c.dom.Document document)
Document object.document - A Document object from which to load the diagram data.public void loadFromFile(java.lang.String fileName)
throws java.io.FileNotFoundException,
java.io.IOException
fileName - The name of the file to load from.java.io.FileNotFoundExceptionjava.io.IOExceptionpublic void saveTo(java.io.OutputStream out)
throws java.io.IOException
out - An OutputStream where
the diagram contents should be saved.java.io.IOExceptionpublic void loadFrom(java.io.InputStream in)
throws java.io.IOException
in - An InputStream from which to load the diagram contents.java.io.IOExceptionpublic java.lang.String saveToString()
String containing the base64 encoded diagram contents.public java.lang.String saveToString(SaveToStringFormat format, boolean includeUnalteredProperties)
format - A member of the SaveToStringFormat enumeration indicating the output format.includeUnalteredProperties - true to serialize all properties;
false to serialize only properties with non-default values.public void loadFromString(java.lang.String str)
public void addDiagramListener(DiagramListener listener)
DiagramBaselistener so that it will receive events when
users create, modify or delete diagram items.addDiagramListener in class DiagramBaselistener - An object implementing the DiagramListener interface.public void removeDiagramListener(DiagramListener listener)
DiagramBaselistener so that it will no longer
receive diagram events.removeDiagramListener in class DiagramBaselistener - An object implementing the DiagramListener interface.public com.mindfusion.common.ObservableList<DiagramPage> getPages()
public boolean getDirty()
public void saveToJson(java.lang.String fileName)
throws java.io.IOException
fileName - A string specifying the file name or full path.java.io.IOExceptionpublic void saveToJson(java.io.OutputStream stream)
throws java.io.IOException
stream - The output stream.java.io.IOExceptionpublic void loadFromJson(java.lang.String fileName)
throws java.io.IOException
fileName - A string specifying the file name or full path.java.io.IOExceptionpublic void loadFromJson(java.io.InputStream stream)
throws java.io.IOException
stream - The input stream.java.io.IOExceptionpublic java.lang.String saveToJsonString()
public void saveToJson(com.mindfusion.common.JsonObject documentObj,
JsonPersistContext context)
documentObj - A JsonObject representing the document.context - A JsonPersistContext object.public void loadFromJsonString(java.lang.String json)
json - A string containing the JSON representation of the document.public void loadFromJson(com.mindfusion.common.JsonObject documentObj)
documentObj - A JsonObject representing the document.