Search this API

y.io.graphml.graph2d
Class GraphicsSerializationToolkit

java.lang.Object
  extended by y.io.graphml.graph2d.GraphicsSerializationToolkit

public class GraphicsSerializationToolkit
extends java.lang.Object

Collection of utilities for handling GraphML.

 

Method Summary
static boolean getBooleanDeserializationProperty(GraphMLParseContext context, java.lang.Object key)
           
static boolean getBooleanSerializationProperty(GraphMLWriteContext context, java.lang.Object key)
           
static java.lang.String getInnerText(org.w3c.dom.Node node)
          Returns the concatenation of the contents of the child text and CDATA nodes of the given node.
static java.awt.Color parseColor(java.lang.String colorString)
          Decodes a color string produced by valueOf(java.awt.Color).
static java.awt.Color parseColor(java.lang.String colorString, boolean isRGBA)
          Decodes color strings in hexadecimal RGB, RGBA and ARGB formats.
static void parseNodeLayout(org.w3c.dom.Node root, NodeLayout nl)
          Configure the specified node layout from the data in the given XML node.
static void parsePath(org.w3c.dom.Node root, EdgeLayout el)
          Configure the specified edge layout from the data in the given XML node.
static java.lang.String parseText(org.w3c.dom.Node text)
          Concatenates the first adjacent text node children of text.
static java.awt.Image readSharedImageReference(java.lang.String refid, GraphMLParseContext context)
           
static java.lang.Object readSharedReference(java.lang.String refid, GraphMLParseContext context, java.lang.Class targetType)
           
static java.lang.String valueOf(java.awt.Color c)
          Gets the standard string representation of a java color.
static void writeNodeLayout(XmlWriter writer, NodeLayout nl)
          Writes the layout for a NodeLayout.
static void writePath(XmlWriter writer, EdgeLayout layout)
          Writes the path of an EdgeLayout.
static void writeSharedImageReference(java.awt.Image ser, XmlWriter writer, java.lang.String refIdAttrName, GraphMLWriteContext context)
           
static void writeSharedReference(java.lang.Object ser, XmlWriter writer, java.lang.String refIdAttrName, GraphMLWriteContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writePath

public static void writePath(XmlWriter writer,
                             EdgeLayout layout)
Writes the path of an EdgeLayout.


writeNodeLayout

public static void writeNodeLayout(XmlWriter writer,
                                   NodeLayout nl)
Writes the layout for a NodeLayout.


valueOf

public static java.lang.String valueOf(java.awt.Color c)
Gets the standard string representation of a java color.


parseText

public static java.lang.String parseText(org.w3c.dom.Node text)
Concatenates the first adjacent text node children of text.

Parameters:
text - The parent node whose text content is evaluated.
Returns:
The concatenated content of the first adjacent text node children of text.

parseNodeLayout

public static void parseNodeLayout(org.w3c.dom.Node root,
                                   NodeLayout nl)
Configure the specified node layout from the data in the given XML node.

Parameters:
root - The layout data
nl - The NodeLayout to configure.

parsePath

public static void parsePath(org.w3c.dom.Node root,
                             EdgeLayout el)
Configure the specified edge layout from the data in the given XML node.

Parameters:
root - The layout data
el - The edge layout to configure.

parseColor

public static java.awt.Color parseColor(java.lang.String colorString)
Decodes a color string produced by valueOf(java.awt.Color).

Parameters:
colorString - the color string
Returns:
an opaque color if the color string is of the form #RRGGBB and a transparent color if the input string is of the form #RRGGBBAA, where AA denotes the alpha component of the color.

parseColor

public static java.awt.Color parseColor(java.lang.String colorString,
                                        boolean isRGBA)
Decodes color strings in hexadecimal RGB, RGBA and ARGB formats. For RGB, the string format is assumed to be #RRGGBB. For RGBA, the string format is assumed to be #RRGGBBAA. For ARGB, the string format is assumed to be #AARRGGBB.

Parameters:
colorString - the color string.
isRGBA - if true, input with four color channels is assumed to be in RGBA format; otherwise it is assumed to be in ARGB format.

writeSharedReference

public static void writeSharedReference(java.lang.Object ser,
                                        XmlWriter writer,
                                        java.lang.String refIdAttrName,
                                        GraphMLWriteContext context)

writeSharedImageReference

public static void writeSharedImageReference(java.awt.Image ser,
                                             XmlWriter writer,
                                             java.lang.String refIdAttrName,
                                             GraphMLWriteContext context)

readSharedReference

public static java.lang.Object readSharedReference(java.lang.String refid,
                                                   GraphMLParseContext context,
                                                   java.lang.Class targetType)
                                            throws GraphMLParseException
Throws:
GraphMLParseException

readSharedImageReference

public static java.awt.Image readSharedImageReference(java.lang.String refid,
                                                      GraphMLParseContext context)
                                               throws GraphMLParseException
Throws:
GraphMLParseException

getBooleanSerializationProperty

public static boolean getBooleanSerializationProperty(GraphMLWriteContext context,
                                                      java.lang.Object key)

getBooleanDeserializationProperty

public static boolean getBooleanDeserializationProperty(GraphMLParseContext context,
                                                        java.lang.Object key)

getInnerText

public static java.lang.String getInnerText(org.w3c.dom.Node node)
Returns the concatenation of the contents of the child text and CDATA nodes of the given node.

Parameters:
node - a node
Returns:
the text and CDATA contents

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