org.tigris.gef.xml.pgml
Class PGMLParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.tigris.gef.xml.pgml.PGMLParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class PGMLParser
extends org.xml.sax.helpers.DefaultHandler


Field Summary
protected  FigEdge _currentEdge
           
protected  Fig _currentEncloser
           
protected  FigLine _currentLine
           
protected  FigNode _currentNode
           
protected  FigPoly _currentPoly
           
protected  boolean _detectedFailure
           
protected  Diagram _diagram
           
protected  int _elementState
           
protected  java.util.HashMap _figRegistry
           
protected  int _nestedGroups
           
protected  java.util.Map _ownerRegistry
          Model elements indexed by a UUID.
protected  java.lang.StringBuffer _textBuf
           
protected  int _x1Int
           
protected  int _y1Int
           
protected static int ANNOTATION_EDGE_STATE
           
protected static int ANNOTATION_STATE
           
protected static int DEFAULT_EDGE_STATE
           
protected static int DEFAULT_NODE_STATE
           
protected static int DEFAULT_STATE
           
protected static int EDGE_STATE
           
protected static int LINE_STATE
           
protected static int NODE_STATE
           
protected static int POLY_EDGE_STATE
           
protected static int POLY_NODE_STATE
           
protected static int POLY_STATE
           
protected static int PRIVATE_EDGE_STATE
           
protected static int PRIVATE_NODE_STATE
           
protected static int PRIVATE_STATE
           
protected  java.lang.String systemId
           
protected static int TEXT_ANNOTATION_STATE
           
protected static int TEXT_EDGE_STATE
           
protected static int TEXT_NODE_STATE
           
protected static int TEXT_STATE
           
 
Constructor Summary
PGMLParser(java.util.Map modelElementsByUuid)
           
 
Method Summary
 void annotationStateStartElement(java.lang.String tagName, org.xml.sax.Attributes attrList)
           
 void characters(char[] ch, int start, int length)
           
protected  void edgeStateStartElement(java.lang.String tagName, org.xml.sax.Attributes attrList)
           
 void endElement(java.lang.String uri, java.lang.String localname, java.lang.String elementName)
           
protected  Fig findFig(java.lang.String uri)
           
protected  java.lang.Object findOwner(java.lang.String uri)
           
protected  java.lang.String[] getEntityPaths()
           
protected  GraphModel getGraphModelFor(java.lang.String desc)
           
 java.lang.String getSystemId()
           
protected  FigCircle handleEllipse(org.xml.sax.Attributes attrList)
           
protected  Fig handleGroup(org.xml.sax.Attributes attrList)
           
protected  FigLine handleLine(org.xml.sax.Attributes attrList)
           
protected  FigPoly handlePath(org.xml.sax.Attributes attrList)
           
protected  void handlePGML(org.xml.sax.Attributes attrList)
           
protected  Fig handlePolyLine(org.xml.sax.Attributes attrList)
           
protected  FigRect handleRect(org.xml.sax.Attributes attrList)
           
protected  FigText handleText(org.xml.sax.Attributes attrList)
           
protected  void initDiagram(java.lang.String diagDescr)
           
protected  void lineStateStartElement(java.lang.String tagName, org.xml.sax.Attributes attrList)
           
protected  void nodeStateStartElement(java.lang.String tagName, org.xml.sax.Attributes attrList)
           
protected  void polyStateStartElement(java.lang.String tagName, org.xml.sax.Attributes attrList)
           
protected  void privateStateEndElement(java.lang.String tagName)
           
 Diagram readDiagram(java.io.InputStream is)
           
 Diagram readDiagram(java.io.InputStream is, boolean closeStream)
           
 Diagram readDiagram(java.net.URL url)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
protected  void rollbackAdd(Fig currentFig)
           
protected  void setAttrs(Fig f, org.xml.sax.Attributes attrList)
           
protected  void setDetectedFailure(boolean newValue)
           
protected  void setOwnerAttr(Fig f, org.xml.sax.Attributes attrList)
           
 void setSystemId(java.lang.String id)
           
 void startElement(java.lang.String uri, java.lang.String localname, java.lang.String elementName, org.xml.sax.Attributes atts)
           
protected  java.lang.String translateClassName(java.lang.String oldName)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_diagram

protected Diagram _diagram

_nestedGroups

protected int _nestedGroups

_figRegistry

protected java.util.HashMap _figRegistry

_ownerRegistry

protected java.util.Map _ownerRegistry
Model elements indexed by a UUID.


_detectedFailure

protected boolean _detectedFailure

systemId

protected java.lang.String systemId

_elementState

protected int _elementState

DEFAULT_STATE

protected static final int DEFAULT_STATE
See Also:
Constant Field Values

TEXT_STATE

protected static final int TEXT_STATE
See Also:
Constant Field Values

LINE_STATE

protected static final int LINE_STATE
See Also:
Constant Field Values

POLY_STATE

protected static final int POLY_STATE
See Also:
Constant Field Values

NODE_STATE

protected static final int NODE_STATE
See Also:
Constant Field Values

EDGE_STATE

protected static final int EDGE_STATE
See Also:
Constant Field Values

PRIVATE_STATE

protected static final int PRIVATE_STATE
See Also:
Constant Field Values

ANNOTATION_STATE

protected static final int ANNOTATION_STATE
See Also:
Constant Field Values

PRIVATE_NODE_STATE

protected static final int PRIVATE_NODE_STATE
See Also:
Constant Field Values

PRIVATE_EDGE_STATE

protected static final int PRIVATE_EDGE_STATE
See Also:
Constant Field Values

ANNOTATION_EDGE_STATE

protected static final int ANNOTATION_EDGE_STATE
See Also:
Constant Field Values

TEXT_NODE_STATE

protected static final int TEXT_NODE_STATE
See Also:
Constant Field Values

TEXT_EDGE_STATE

protected static final int TEXT_EDGE_STATE
See Also:
Constant Field Values

TEXT_ANNOTATION_STATE

protected static final int TEXT_ANNOTATION_STATE
See Also:
Constant Field Values

POLY_EDGE_STATE

protected static final int POLY_EDGE_STATE
See Also:
Constant Field Values

POLY_NODE_STATE

protected static final int POLY_NODE_STATE
See Also:
Constant Field Values

DEFAULT_NODE_STATE

protected static final int DEFAULT_NODE_STATE
See Also:
Constant Field Values

DEFAULT_EDGE_STATE

protected static final int DEFAULT_EDGE_STATE
See Also:
Constant Field Values

_currentLine

protected FigLine _currentLine

_x1Int

protected int _x1Int

_y1Int

protected int _y1Int

_textBuf

protected java.lang.StringBuffer _textBuf

_currentPoly

protected FigPoly _currentPoly

_currentNode

protected FigNode _currentNode

_currentEncloser

protected Fig _currentEncloser

_currentEdge

protected FigEdge _currentEdge
Constructor Detail

PGMLParser

public PGMLParser(java.util.Map modelElementsByUuid)
Method Detail

readDiagram

public Diagram readDiagram(java.net.URL url)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

readDiagram

public Diagram readDiagram(java.io.InputStream is)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

readDiagram

public Diagram readDiagram(java.io.InputStream is,
                           boolean closeStream)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

initDiagram

protected void initDiagram(java.lang.String diagDescr)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localname,
                         java.lang.String elementName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localname,
                       java.lang.String elementName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

handlePGML

protected void handlePGML(org.xml.sax.Attributes attrList)
                   throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handlePolyLine

protected Fig handlePolyLine(org.xml.sax.Attributes attrList)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleLine

protected FigLine handleLine(org.xml.sax.Attributes attrList)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

lineStateStartElement

protected void lineStateStartElement(java.lang.String tagName,
                                     org.xml.sax.Attributes attrList)

handleEllipse

protected FigCircle handleEllipse(org.xml.sax.Attributes attrList)
                           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleRect

protected FigRect handleRect(org.xml.sax.Attributes attrList)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleText

protected FigText handleText(org.xml.sax.Attributes attrList)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handlePath

protected FigPoly handlePath(org.xml.sax.Attributes attrList)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

polyStateStartElement

protected void polyStateStartElement(java.lang.String tagName,
                                     org.xml.sax.Attributes attrList)

handleGroup

protected Fig handleGroup(org.xml.sax.Attributes attrList)
                   throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

privateStateEndElement

protected void privateStateEndElement(java.lang.String tagName)

nodeStateStartElement

protected void nodeStateStartElement(java.lang.String tagName,
                                     org.xml.sax.Attributes attrList)
                              throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

edgeStateStartElement

protected void edgeStateStartElement(java.lang.String tagName,
                                     org.xml.sax.Attributes attrList)
                              throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

annotationStateStartElement

public void annotationStateStartElement(java.lang.String tagName,
                                        org.xml.sax.Attributes attrList)
                                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

setAttrs

protected void setAttrs(Fig f,
                        org.xml.sax.Attributes attrList)
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

setOwnerAttr

protected void setOwnerAttr(Fig f,
                            org.xml.sax.Attributes attrList)
                     throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

findOwner

protected java.lang.Object findOwner(java.lang.String uri)

findFig

protected Fig findFig(java.lang.String uri)

getGraphModelFor

protected GraphModel getGraphModelFor(java.lang.String desc)

translateClassName

protected java.lang.String translateClassName(java.lang.String oldName)

getEntityPaths

protected java.lang.String[] getEntityPaths()

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler

setSystemId

public void setSystemId(java.lang.String id)

getSystemId

public java.lang.String getSystemId()

rollbackAdd

protected void rollbackAdd(Fig currentFig)

setDetectedFailure

protected void setDetectedFailure(boolean newValue)