Search this API

y.io.graphml.graph2d
Class AbstractEdgeRealizerSerializer

java.lang.Object
  extended by y.io.graphml.graph2d.AbstractEdgeRealizerSerializer
All Implemented Interfaces:
EdgeRealizerSerializer
Direct Known Subclasses:
ArcEdgeRealizerSerializer, BezierEdgeRealizerSerializer, FallbackEdgeRealizerSerializer, GenericEdgeRealizerSerializer, PolyLineEdgeRealizerSerializer, QuadCurveEdgeRealizerSerializer, SplineEdgeRealizerSerializer

public abstract class AbstractEdgeRealizerSerializer
extends java.lang.Object
implements EdgeRealizerSerializer

Abstract base class for instances of EdgeRealizerSerializer. This class parses/writes basic properties of EdgeRealizers.

 
Your browser does not support SVG content.

Constructor Summary
AbstractEdgeRealizerSerializer()
           
 
Method Summary
 boolean canHandle(EdgeRealizer er, GraphMLWriteContext context)
          Returns true iff er.getClass() == getRealizerClass().
 boolean canHandle(org.w3c.dom.Node n, GraphMLParseContext context)
          Returns true iff n.getNamespaceURI().equals(getNamespaceURI()) && n.getLocalName().equals(getName()).
 EdgeRealizer createRealizerInstance(org.w3c.dom.Node node, GraphMLParseContext context)
          Create new instance of the Realizer from the given information
 java.lang.String getNamespacePrefix()
          The namespace prefix to use for writing.
 void parse(EdgeRealizer er, org.w3c.dom.Node domNode, GraphMLParseContext context)
          Parses the properties from an instance of EdgeRealizer.
protected  void parseLabel(EdgeRealizer er, org.w3c.dom.Node n, GraphMLParseContext context)
          Parses a single EdgeLabel element.
protected  Port parsePort(org.w3c.dom.Node domNode, GraphMLParseContext context)
          Parses a single SourcePort or TargetPort element.
 void write(EdgeRealizer edgeRealizer, XmlWriter ps, GraphMLWriteContext context)
          Writes the realizer element's content.
 void writeAttributes(EdgeRealizer er, XmlWriter writer, GraphMLWriteContext context)
          Writes the attributes of an EdgeRealizer element.
protected  void writeEdgeLabel(EdgeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Write a single EdgeLabel element.
protected  void writePort(Port port, XmlWriter ps, GraphMLWriteContext context, boolean atSource)
          Write a single SourcePort or TargetPort element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface y.io.graphml.graph2d.EdgeRealizerSerializer
getName, getNamespaceURI, getRealizerClass
 

Constructor Detail

AbstractEdgeRealizerSerializer

public AbstractEdgeRealizerSerializer()
Method Detail

parse

public void parse(EdgeRealizer er,
                  org.w3c.dom.Node domNode,
                  GraphMLParseContext context)
           throws GraphMLParseException
Parses the properties from an instance of EdgeRealizer.

Specified by:
parse in interface EdgeRealizerSerializer
Parameters:
er - An existing EdgeRealizer instance which is configured.
domNode - The XML node containing the realizer data.
context - The current parse context.
Throws:
GraphMLParseException

parseLabel

protected void parseLabel(EdgeRealizer er,
                          org.w3c.dom.Node n,
                          GraphMLParseContext context)
                   throws GraphMLParseException
Parses a single EdgeLabel element.

Parameters:
er - The EdgeRealizer that will own this label.
n - The DOM node containing the label data.
context - The current parse context.
Throws:
GraphMLParseException

parsePort

protected Port parsePort(org.w3c.dom.Node domNode,
                         GraphMLParseContext context)
                  throws GraphMLParseException
Parses a single SourcePort or TargetPort element.

Parameters:
context - The current parse context.
domNode - The DOM node containing the Port data.
Throws:
GraphMLParseException

writeAttributes

public void writeAttributes(EdgeRealizer er,
                            XmlWriter writer,
                            GraphMLWriteContext context)
Description copied from interface: EdgeRealizerSerializer
Writes the attributes of an EdgeRealizer element.

Specified by:
writeAttributes in interface EdgeRealizerSerializer
Parameters:
er - The Realizer to write.
writer - The XmlWriter for the serialization.
context - The current write context.

write

public void write(EdgeRealizer edgeRealizer,
                  XmlWriter ps,
                  GraphMLWriteContext context)
           throws GraphMLWriteException
Description copied from interface: EdgeRealizerSerializer
Writes the realizer element's content.

Specified by:
write in interface EdgeRealizerSerializer
Parameters:
edgeRealizer - The Realizer to write.
ps - The XmlWriter for the serialization.
context - The current write context.
Throws:
GraphMLWriteException

writeEdgeLabel

protected void writeEdgeLabel(EdgeLabel label,
                              XmlWriter writer,
                              GraphMLWriteContext context)
                       throws GraphMLWriteException
Write a single EdgeLabel element.

Parameters:
context - The current parse context.
writer - The XML writer to use.
label - The label to write.
Throws:
GraphMLWriteException

writePort

protected void writePort(Port port,
                         XmlWriter ps,
                         GraphMLWriteContext context,
                         boolean atSource)
Write a single SourcePort or TargetPort element.

Parameters:
context - The current parse context.
ps - The XML writer to use.
port - The port to write.
atSource - true iff a SourcePort should be written.

canHandle

public boolean canHandle(EdgeRealizer er,
                         GraphMLWriteContext context)
Returns true iff er.getClass() == getRealizerClass().

Specified by:
canHandle in interface EdgeRealizerSerializer
Parameters:
er - The Realizer that my be written
context - The current write context
Returns:
true iff er.getClass() == getRealizerClass().

canHandle

public boolean canHandle(org.w3c.dom.Node n,
                         GraphMLParseContext context)
Returns true iff n.getNamespaceURI().equals(getNamespaceURI()) && n.getLocalName().equals(getName()).

Specified by:
canHandle in interface EdgeRealizerSerializer
Parameters:
n - The DOM node that may be parsed.
context - The current parse context.
Returns:
true iff n.getNamespaceURI().equals(getNamespaceURI()) && n.getLocalName().equals(getName()).

createRealizerInstance

public EdgeRealizer createRealizerInstance(org.w3c.dom.Node node,
                                           GraphMLParseContext context)
                                    throws GraphMLParseException
Description copied from interface: EdgeRealizerSerializer
Create new instance of the Realizer from the given information

Specified by:
createRealizerInstance in interface EdgeRealizerSerializer
Parameters:
node - The DOM node that represents the realizer data.
context - The current parse context.
Returns:
new instance of the Realizer
Throws:
GraphMLParseException

getNamespacePrefix

public java.lang.String getNamespacePrefix()
The namespace prefix to use for writing.

Specified by:
getNamespacePrefix in interface EdgeRealizerSerializer
Returns:
null, meaning that a predeclared mapping should be used.

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