org.tigris.gef.xml.svg
Class SVGParser

java.lang.Object
  extended by org.xml.sax.HandlerBase
      extended by org.tigris.gef.xml.svg.SVGParser
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SVGParser
extends org.xml.sax.HandlerBase


Field Summary
protected  Diagram _diagram
           
protected  java.util.HashMap _figRegistry
           
protected  int _nestedGroups
           
protected  java.util.Map _ownerRegistry
           
static SVGParser SINGLETON
           
 
Constructor Summary
protected SVGParser()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
protected  java.awt.Color colorByName(java.lang.String name, java.awt.Color defaultColor)
           
 void endElement(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)
           
protected  FigCircle handleEllipse(org.xml.sax.AttributeList attrList)
           
protected  Fig handleGroup(org.xml.sax.AttributeList attrList)
           
protected  FigLine handleLine(org.xml.sax.AttributeList attrList)
           
protected  FigPoly handlePath(org.xml.sax.AttributeList attrList)
           
protected  Fig handlePolyLine(org.xml.sax.AttributeList attrList)
           
protected  FigRect handleRect(org.xml.sax.AttributeList attrList)
           
protected  void handleSVG(org.xml.sax.AttributeList attrList)
           
protected  FigText handleText(org.xml.sax.AttributeList attrList)
           
protected  void initDiagram(java.lang.String diagDescr)
           
protected  void lineStateStartElement(java.lang.String tagName, org.xml.sax.AttributeList attrList)
           
protected  java.awt.Color parseColor(java.lang.String name, java.awt.Color defaultColor)
           
protected  java.lang.String parseStyle(java.lang.String field, java.lang.String style)
          This method parses the 'style' attribute for a particular field
 Diagram readDiagram(java.net.URL url)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
protected  void setAttrs(Fig f, org.xml.sax.AttributeList attrList)
           
protected  void setOwnerAttr(Fig f, org.xml.sax.AttributeList attrList)
           
 void setOwnerRegistry(java.util.Map owners)
           
 void startElement(java.lang.String elementName, org.xml.sax.AttributeList attrList)
           
protected  java.lang.String translateClassName(java.lang.String oldName)
           
 
Methods inherited from class org.xml.sax.HandlerBase
endDocument, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

public static SVGParser SINGLETON

_diagram

protected Diagram _diagram

_nestedGroups

protected int _nestedGroups

_figRegistry

protected java.util.HashMap _figRegistry

_ownerRegistry

protected java.util.Map _ownerRegistry
Constructor Detail

SVGParser

protected SVGParser()
Method Detail

characters

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

colorByName

protected java.awt.Color colorByName(java.lang.String name,
                                     java.awt.Color defaultColor)

endElement

public void endElement(java.lang.String elementName)
Specified by:
endElement in interface org.xml.sax.DocumentHandler
Overrides:
endElement in class org.xml.sax.HandlerBase

findFig

protected Fig findFig(java.lang.String uri)

findOwner

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

getEntityPaths

protected java.lang.String[] getEntityPaths()

getGraphModelFor

protected GraphModel getGraphModelFor(java.lang.String desc)

handleEllipse

protected FigCircle handleEllipse(org.xml.sax.AttributeList attrList)

handleGroup

protected Fig handleGroup(org.xml.sax.AttributeList attrList)

handleLine

protected FigLine handleLine(org.xml.sax.AttributeList attrList)

handlePath

protected FigPoly handlePath(org.xml.sax.AttributeList attrList)

handlePolyLine

protected Fig handlePolyLine(org.xml.sax.AttributeList attrList)

handleRect

protected FigRect handleRect(org.xml.sax.AttributeList attrList)

handleSVG

protected void handleSVG(org.xml.sax.AttributeList attrList)

handleText

protected FigText handleText(org.xml.sax.AttributeList attrList)

initDiagram

protected void initDiagram(java.lang.String diagDescr)

lineStateStartElement

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

parseColor

protected java.awt.Color parseColor(java.lang.String name,
                                    java.awt.Color defaultColor)

parseStyle

protected java.lang.String parseStyle(java.lang.String field,
                                      java.lang.String style)
This method parses the 'style' attribute for a particular field

Parameters:
field - java.lang.String
style - java.lang.String
Returns:
java.lang.String

readDiagram

public Diagram readDiagram(java.net.URL url)

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.HandlerBase

setAttrs

protected void setAttrs(Fig f,
                        org.xml.sax.AttributeList attrList)

setOwnerAttr

protected void setOwnerAttr(Fig f,
                            org.xml.sax.AttributeList attrList)

setOwnerRegistry

public void setOwnerRegistry(java.util.Map owners)

startElement

public void startElement(java.lang.String elementName,
                         org.xml.sax.AttributeList attrList)
Specified by:
startElement in interface org.xml.sax.DocumentHandler
Overrides:
startElement in class org.xml.sax.HandlerBase

translateClassName

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