treebolic.provider.xml.graph.gxml
Class GxmlParser

java.lang.Object
  extended by treebolic.provider.xml.graph.AbstractParser
      extended by treebolic.provider.xml.graph.gxml.GxmlParser

public class GxmlParser
extends AbstractParser

GXL parser

Author:
Bernard Bou

Nested Class Summary
(package private) static class GxmlParser.Style
          Wrapper for style information
 
Constructor Summary
GxmlParser()
           
 
Method Summary
private static GxmlParser.Style getStyle(java.util.Map<java.lang.String,GxmlParser.Style> thisStyleMap, java.lang.String thisClass)
          Get style from map, allocate key and null value in map if needed
private static java.util.Map<java.lang.String,GxmlParser.Style> parseClasses(org.w3c.dom.Element thisElement)
          Parse class styles
protected  Graph parseGraph(org.w3c.dom.Document thisDocument)
          Parse graph
private static void parseLine(org.w3c.dom.Element thisElement, MutableEdge thisEdge)
          Parse edge style
protected  Settings parseSettings(org.w3c.dom.Document thisDocument)
          Parse settings
private static java.awt.Color toColor(java.lang.String thisColorString)
          Color parsing
private static void transferStyle(MutableEdge thisEdge, GxmlParser.Style thisStyle)
          Transfer class style to edge
private static void transferStyle(MutableGraphNode thisNode, GxmlParser.Style thisStyle)
          Transfer class style to node
 
Methods inherited from class treebolic.provider.xml.graph.AbstractParser
getFirstElementByTagName, getFirstLevel1ElementByTagName, getLevel1ChildElementsByTagName, parseModel, parseTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GxmlParser

public GxmlParser()
Method Detail

parseGraph

protected Graph parseGraph(org.w3c.dom.Document thisDocument)
Parse graph

Specified by:
parseGraph in class AbstractParser
Returns:
graph if successful

parseSettings

protected Settings parseSettings(org.w3c.dom.Document thisDocument)
Parse settings

Specified by:
parseSettings in class AbstractParser
Returns:
graph if successful

parseLine

private static void parseLine(org.w3c.dom.Element thisElement,
                              MutableEdge thisEdge)
Parse edge style

Parameters:
thisElement - DOM element to start from
thisEdge - edge

parseClasses

private static java.util.Map<java.lang.String,GxmlParser.Style> parseClasses(org.w3c.dom.Element thisElement)
Parse class styles

Parameters:
thisElement - DOM element to start from
Returns:
style map

getStyle

private static GxmlParser.Style getStyle(java.util.Map<java.lang.String,GxmlParser.Style> thisStyleMap,
                                         java.lang.String thisClass)
Get style from map, allocate key and null value in map if needed

Parameters:
thisStyleMap - style map
thisClass - class key
Returns:
style matching class in map (created if map did not previously contain key)

transferStyle

private static void transferStyle(MutableGraphNode thisNode,
                                  GxmlParser.Style thisStyle)
Transfer class style to node

Parameters:
thisNode - node
thisStyle - style

transferStyle

private static void transferStyle(MutableEdge thisEdge,
                                  GxmlParser.Style thisStyle)
Transfer class style to edge

Parameters:
thisEdge - edge
thisStyle - style

toColor

private static java.awt.Color toColor(java.lang.String thisColorString)
Color parsing

Parameters:
thisColorString - string to parse
Returns:
color