Search this API

y.io.graphml.layout
Class LayoutGraphMLHandler

java.lang.Object
  extended by y.io.graphml.GraphMLHandler
      extended by y.io.graphml.layout.LayoutGraphMLHandler

public class LayoutGraphMLHandler
extends GraphMLHandler

Handles serialization and deserialization of LayoutGraph instances. Essentially, this class registers simple input and output handlers for reading and writing edge and node layout information.

 

Nested Class Summary
 
Nested classes/interfaces inherited from class y.io.graphml.GraphMLHandler
GraphMLHandler.BoolDataAcceptorInputHandler, GraphMLHandler.BooleanDataProviderOutputHandler, GraphMLHandler.DoubleDataAcceptorInputHandler, GraphMLHandler.DoubleDataProviderOutputHandler, GraphMLHandler.FloatDataAcceptorInputHandler, GraphMLHandler.FloatDataProviderOutputHandler, GraphMLHandler.InputHandlerQueryPredicate, GraphMLHandler.IntDataAcceptorInputHandler, GraphMLHandler.IntDataProviderOutputHandler, GraphMLHandler.LongDataAcceptorInputHandler, GraphMLHandler.LongDataProviderOutputHandler, GraphMLHandler.StringDataAcceptorInputHandler, GraphMLHandler.StringDataProviderOutputHandler
 
Constructor Summary
LayoutGraphMLHandler()
          Initializes a new LayoutGraphMLHandler instance.
 
Method Summary
protected  void configureGraphMLParser(Graph graph, GraphMLParser parser)
          Adds support for deserializing nested graphs.
protected  void configureGraphMLWriter(Graph graph, GraphMLWriter writer)
          Adds support for serializing nested graphs with group nodes and normal nodes.
protected  void configureInputHandlers(Graph graph, GraphMLParser parser)
          Registers input handlers for edge and node layout information.
protected  void configureLookup(Graph graph, GraphMLWriter writer)
          Adds support for serializing nested graphs with group nodes and normal nodes.
protected  void configureOutputHandlers(Graph graph, GraphMLWriter writer)
          Registers output handlers for edge and node layout information.
protected  InputHandlerProvider createEdgeLayoutInputHandlerProvider()
          Creates a provider for EdgeLayoutInputHandler.
protected  OutputHandlerProvider createEdgeLayoutOutputHandlerProvider()
          Creates a provider for EdgeLayoutOutputHandler.
protected  ParseEventListener createFolderTypeReader(Graph graph, GraphMLParser parser)
          Creates a ParseEventListener that parses yfiles.foldertype attributes.
protected  WriteEventListener createFolderTypeWriter(Graph graph, GraphMLWriter writer)
          Creates a WriteEventListener instance that marks group nodes.
protected  GraphElementFactory createGraphElementFactory(GraphMLParser parser, Graph graph)
          Creates a graph element factory that supports nesting information for GroupingKeys that reference DataAcceptor implementations.
protected  HierarchySupport createHierarchySupport(Graph graph, GraphMLWriter writer)
          Creates a HierarchySupport instance that supports group nodes and normal nodes.
protected  InputHandlerProvider createNodeLayoutInputHandlerProvider()
          Creates a provider for NodeLayoutInputHandler.
protected  OutputHandlerProvider createNodeLayoutOutputHandlerProvider()
          Creates a provider for NodeLayoutOutputHandler.
 
Methods inherited from class y.io.graphml.GraphMLHandler
addDeserializationHandler, addInputDataAcceptor, addInputDataAcceptor, addInputDataAcceptor, addInputDataAcceptor, addInputDataAcceptor, addInputDataAcceptor, addInputDataAcceptorFuture, addInputDataAcceptorFuture, addInputDataAcceptorFuture, addInputHandlerProvider, addNamespace, addOutputDataProvider, addOutputDataProvider, addOutputDataProvider, addOutputDataProvider, addOutputHandlerProvider, addParseEventListener, addRegisteredOutputDataProvider, addRegisteredOutputDataProvider, addRegisteredOutputDataProvider, addSchemaLocation, addSerializationHandler, addWriteEventListener, configureDeserializationHandlers, configureDeserializationProperties, configureLookup, configureNamespaces, configureParseEvents, configureSchemaLocations, configureSerializationHandlers, configureSerializationProperties, configureWriteEvents, configureXMLWriter, createGraphMLParser, createGraphMLWriter, createXMLWriter, createXMLWriter, fireDeserializationEvent, fireQueryInputHandlersProviders, fireQueryOutputHandlersEvent, fireSerializationEvent, getDeserializationProperty, getKeyName, getKeyScope, getKeyType, getKeyUri, getSerializationProperty, isClearGraphBeforeRead, isWriteXMLSchema, matchesName, matchesScope, matchesType, matchesUri, onGraphMLParserHandleDeserialization, onGraphMLParserQueryInputHandlers, onGraphMLWriterHandleSerialization, onGraphMLWriterQueryOutputHandlers, read, read, removeDeserializationHandler, removeDeserializationProperty, removeInputHandlerProvider, removeOutputHandlerProvider, removeParseEventListener, removeSerializationHandler, removeSerializationProperty, removeWriteEventListener, setClearGraphBeforeRead, setDeserializationProperty, setSerializationProperty, setWriteXMLSchema, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutGraphMLHandler

public LayoutGraphMLHandler()
Initializes a new LayoutGraphMLHandler instance.

Method Detail

configureGraphMLParser

protected void configureGraphMLParser(Graph graph,
                                      GraphMLParser parser)
Adds support for deserializing nested graphs.

Overrides:
configureGraphMLParser in class GraphMLHandler
Parameters:
graph - The graph that should be filled by this instance.
parser - The parser to configure.
See Also:
createFolderTypeReader(y.base.Graph, y.io.graphml.input.GraphMLParser)

createFolderTypeReader

protected ParseEventListener createFolderTypeReader(Graph graph,
                                                    GraphMLParser parser)
Creates a ParseEventListener that parses yfiles.foldertype attributes.

The default implementation sets creation properties IS_GROUP_NODE and IS_FOLDER_NODE depending on yfiles.foldertype values.

Called from configureGraphMLParser(y.base.Graph, y.io.graphml.input.GraphMLParser). May return null.

Parameters:
graph - The graph that should be filled by this instance.
parser - The parser to configure.
Returns:
a new ParseEventListener that parses yfiles.foldertype attributes or null if those attributes should be ignored.
See Also:
configureGraphMLParser(y.base.Graph, y.io.graphml.input.GraphMLParser)

createGraphElementFactory

protected GraphElementFactory createGraphElementFactory(GraphMLParser parser,
                                                        Graph graph)
Creates a graph element factory that supports nesting information for GroupingKeys that reference DataAcceptor implementations.

Overrides:
createGraphElementFactory in class GraphMLHandler
Parameters:
parser - The parser to use.
graph - The graph that is populated.
Returns:
a new GraphElementFactory instance.
See Also:
GroupingBasedGraphElementFactory

configureInputHandlers

protected void configureInputHandlers(Graph graph,
                                      GraphMLParser parser)
Registers input handlers for edge and node layout information.

Calls createNodeLayoutInputHandlerProvider(), and createEdgeLayoutInputHandlerProvider().

Overrides:
configureInputHandlers in class GraphMLHandler
Parameters:
graph - The graph that will be parsed
parser - The parser to configure.

createEdgeLayoutInputHandlerProvider

protected InputHandlerProvider createEdgeLayoutInputHandlerProvider()
Creates a provider for EdgeLayoutInputHandler. Called from configureInputHandlers(y.base.Graph, y.io.graphml.input.GraphMLParser).

Returns:
a provider for EdgeLayoutInputHandler.

createNodeLayoutInputHandlerProvider

protected InputHandlerProvider createNodeLayoutInputHandlerProvider()
Creates a provider for NodeLayoutInputHandler. Called from configureInputHandlers(y.base.Graph, y.io.graphml.input.GraphMLParser).

Returns:
a provider for NodeLayoutInputHandler.

configureGraphMLWriter

protected void configureGraphMLWriter(Graph graph,
                                      GraphMLWriter writer)
Adds support for serializing nested graphs with group nodes and normal nodes.

Overrides:
configureGraphMLWriter in class GraphMLHandler
Parameters:
graph - The graph to write.
writer - The writer to configure.
See Also:
createFolderTypeWriter(y.base.Graph, y.io.graphml.output.GraphMLWriter), configureLookup(y.base.Graph, y.io.graphml.output.GraphMLWriter)

createFolderTypeWriter

protected WriteEventListener createFolderTypeWriter(Graph graph,
                                                    GraphMLWriter writer)
Creates a WriteEventListener instance that marks group nodes.

The default implementation uses the HierarchySupport instance in the event's context to determine if a node is leaf node or not and adds a yfiles.foldertype="group" attribute to XML elements corresponding to non-leaf nodes.

Called from configureGraphMLWriter(y.base.Graph, y.io.graphml.output.GraphMLWriter). May return null.

Parameters:
graph - The graph to write.
writer - The writer to configure.
Returns:
a new WriteEventListener that marks group nodes or null if nodes should not be marked.
See Also:
configureGraphMLWriter(y.base.Graph, y.io.graphml.output.GraphMLWriter)

configureLookup

protected void configureLookup(Graph graph,
                               GraphMLWriter writer)
Adds support for serializing nested graphs with group nodes and normal nodes.

Overrides:
configureLookup in class GraphMLHandler
Parameters:
graph - The graph to write.
writer - The writer to configure.
See Also:
createHierarchySupport(y.base.Graph, y.io.graphml.output.GraphMLWriter), configureGraphMLWriter(y.base.Graph, y.io.graphml.output.GraphMLWriter)

createHierarchySupport

protected HierarchySupport createHierarchySupport(Graph graph,
                                                  GraphMLWriter writer)
Creates a HierarchySupport instance that supports group nodes and normal nodes.

The default implementation returns a GroupingBasedHierarchySupport if the given graph has associated GroupingKeys that define the graph's nesting structure.

Called from configureLookup(y.base.Graph, y.io.graphml.output.GraphMLWriter). May return null.

Parameters:
graph - The graph to write.
writer - The writer to configure.
Returns:
a new GroupingBasedHierarchySupport instance or null if a graph's nesting structure should not be serialized.
See Also:
Grouping.isGrouped(y.base.Graph), configureLookup(y.base.Graph, y.io.graphml.output.GraphMLWriter)

configureOutputHandlers

protected void configureOutputHandlers(Graph graph,
                                       GraphMLWriter writer)
Registers output handlers for edge and node layout information.

Calls createEdgeLayoutOutputHandlerProvider(), and createNodeLayoutOutputHandlerProvider().

Overrides:
configureOutputHandlers in class GraphMLHandler
Parameters:
graph - The graph that will be written
writer - The writer to configure.

createEdgeLayoutOutputHandlerProvider

protected OutputHandlerProvider createEdgeLayoutOutputHandlerProvider()
Creates a provider for EdgeLayoutOutputHandler. Called from configureOutputHandlers(y.base.Graph, y.io.graphml.output.GraphMLWriter).

Returns:
a provider for EdgeLayoutOutputHandler.

createNodeLayoutOutputHandlerProvider

protected OutputHandlerProvider createNodeLayoutOutputHandlerProvider()
Creates a provider for NodeLayoutOutputHandler. Called from configureOutputHandlers(y.base.Graph, y.io.graphml.output.GraphMLWriter).

Returns:
a provider for NodeLayoutOutputHandler.

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