com.yworks.yfiles.server.graphml.support
Class Graph2DRoundtripSupportBase

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
      extended bycom.yworks.yfiles.server.graphml.support.Graph2DRoundtripSupportBase
All Implemented Interfaces:
RoundtripSupport
Direct Known Subclasses:
Graph2DRoundtripSupport

public class Graph2DRoundtripSupportBase
extends AbstractGraphRoundtripSupport

A RoundtripSupport for use with the y.view package.

The io handler will be configured to parse and serialize NodeRealizer and EdgeRealizer instances by using NodeRealizerSerializers and EdgeRealizerSerializers.


Field Summary
 
Fields inherited from class com.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
EDGE_2_ID_DPKEY, mappers, NODE_2_ID_DPKEY, objectMappers, PARAM_GRAPH, RESPONSE_DOCUMENT_TAG, USERTAGS_DPKEY
 
Constructor Summary
Graph2DRoundtripSupportBase()
           
 
Method Summary
protected  void configureHandler(Graph2DGraphMLHandler handler)
          Configures the provided handler.
protected  void configureRoundtripGraph(LayoutGraph layoutGraph)
          Configure the layout graph.
protected  Graph2DGraphMLHandler createHandler()
          Creates the handler that will be used for the IO.
 LayoutGraph createRoundtripGraph()
          Creates a Graph2D instance and calls configureRoundtripGraph(y.layout.LayoutGraph).
 boolean isHierarchyEnabled()
          Gets whether the roundtrip graph should be configured with hierarchy support.
 void readGraph(java.io.InputStream is, Graph graph)
          Reads the graph from the given stream using the current handler.
 void readGraph(java.net.URL url, Graph graph)
          Reads the graph from the given url using the current handler.
 void sendGraph(Graph graph, java.io.OutputStream os, java.lang.String outputEncoding)
          Writes the current graph to the stream in GraphML format using the provided encoding.
 void setHierarchyEnabled(boolean hierarchyEnabled)
          Sets whether the roundtrip graph should be configured with hierarchy support.
 
Methods inherited from class com.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
addMapper, addObjectMapper, createAutoMapperInputHandlerProvider, createAutoMapperOutputHandlerProvider, createDefaultElementTagWrapper, createInputHandlerProvider, createObjectInputHandlerProvider, createObjectOutputHandlerProvider, createOutputHandlerProvider, createTagInputHandlerProvider, createTagOutputHandler, createXmlWriter, getGraphDecoder, getTagInputHandlerProvider, getTagOutputHandler, isSupportUserTags, sendError, setSupportUserTags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph2DRoundtripSupportBase

public Graph2DRoundtripSupportBase()
Method Detail

configureHandler

protected void configureHandler(Graph2DGraphMLHandler handler)
Configures the provided handler. This method is called by createHandler() after the creation of the handler instance.

The default implementation adds input and output handlers for custom mapper attributes as well as for node and edge ids stored in data providers using the keys AbstractGraphRoundtripSupport.NODE_2_ID_DPKEY and AbstractGraphRoundtripSupport.EDGE_2_ID_DPKEY.

Parameters:
handler - The io handler to be configured.

isHierarchyEnabled

public boolean isHierarchyEnabled()
Gets whether the roundtrip graph should be configured with hierarchy support.


setHierarchyEnabled

public void setHierarchyEnabled(boolean hierarchyEnabled)
Sets whether the roundtrip graph should be configured with hierarchy support.


readGraph

public void readGraph(java.io.InputStream is,
                      Graph graph)
               throws java.io.IOException
Description copied from interface: RoundtripSupport
Reads the graph from the given stream using the current handler.

Parameters:
is - the stream to use - the encoding should be UTF-8
graph - the graph to read the result in.
Throws:
java.io.IOException - if an io exception occurred.

createHandler

protected Graph2DGraphMLHandler createHandler()
Creates the handler that will be used for the IO. This implementation creates the instance and calls configureHandler(y.io.graphml.graph2d.Graph2DGraphMLHandler) which adds IO support for the node ids and edge ids as well as for custom mappers.

Returns:
A pre-configured handler that can read to and write from graph instances. created by createRoundtripGraph().

readGraph

public void readGraph(java.net.URL url,
                      Graph graph)
               throws java.io.IOException
Description copied from interface: RoundtripSupport
Reads the graph from the given url using the current handler.

Parameters:
url - the URL to use
graph - the graph to read the result in.
Throws:
java.io.IOException - if an io exception occurred.

sendGraph

public void sendGraph(Graph graph,
                      java.io.OutputStream os,
                      java.lang.String outputEncoding)
               throws java.io.IOException
Description copied from interface: RoundtripSupport
Writes the current graph to the stream in GraphML format using the provided encoding. This method will not close the stream.

Parameters:
graph - The current graph.
os - The stream to write the graph to.
Throws:
java.io.IOException - If something goes wrong during GraphML export.

createRoundtripGraph

public LayoutGraph createRoundtripGraph()
Creates a Graph2D instance and calls configureRoundtripGraph(y.layout.LayoutGraph).

Returns:
an instance that can be used for reading and writing graphs.

configureRoundtripGraph

protected void configureRoundtripGraph(LayoutGraph layoutGraph)
Description copied from class: AbstractGraphRoundtripSupport
Configure the layout graph.

The default implementation adds the data providers that are required for client-server round tripping and the data providers for any custom mappers that were added using AbstractGraphRoundtripSupport.addMapper(Object, String,y.io.graphml.KeyType,y.io.graphml.KeyScope) and AbstractGraphRoundtripSupport.addObjectMapper(Object, y.io.graphml.KeyScope, y.io.graphml.output.SerializationHandler, y.io.graphml.input.DeserializationHandler).

Overrides:
configureRoundtripGraph in class AbstractGraphRoundtripSupport
Parameters:
layoutGraph - The layout graph instance that is used for round tripping.


Copyright © 2000-2013 yWorks GmbH. All rights reserved