Search this API

y.io.graphml.graph2d
Class HierarchyManagerBasedGraphElementFactory

java.lang.Object
  extended by y.io.graphml.graph2d.HierarchyManagerBasedGraphElementFactory
All Implemented Interfaces:
GraphElementFactory

public class HierarchyManagerBasedGraphElementFactory
extends Object
implements GraphElementFactory

Implementation of the GraphElementFactory interface that can create HierarchyManager based hierarchy information.

If a HierarchyManager instance is registered on the graph that is populated, it is used to create the hierarchy information. The actual creation of normal nodes is delegated to a customizable implementation.


Constructor Summary
HierarchyManagerBasedGraphElementFactory()
          Create a new instance with a getCoreFactory() set to a Graph2DElementFactory
HierarchyManagerBasedGraphElementFactory(GraphElementFactory coreFactory)
          Create a new instance with a custom getCoreFactory().
 
Method Summary
 Edge createEdge(GraphMLParseContext context, Node sourceNode, Port sourcePort, Node targetNode, Port targetPort)
          Creates an edge for the given context and the provided source and target nodes or ports.
 Node createNode(GraphMLParseContext context)
          Creates a node for the given context.
 Port createPort(GraphMLParseContext context, Node owner)
          Creates a port object that is owned by owner
 GraphElementFactory getCoreFactory()
          Returns the core factory for creation of normal nodes and edges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchyManagerBasedGraphElementFactory

public HierarchyManagerBasedGraphElementFactory()
Create a new instance with a getCoreFactory() set to a Graph2DElementFactory


HierarchyManagerBasedGraphElementFactory

public HierarchyManagerBasedGraphElementFactory(GraphElementFactory coreFactory)
Create a new instance with a custom getCoreFactory().

It is the users responsibility to set up the HierarchyManager to work correctly with non Graph2D instances.

Method Detail

getCoreFactory

public GraphElementFactory getCoreFactory()
Returns the core factory for creation of normal nodes and edges.

Returns:
The core factory.

createNode

public Node createNode(GraphMLParseContext context)
Description copied from interface: GraphElementFactory
Creates a node for the given context.

Specified by:
createNode in interface GraphElementFactory
Parameters:
context - The context from which the graph, the CreationProperties, and the GraphMLParseContext.getObjectStack() can be queried.
Returns:
A newly created node

createEdge

public Edge createEdge(GraphMLParseContext context,
                       Node sourceNode,
                       Port sourcePort,
                       Node targetNode,
                       Port targetPort)
Description copied from interface: GraphElementFactory
Creates an edge for the given context and the provided source and target nodes or ports.

Specified by:
createEdge in interface GraphElementFactory
Parameters:
context - The context from which the graph, the CreationProperties, and the GraphMLParseContext.getObjectStack() can be queried.
sourceNode - The source node for the edge.
sourcePort - The source port for the edge, if specified, otherwise null.
targetNode - The target node for the edge.
targetPort - The target port for the edge, if specified, otherwise null.
Returns:
A newly created edge.

createPort

public Port createPort(GraphMLParseContext context,
                       Node owner)
Description copied from interface: GraphElementFactory
Creates a port object that is owned by owner

Specified by:
createPort in interface GraphElementFactory
owner - The owner of the port object
Returns:
a new port object, or null if ports are not supported

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.