treebolic.provider.xml.dom
Class DocumentAdapter

java.lang.Object
  extended by treebolic.provider.xml.dom.DocumentAdapter

public class DocumentAdapter
extends java.lang.Object

Document adapter to model/graph

Author:
Bernard Bou

Nested Class Summary
(package private)  class DocumentAdapter.MountTask
          Mount task (protracted)
 
Field Summary
private  java.util.Map<java.lang.String,MutableNode> theIdToNodeMap
          Id to node map
private  java.util.List<DocumentAdapter.MountTask> theMountTasks
          Protracted mount tasks
private  IProvider theProvider
          Provider (used to generate mounted trees)
 
Constructor Summary
DocumentAdapter()
          Constructor
DocumentAdapter(IProvider thisProvider)
          Constructor
 
Method Summary
private static org.w3c.dom.Element getFirstElementByTagName(org.w3c.dom.Element thisElement, java.lang.String thisTagName)
          Find DOM element with given tag
private static org.w3c.dom.Element getFirstLevel1ElementByTagName(org.w3c.dom.Element thisElement, java.lang.String thisTagName)
          Find DOM element with given tag among first level children
 java.util.Map<java.lang.String,MutableNode> getIdToNodeMap()
          Get id to node map
private static java.util.List<org.w3c.dom.Element> getLevel1ChildElementsByTagName(org.w3c.dom.Element thisElement, java.lang.String thisTagName)
          Find DOM elements with given tag among first level children
protected  MutableEdge makeEdge(MutableNode thisFromNode, MutableNode thisToNode)
          Make model edge
 Model makeModel(org.w3c.dom.Document thisDocument)
          Make model from document
protected  MutableNode makeNode(MutableNode thisParent, java.lang.String thisId)
          Make model node
 Tree makeTree(org.w3c.dom.Document thisDocument)
          Make tree from document
private  MutableEdge toEdge(org.w3c.dom.Element thisEdgeElement)
          Make model edge
private  java.util.List<IEdge> toEdges(org.w3c.dom.Document thisDocument)
          Make list of model edges
private static MenuItem toMenuItem(org.w3c.dom.Element thisElement)
          Make menu item
private  MutableNode toNode(org.w3c.dom.Element thisNodeElement, MutableNode thisParent)
          Make model node
private static Settings toSettings(org.w3c.dom.Document thisDocument)
          Make settings
private  Tree toTree(org.w3c.dom.Document thisDocument)
          Make graph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theMountTasks

private java.util.List<DocumentAdapter.MountTask> theMountTasks
Protracted mount tasks


theProvider

private IProvider theProvider
Provider (used to generate mounted trees)


theIdToNodeMap

private java.util.Map<java.lang.String,MutableNode> theIdToNodeMap
Id to node map

Constructor Detail

DocumentAdapter

public DocumentAdapter(IProvider thisProvider)
Constructor

Parameters:
thisProvider - provider (used in recursion)

DocumentAdapter

public DocumentAdapter()
Constructor

Method Detail

getIdToNodeMap

public java.util.Map<java.lang.String,MutableNode> getIdToNodeMap()
Get id to node map

Returns:
id to node map

makeModel

public Model makeModel(org.w3c.dom.Document thisDocument)
Make model from document

Parameters:
thisDocument - document
Returns:
model

makeTree

public Tree makeTree(org.w3c.dom.Document thisDocument)
Make tree from document

Parameters:
thisDocument - document
Returns:
tree

makeNode

protected MutableNode makeNode(MutableNode thisParent,
                               java.lang.String thisId)
Make model node

Parameters:
thisParent - model parent
thisId - id
Returns:
model node

makeEdge

protected MutableEdge makeEdge(MutableNode thisFromNode,
                               MutableNode thisToNode)
Make model edge

Parameters:
thisFromNode - model from-node end
thisToNode - model to-node end
Returns:
model edge

toTree

private Tree toTree(org.w3c.dom.Document thisDocument)
Make graph

Parameters:
thisDocument - document
Returns:
graph

toNode

private MutableNode toNode(org.w3c.dom.Element thisNodeElement,
                           MutableNode thisParent)
Make model node

Parameters:
thisNodeElement - starting DOM element
thisParent - model parent node
Returns:
model node

toEdge

private MutableEdge toEdge(org.w3c.dom.Element thisEdgeElement)
Make model edge

Parameters:
thisEdgeElement - edge DOM element
Returns:
edge

toEdges

private java.util.List<IEdge> toEdges(org.w3c.dom.Document thisDocument)
Make list of model edges

Parameters:
thisDocument - DOM document
Returns:
list of edges

toSettings

private static Settings toSettings(org.w3c.dom.Document thisDocument)
Make settings

Parameters:
thisDocument - DOM document
Returns:
settings

toMenuItem

private static MenuItem toMenuItem(org.w3c.dom.Element thisElement)
Make menu item

Parameters:
thisElement - menu item DOM element
Returns:
menu item

getFirstElementByTagName

private static org.w3c.dom.Element getFirstElementByTagName(org.w3c.dom.Element thisElement,
                                                            java.lang.String thisTagName)
Find DOM element with given tag

Parameters:
thisElement - starting DOM element
thisTagName - tag
Returns:
DOM element if found, null if none

getFirstLevel1ElementByTagName

private static org.w3c.dom.Element getFirstLevel1ElementByTagName(org.w3c.dom.Element thisElement,
                                                                  java.lang.String thisTagName)
Find DOM element with given tag among first level children

Parameters:
thisElement - starting DOM element
thisTagName - tag
Returns:
DOM element if found, null if none

getLevel1ChildElementsByTagName

private static java.util.List<org.w3c.dom.Element> getLevel1ChildElementsByTagName(org.w3c.dom.Element thisElement,
                                                                                   java.lang.String thisTagName)
Find DOM elements with given tag among first level children

Parameters:
thisElement - starting DOM element
thisTagName - tag
Returns:
DOM element if found, null if none