Search this API

y.io.graphml.graph2d
Class AbstractNodeRealizerSerializer

java.lang.Object
  extended by y.io.graphml.graph2d.AbstractNodeRealizerSerializer
All Implemented Interfaces:
NodeRealizerSerializer
Direct Known Subclasses:
FallbackNodeRealizerSerializer, GenericNodeRealizerSerializer, ImageNodeRealizerSerializer, ProxyShapeNodeRealizerSerializer, ShapeNodeRealizerSerializer

public abstract class AbstractNodeRealizerSerializer
extends java.lang.Object
implements NodeRealizerSerializer

Abstract base class for instances of NodeRealizerSerializer. This class parses/writes basic properties of NodeRealizers.

 
Your browser does not support SVG content.

Constructor Summary
AbstractNodeRealizerSerializer()
           
 
Method Summary
 boolean canHandle(org.w3c.dom.Node n, GraphMLParseContext context)
          Returns true iff n.getNamespaceURI().equals(getNamespaceURI()) && n.getLocalName().equals(getName()).
 boolean canHandle(NodeRealizer nr, GraphMLWriteContext context)
          Returns true iff nr.getClass() == getRealizerClass().
 NodeRealizer 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(NodeRealizer nr, org.w3c.dom.Node domNode, GraphMLParseContext context)
          Parses the properties into an instance of NodeRealizer.
protected  void parseLabel(NodeRealizer nr, org.w3c.dom.Node n, GraphMLParseContext context)
          Parses a single NodeLabel element.
protected  void parseNodePorts(NodeRealizer nr, org.w3c.dom.Node domNode, GraphMLParseContext context)
          Parses the NodePorts elements and its NodePort child elements.
 void write(NodeRealizer nr, XmlWriter writer, GraphMLWriteContext context)
          Writes the realizer element's content.
 void writeAttributes(NodeRealizer nr, XmlWriter writer, GraphMLWriteContext context)
          Writes the attributes of an NodeRealizer element.
protected  void writeBorder(NodeRealizer nr, XmlWriter writer)
          Writes the BorderStyle element.
protected  void writeFill(XmlWriter writer, NodeRealizer nr)
          Writes the Fill element.
protected  void writeNodeLabel(NodeLabel label, XmlWriter writer, GraphMLWriteContext context)
          Writes a single NodeLabel element.
protected  void writeNodePorts(NodeRealizer nr, XmlWriter writer, GraphMLWriteContext context)
          Writes the NodePorts elements and its NodePort child elements.
 
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.NodeRealizerSerializer
getName, getNamespaceURI, getRealizerClass
 

Constructor Detail

AbstractNodeRealizerSerializer

public AbstractNodeRealizerSerializer()
Method Detail

parse

public void parse(NodeRealizer nr,
                  org.w3c.dom.Node domNode,
                  GraphMLParseContext context)
           throws GraphMLParseException
Description copied from interface: NodeRealizerSerializer
Parses the properties into an instance of NodeRealizer.

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

parseNodePorts

protected void parseNodePorts(NodeRealizer nr,
                              org.w3c.dom.Node domNode,
                              GraphMLParseContext context)
                       throws GraphMLParseException
Parses the NodePorts elements and its NodePort child elements.

Parameters:
nr - The node realizer that will own the node ports.
domNode - The DOM node containing node port data.
context - The current parse context.
Throws:
GraphMLParseException

parseLabel

protected void parseLabel(NodeRealizer nr,
                          org.w3c.dom.Node n,
                          GraphMLParseContext context)
                   throws GraphMLParseException
Parses a single NodeLabel element.

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

writeAttributes

public void writeAttributes(NodeRealizer nr,
                            XmlWriter writer,
                            GraphMLWriteContext context)
Description copied from interface: NodeRealizerSerializer
Writes the attributes of an NodeRealizer element.

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

write

public void write(NodeRealizer nr,
                  XmlWriter writer,
                  GraphMLWriteContext context)
           throws GraphMLWriteException
Description copied from interface: NodeRealizerSerializer
Writes the realizer element's content.

Specified by:
write in interface NodeRealizerSerializer
Parameters:
nr - The Realizer to write.
writer - The XmlWriter for the serialization.
context - The current write context.
Throws:
GraphMLWriteException

writeBorder

protected void writeBorder(NodeRealizer nr,
                           XmlWriter writer)
Writes the BorderStyle element.

Parameters:
writer - The writer to use.
nr - The NodeRealizer whose border style is to be written.

writeNodePorts

protected void writeNodePorts(NodeRealizer nr,
                              XmlWriter writer,
                              GraphMLWriteContext context)
                       throws GraphMLWriteException
Writes the NodePorts elements and its NodePort child elements.

Parameters:
nr - The node realizer for which node port information is written.
writer - The XML writer to use.
context - The current write context.
Throws:
GraphMLWriteException

writeNodeLabel

protected void writeNodeLabel(NodeLabel label,
                              XmlWriter writer,
                              GraphMLWriteContext context)
                       throws GraphMLWriteException
Writes a single NodeLabel element.

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

writeFill

protected void writeFill(XmlWriter writer,
                         NodeRealizer nr)
Writes the Fill element.

Parameters:
writer - The writer to use.
nr - The NodeRealizer whose fill is to be written.

canHandle

public boolean canHandle(NodeRealizer nr,
                         GraphMLWriteContext context)
Returns true iff nr.getClass() == getRealizerClass().

Specified by:
canHandle in interface NodeRealizerSerializer
Parameters:
nr - The realizer that may be written.
context - The current write context.
Returns:
true iff nr.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 NodeRealizerSerializer
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 NodeRealizer createRealizerInstance(org.w3c.dom.Node node,
                                           GraphMLParseContext context)
                                    throws GraphMLParseException
Description copied from interface: NodeRealizerSerializer
Create new instance of the Realizer from the given information

Specified by:
createRealizerInstance in interface NodeRealizerSerializer
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 NodeRealizerSerializer
Returns:
null, meaning that a predeclared mapping should be used.

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