org.jgraph.pad
Class DefaultGraphModelFileFormatXML

java.lang.Object
  extended byorg.jgraph.pad.DefaultGraphModelFileFormatXML

public class DefaultGraphModelFileFormatXML
extends java.lang.Object

File format for the default graph model. The file format writes a XML file with the graph as content.


Nested Class Summary
 class DefaultGraphModelFileFormatXML.AttributeCollection
           
static class DefaultGraphModelFileFormatXML.ConnectionID
           
static class DefaultGraphModelFileFormatXML.DelayedAttributeID
           
 
Field Summary
protected  DefaultGraphModelFileFormatXML.AttributeCollection attrCol
           
protected static java.util.Map attrs
           
protected static GPDefaultCellFactory cellFactory
           
protected  java.util.Map cellMap
           
protected static java.util.Map cells
           
static java.lang.String COMPRESS_WITH_ZIP
          a const value for the key at the properties hashtable
protected static java.util.List connectionSetIDs
           
protected static java.util.List delayedAttributes
           
static java.lang.String EMPTY
           
protected  java.lang.Class[] keyTypes
           
protected  java.lang.String[] knownKeys
           
protected static java.util.Map objs
           
static java.lang.String PARENT
           
protected  java.util.Map userObjectMap
           
 
Constructor Summary
protected DefaultGraphModelFileFormatXML()
          Constructor for DefaultGraphModelFileFormatXML.
 
Method Summary
 void applySettings(java.util.Map s, GPGraph graph)
           
 java.util.Map augmentAttrs(java.util.Map attrs)
           
 DefaultGraphCell createCell(java.lang.String type, java.lang.Object userObject)
           
 java.util.Map createDefaultAttributes()
          Returns an attributeMap for the specified position and color.
 java.util.Map decodeMap(org.w3c.dom.Node node, boolean useKnownKeys, boolean URLdecodeValues)
           
 java.util.Map decodeUserObjects(org.w3c.dom.Node node)
           
 java.lang.Object decodeValue(java.lang.Class key, java.lang.String value)
           
 java.lang.String encodeKey(java.lang.String key)
           
 java.lang.String encodeMap(java.lang.String indent, java.util.Map attributes, boolean invert, java.util.Set excludeAttributes, boolean URLencodeValues)
           
 java.lang.String encodeUserObjects(java.lang.String indent, java.util.Map userObjects)
           
 java.lang.String encodeValue(java.lang.Object value)
           
static GPDefaultCellFactory getCellFactory()
           
 java.lang.String getFileExtension()
          returns pad_xml
 javax.swing.filechooser.FileFilter getFileFilter()
          Returns a file filter for the pad_xml extension.
 int getID(java.lang.Object object)
           
 java.lang.Class[] getKeyTypes()
           
 java.lang.String[] getKnownKeys()
           
 javax.swing.JComponent getReadAccessory()
          Returns null
 java.util.Hashtable getReadProperties(javax.swing.JComponent accessory)
          Returns null
 java.lang.String getType(java.lang.Object cell)
           
 int getUserObjectID(java.lang.Object object)
           
 javax.swing.JComponent getWriteAccessory()
          Returns the compZipSelect object.
 java.util.Hashtable getWriteProperties(javax.swing.JComponent accessory)
          Puts the value from the checkbox into the properties hashtable
static DefaultGraphModelFileFormatXML instance()
           
 java.lang.String outputAttributes(java.lang.String indent)
           
 java.lang.String outputCell(java.lang.String indent, GraphModel model, java.lang.Object cell)
           
 java.lang.String outputModel(GraphModel model, java.lang.String indent, java.lang.Object parent)
           
 java.lang.String outputView(GPGraph graph, java.lang.String indent)
           
 java.util.Map parseAttrs(org.w3c.dom.Node node)
           
 DefaultGraphCell parseCell(org.w3c.dom.Node node, java.util.Hashtable cells, ConnectionSet cs)
           
 DefaultGraphCell[] parseChildren(org.w3c.dom.Node node, java.util.Hashtable cells, ConnectionSet cs)
           
 void read(java.io.InputStream in, GPGraph graph)
           
 GraphModel read(java.net.URL file, java.util.Hashtable properties, GPGraph gpGraph)
          Reads the File form the XML input stream.
static void setCellFactory(GPDefaultCellFactory factory)
           
 void setKeyTypes(java.lang.Class[] keyTypes)
           
 void setKnownKeys(java.lang.String[] knownKeys)
           
static java.lang.String[] tokenize(java.lang.String s, java.lang.String token)
           
 java.lang.String toString(GPGraph graph)
           
 void write(java.net.URL file, GPGraph gpGraph, GraphModel graphModel)
          Writes the graph as XML file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.lang.String EMPTY

PARENT

public static final java.lang.String PARENT

cells

protected static java.util.Map cells

attrs

protected static java.util.Map attrs

objs

protected static java.util.Map objs

delayedAttributes

protected static java.util.List delayedAttributes

connectionSetIDs

protected static java.util.List connectionSetIDs

cellMap

protected java.util.Map cellMap

attrCol

protected DefaultGraphModelFileFormatXML.AttributeCollection attrCol

userObjectMap

protected java.util.Map userObjectMap

cellFactory

protected static GPDefaultCellFactory cellFactory

COMPRESS_WITH_ZIP

public static final java.lang.String COMPRESS_WITH_ZIP
a const value for the key at the properties hashtable

See Also:
Constant Field Values

knownKeys

protected java.lang.String[] knownKeys

keyTypes

protected java.lang.Class[] keyTypes
Constructor Detail

DefaultGraphModelFileFormatXML

protected DefaultGraphModelFileFormatXML()
Constructor for DefaultGraphModelFileFormatXML.

Method Detail

instance

public static DefaultGraphModelFileFormatXML instance()

getFileExtension

public java.lang.String getFileExtension()
returns pad_xml


getFileFilter

public javax.swing.filechooser.FileFilter getFileFilter()
Returns a file filter for the pad_xml extension.

See Also:
org.jgraph.pad.GraphModelFileFormat#getFileFilter()

getReadAccessory

public javax.swing.JComponent getReadAccessory()
Returns null

See Also:
org.jgraph.pad.GraphModelFileFormat#getReadAccessory()

getWriteAccessory

public javax.swing.JComponent getWriteAccessory()
Returns the compZipSelect object.

See Also:
#compZipSelect, org.jgraph.pad.GraphModelFileFormat#getWriteAccessory()

write

public void write(java.net.URL file,
                  GPGraph gpGraph,
                  GraphModel graphModel)
           throws java.lang.Exception
Writes the graph as XML file

Throws:
java.lang.Exception
See Also:
org.jgraph.pad.GraphModelFileFormat#write(String, Hashtable, GPGraph, GraphModel)

getWriteProperties

public java.util.Hashtable getWriteProperties(javax.swing.JComponent accessory)
Puts the value from the checkbox into the properties hashtable

See Also:
org.jgraph.pad.GraphModelFileFormat#getWriteProperties(JComponent)

read

public GraphModel read(java.net.URL file,
                       java.util.Hashtable properties,
                       GPGraph gpGraph)
                throws java.lang.Exception
Reads the File form the XML input stream. Tempts to load from a zipped input stream. If this procedure fails the method tempts to load without the zipped option.

Throws:
java.lang.Exception
See Also:
org.jgraph.pad.GraphModelFileFormat#read(String, Hashtable, GPGraph)

getReadProperties

public java.util.Hashtable getReadProperties(javax.swing.JComponent accessory)
Returns null

See Also:
org.jgraph.pad.GraphModelFileFormat#getReadProperties(JComponent)

read

public void read(java.io.InputStream in,
                 GPGraph graph)
          throws java.lang.Exception
Throws:
java.lang.Exception

applySettings

public void applySettings(java.util.Map s,
                          GPGraph graph)

augmentAttrs

public java.util.Map augmentAttrs(java.util.Map attrs)

parseCell

public DefaultGraphCell parseCell(org.w3c.dom.Node node,
                                  java.util.Hashtable cells,
                                  ConnectionSet cs)

parseChildren

public DefaultGraphCell[] parseChildren(org.w3c.dom.Node node,
                                        java.util.Hashtable cells,
                                        ConnectionSet cs)

parseAttrs

public java.util.Map parseAttrs(org.w3c.dom.Node node)

createDefaultAttributes

public java.util.Map createDefaultAttributes()
Returns an attributeMap for the specified position and color.


toString

public java.lang.String toString(GPGraph graph)

outputView

public java.lang.String outputView(GPGraph graph,
                                   java.lang.String indent)

outputModel

public java.lang.String outputModel(GraphModel model,
                                    java.lang.String indent,
                                    java.lang.Object parent)

outputCell

public java.lang.String outputCell(java.lang.String indent,
                                   GraphModel model,
                                   java.lang.Object cell)

getUserObjectID

public int getUserObjectID(java.lang.Object object)

getID

public int getID(java.lang.Object object)

outputAttributes

public java.lang.String outputAttributes(java.lang.String indent)

encodeMap

public java.lang.String encodeMap(java.lang.String indent,
                                  java.util.Map attributes,
                                  boolean invert,
                                  java.util.Set excludeAttributes,
                                  boolean URLencodeValues)

encodeUserObjects

public java.lang.String encodeUserObjects(java.lang.String indent,
                                          java.util.Map userObjects)

encodeKey

public java.lang.String encodeKey(java.lang.String key)

encodeValue

public java.lang.String encodeValue(java.lang.Object value)

decodeMap

public java.util.Map decodeMap(org.w3c.dom.Node node,
                               boolean useKnownKeys,
                               boolean URLdecodeValues)

decodeUserObjects

public java.util.Map decodeUserObjects(org.w3c.dom.Node node)

tokenize

public static final java.lang.String[] tokenize(java.lang.String s,
                                                java.lang.String token)

decodeValue

public java.lang.Object decodeValue(java.lang.Class key,
                                    java.lang.String value)

createCell

public DefaultGraphCell createCell(java.lang.String type,
                                   java.lang.Object userObject)

getType

public java.lang.String getType(java.lang.Object cell)

getCellFactory

public static GPDefaultCellFactory getCellFactory()

setCellFactory

public static void setCellFactory(GPDefaultCellFactory factory)

getKnownKeys

public java.lang.String[] getKnownKeys()

setKnownKeys

public void setKnownKeys(java.lang.String[] knownKeys)

getKeyTypes

public java.lang.Class[] getKeyTypes()

setKeyTypes

public void setKeyTypes(java.lang.Class[] keyTypes)