JGraph X 1.4.1.0


com.mxgraph.io.gml
Class mxGmlGraph

java.lang.Object
  extended by com.mxgraph.io.gml.mxGmlGraph

public class mxGmlGraph
extends Object

Represents a Graph element in the GML Structure.


Constructor Summary
mxGmlGraph()
          Constructs an empty graph.
mxGmlGraph(Element graphElement)
          Constructs a graph from a xml graph element.
mxGmlGraph(String id, String edgedefault)
          Constructs a graph with id and edge default direction.
 
Method Summary
 void addGraph(mxGraph graph, Object parent)
          Adds the elements represented for this graph model into the given graph.
static mxGmlData dataEdgeKey(mxGmlEdge edge)
          Returns the data element inside the edge that references to the key element with name = KEY_EDGE_NAME.
static mxGmlData dataNodeKey(mxGmlNode node)
          Returns the data element inside the node that references to the key element with name = KEY_NODE_NAME.
 Element generateElement(Document document)
          Generates a Key Element from this class.
 String getEdgedefault()
           
 List<mxGmlEdge> getEdges()
           
 String getId()
           
 List<mxGmlNode> getNodes()
           
static boolean hasData(mxGmlNode node)
          Checks if the node has data elements inside.
 boolean isEmpty()
          Checks if the graph has child nodes or edges.
 void setEdgedefault(String edgedefault)
           
 void setEdges(List<mxGmlEdge> edge)
           
 void setId(String id)
           
 void setNodes(List<mxGmlNode> node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

mxGmlGraph

public mxGmlGraph(String id,
                  String edgedefault)
Constructs a graph with id and edge default direction.

Parameters:
id - Graph's ID
edgedefault - Edge Default direction.("directed" or "undirected")

mxGmlGraph

public mxGmlGraph()
Constructs an empty graph.


mxGmlGraph

public mxGmlGraph(Element graphElement)
Constructs a graph from a xml graph element.

Parameters:
graphElement - Xml graph element.
Method Detail

addGraph

public void addGraph(mxGraph graph,
                     Object parent)
Adds the elements represented for this graph model into the given graph.

Parameters:
graph - Graph where the elements will be located
parent - Parent of the cells to be added.

hasData

public static boolean hasData(mxGmlNode node)
Checks if the node has data elements inside.

Parameters:
node - Gml node element.
Returns:
Returns true if the node has data elements inside.

dataNodeKey

public static mxGmlData dataNodeKey(mxGmlNode node)
Returns the data element inside the node that references to the key element with name = KEY_NODE_NAME.

Parameters:
node - Gml Node element.
Returns:
The required data. null if not found.

dataEdgeKey

public static mxGmlData dataEdgeKey(mxGmlEdge edge)
Returns the data element inside the edge that references to the key element with name = KEY_EDGE_NAME.

Parameters:
edge - Gml Edge element.
Returns:
The required data. null if not found.

getEdgedefault

public String getEdgedefault()

setEdgedefault

public void setEdgedefault(String edgedefault)

getId

public String getId()

setId

public void setId(String id)

getNodes

public List<mxGmlNode> getNodes()

setNodes

public void setNodes(List<mxGmlNode> node)

getEdges

public List<mxGmlEdge> getEdges()

setEdges

public void setEdges(List<mxGmlEdge> edge)

isEmpty

public boolean isEmpty()
Checks if the graph has child nodes or edges.

Returns:
Returns true if the graph hasn't child nodes or edges.

generateElement

public Element generateElement(Document document)
Generates a Key Element from this class.

Parameters:
document - Document where the key Element will be inserted.
Returns:
Returns the generated Elements.

JGraph X 1.4.1.0


Copyright (c) 2010 Gaudenz Alder. All rights reserved.