Search this API

y.view
Class NodeScaledPortLocationModel.Handler

java.lang.Object
  extended by y.view.NodeScaledPortLocationModel.Handler
All Implemented Interfaces:
java.util.EventListener, DeserializationHandler, SerializationHandler
Enclosing class:
NodeScaledPortLocationModel

public static class NodeScaledPortLocationModel.Handler
extends java.lang.Object
implements SerializationHandler, DeserializationHandler

Provides GraphML (de-)serialization support for NodeScaledPortLocationModel and its parameters.

 

Constructor Summary
NodeScaledPortLocationModel.Handler()
          Initializes a new Handler instance.
 
Method Summary
protected  NodeScaledPortLocationModel createModel(org.w3c.dom.NamedNodeMap attributes, GraphMLParseContext context)
          Creates a new instance of NodeScaledPortLocationModel.
static boolean isGeometryElement(org.w3c.dom.Node node)
          Determines whether or not the given XML node is a <Geometry> element.
protected  boolean isModelElement(org.w3c.dom.Node node)
          Determines whether or not the given XML node is a Element that stores NodeScaledPortLocationModel data.
 void onHandleDeserialization(DeserializationEvent event)
          Deserializes NodeScaledPortLocationModel models and model parameters.
 void onHandleSerialization(SerializationEvent event)
          Serializes NodeScaledPortLocationModel models and model parameters.
 PortLocationModelParameter readAttributes(org.w3c.dom.NamedNodeMap attributes, GraphMLParseContext context)
          Reads the given XML attributes to create a port location model parameter for NodeScaledPortLocationModel.
 void writeAttributes(PortLocationModelParameter parameter, XmlWriter writer, GraphMLWriteContext context)
          Writes the specified port location model parameter as attributes for the given XmlWriter's current element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeScaledPortLocationModel.Handler

public NodeScaledPortLocationModel.Handler()
Initializes a new Handler instance.

Method Detail

onHandleSerialization

public void onHandleSerialization(SerializationEvent event)
                           throws GraphMLWriteException
Serializes NodeScaledPortLocationModel models and model parameters. Creates <NodeScaledPortLocationModel> elements.

Calls writeAttributes.

Specified by:
onHandleSerialization in interface SerializationHandler
Parameters:
event - Event that contains all data that is needed for serialization.
Throws:
GraphMLWriteException

writeAttributes

public void writeAttributes(PortLocationModelParameter parameter,
                            XmlWriter writer,
                            GraphMLWriteContext context)
                     throws GraphMLWriteException
Writes the specified port location model parameter as attributes for the given XmlWriter's current element.

Called from onHandleSerialization.

Parameters:
parameter - the port location model parameter to serialize. Must be an instance created by NodeScaledPortLocationModel.
writer - the XmlWriter used for serialization.
context - the current write context.
Throws:
GraphMLWriteException
See Also:
readAttributes(org.w3c.dom.NamedNodeMap, y.io.graphml.input.GraphMLParseContext)

onHandleDeserialization

public void onHandleDeserialization(DeserializationEvent event)
                             throws GraphMLParseException
Deserializes NodeScaledPortLocationModel models and model parameters. Parses <Geometry> elements with <NodeScaledPortLocationModel> children.

Calls isModelElement and readAttributes.

Specified by:
onHandleDeserialization in interface DeserializationHandler
Parameters:
event - Event that contains all data that is needed for deserialization.
Throws:
GraphMLParseException

readAttributes

public PortLocationModelParameter readAttributes(org.w3c.dom.NamedNodeMap attributes,
                                                 GraphMLParseContext context)
                                          throws GraphMLParseException
Reads the given XML attributes to create a port location model parameter for NodeScaledPortLocationModel.

Calls createModel to create a model instance for the returned model parameter.

Called from onHandleDeserialization.

Parameters:
attributes - the XML attributes to read.
context - the current parse context.
Returns:
a new NodeScaledPortLocationModel model parameter instance.
Throws:
GraphMLParseException
See Also:
writeAttributes(PortLocationModelParameter, y.io.graphml.output.XmlWriter, y.io.graphml.output.GraphMLWriteContext)

createModel

protected NodeScaledPortLocationModel createModel(org.w3c.dom.NamedNodeMap attributes,
                                                  GraphMLParseContext context)
                                           throws GraphMLParseException
Creates a new instance of NodeScaledPortLocationModel.

Called from readAttributes.

Parameters:
attributes - the XML attributes for which the model is created.
context - the current parse context.
Returns:
a new instance of NodeScaledPortLocationModel.
Throws:
GraphMLParseException

isModelElement

protected boolean isModelElement(org.w3c.dom.Node node)
Determines whether or not the given XML node is a Element that stores NodeScaledPortLocationModel data.

Called from onHandleDeserialization.

Parameters:
node - the XML node to check.
Returns:
true if the given XML node is a Element that stores NodeScaledPortLocationModel data; false otherwise.

isGeometryElement

public static boolean isGeometryElement(org.w3c.dom.Node node)
Determines whether or not the given XML node is a <Geometry> element.

Parameters:
node - the XML node to check.
Returns:
true if the given XML node is a <Geometry> element; false otherwise.

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