Packagecom.yworks.io.graphml.realizer
Classpublic class GraphicsSerializationToolkit
InheritanceGraphicsSerializationToolkit Inheritance Object

Provides static helper functions for parsing and writing graphml files. Most of these methods are used by IRealizerSerializer instances.



Public Methods
 MethodDefined By
  
codeARGB(color:uint, alpha:Number):String
[static] Gets a String representation of a ARGB color.
GraphicsSerializationToolkit
  
codeArrow(edge:IEdge, arrow:IArrow):String
[static] Gets a String representation for the given arrow.
GraphicsSerializationToolkit
  
codeColor(color:uint):String
[static] Gets a String representation of a RGB color.
GraphicsSerializationToolkit
  
codeLocation(x:Number, y:Number, writer:IXmlWriter):void
[static] Writes x and y attributes to the actual XML element.
GraphicsSerializationToolkit
  
codeNamedOrARGBColor(color:uint, alpha:Number):String
[static] Creates a String representation for the given RGB color and alpha value.
GraphicsSerializationToolkit
  
codeSize(width:Number, height:Number, writer:IXmlWriter):void
[static] Writes width and height attributes to the actual XML element.
GraphicsSerializationToolkit
  
[static]
GraphicsSerializationToolkit
  
convertNamedColor(colorStr:String):int
[static] Converts a name into a ARGB value
GraphicsSerializationToolkit
  
decodeColor(colorStr:String):uint
[static] Creates an int RGB number which is encoded by the given String.
GraphicsSerializationToolkit
  
decodeUserTag(context:GraphMLParseContext, attrValue:XML, o:ILookup):void
[static]
GraphicsSerializationToolkit
  
[static] Creates an ExteriorLabelModel parameter from a given key.
GraphicsSerializationToolkit
  
[static] Gets a String representation for the given ExteriorLabelModel parameter.
GraphicsSerializationToolkit
  
[static] Creates an InteriorLabelModel parameter from a given key.
GraphicsSerializationToolkit
  
[static] Gets a String representation for the given InteriorLabelModel parameter.
GraphicsSerializationToolkit
  
[static] Gets a String representation for the given InteriorStretchLabelModel parameter.
GraphicsSerializationToolkit
  
getLabelModel(modelName:String):ILabelModel
[static] Creates a label model for the given model name.
GraphicsSerializationToolkit
  
[static] Gets the name of the given label model.
GraphicsSerializationToolkit
  
getLabelModelParameter(key:String, stretch:Boolean = false):ILabelModelParameter
[static] Creates a label model parameter from a given key string.
GraphicsSerializationToolkit
  
[static] Gets a String representation for the given label model parameter.
GraphicsSerializationToolkit
  
[static] Gets the intersection point of the edge with it's source node.
GraphicsSerializationToolkit
  
parseARGB_Alpha(colorStr:String):Number
[static] Parses an ARGB string to get the alpha value.
GraphicsSerializationToolkit
  
parseARGB_Color(colorStr:String):uint
[static] Parses an ARGB string to get the RGB color.
GraphicsSerializationToolkit
  
parseArrows(arrowsElement:XML, edgeStyle:AbstractEdgeStyle):void
[static] Parses an XML element which represents an edge's arrows and setting the edge style accordingly.
GraphicsSerializationToolkit
  
parseBool(boolStr:String):Boolean
[static] Converts a String into a Boolean value.
GraphicsSerializationToolkit
  
parseFillColor(colorStr:String):IFill
[static] Creates a IFill instance with the color coded by the given String.
GraphicsSerializationToolkit
  
parseLineType(element:XML):LineType
[static] Parses a given XML element to create a line type.
GraphicsSerializationToolkit
  
parseLocation(element:XML):IPoint
[static] Creates an IPoint instance which holds the coordinates parsed from the given XML element.
GraphicsSerializationToolkit
  
[static] Parses a String for a hex or named representation of a color and creates a corresponding ColorStruct.
GraphicsSerializationToolkit
  
parseNodeLayout(nodeElement:XML, layout:IMutableRectangle):void
[static] Parses the given XML element which represents a node layout and sets the coordinates of the given layout rectangle accordingly.
GraphicsSerializationToolkit
  
parsePath(pathElement:XML, edge:IEdge, graph:IGraph):void
[static] Parses the given XML element which represents an edge path and sets the given edges path accordingly.
GraphicsSerializationToolkit
  
parseRGBAColor(colorStr:String):ColorStruct
[static] Parses a String which encodes a RGBA color ("#RRGGBBAA") and returns a ColorStruct.
GraphicsSerializationToolkit
  
parseStroke(colorStr:String, widthStr:String = 0, argb:Boolean = false):IStroke
[static] Creates a (simple) IStroke instance from a given String.
GraphicsSerializationToolkit
  
writeEdgelabel(writer:IXmlWriter, edge:IEdge, label:ILabel):void
[static] Writes an XML element representing a given edge label.
GraphicsSerializationToolkit
  
writeLineType(writer:IXmlWriter, tag:String, lineType:LineType):void
[static] Writes an XML element which codes the given line type.
GraphicsSerializationToolkit
  
writeLocation(writer:IXmlWriter, name:String, location:IPoint):void
[static] Writes the given location's coordinates to the given writer as element with the given name.
GraphicsSerializationToolkit
  
writeNodeLabel(writer:IXmlWriter, node:INode, label:ILabel):void
[static] Writes an XML element representing a given node label.
GraphicsSerializationToolkit
  
writeNodeLayout(writer:IXmlWriter, node:INode):void
[static] Writes the given node's layout to the given writer.
GraphicsSerializationToolkit
  
writePath(edge:IEdge, writer:IXmlWriter):void
[static] Writes the path of the given edge.
GraphicsSerializationToolkit
  
writeRGBAColor(writer:IXmlWriter, tag:String, color:uint, alpha:Number = 1.0):void
[static] Writes an XML element representing the given ARGB color.
GraphicsSerializationToolkit
Public Constants
 ConstantDefined By
  FOLDER_PORT_MAP : String = com.yworks.io.graphml.realizer.GraphicsSerializationToolkit.FOLDER_PORT_MAP
[static]
GraphicsSerializationToolkit
Method Detail
codeARGB()method
public static function codeARGB(color:uint, alpha:Number):String

Gets a String representation of a ARGB color.

Parameters

color:uint — The RGB color.
 
alpha:Number — The alpha value.

Returns
String — The ARGB string representation.
codeArrow()method 
public static function codeArrow(edge:IEdge, arrow:IArrow):String

Gets a String representation for the given arrow.

Parameters

edge:IEdge — The edge which owns the arrow.
 
arrow:IArrow — The arrow to get the String for.

Returns
String — A String which codes the arrow.
codeColor()method 
public static function codeColor(color:uint):String

Gets a String representation of a RGB color.

Parameters

color:uint — The RGB color to get the string for.

Returns
String — The String representation of the color.
codeLocation()method 
public static function codeLocation(x:Number, y:Number, writer:IXmlWriter):void

Writes x and y attributes to the actual XML element.

Parameters

x:Number — The value for the x attribute.
 
y:Number — The value for the y attribute.
 
writer:IXmlWriter — The writer to write to.

codeNamedOrARGBColor()method 
public static function codeNamedOrARGBColor(color:uint, alpha:Number):String

Creates a String representation for the given RGB color and alpha value. If a name exists for the color, that name is returned, otherwise a hex representation.

Parameters

color:uint — The RGB color.
 
alpha:Number — The Alpha value.

Returns
String — A String with the color's name or hex representation.
codeSize()method 
public static function codeSize(width:Number, height:Number, writer:IXmlWriter):void

Writes width and height attributes to the actual XML element.

Parameters

width:Number — The value for the width attribute.
 
height:Number — The value for the height attribute.
 
writer:IXmlWriter — The writer to write to.

codeUserTag()method 
public static function codeUserTag(context:GraphMLWriteContext, o:ILookup, writer:IXmlWriter):void

Parameters

context:GraphMLWriteContext
 
o:ILookup
 
writer:IXmlWriter

convertNamedColor()method 
public static function convertNamedColor(colorStr:String):int

Converts a name into a ARGB value

Parameters

colorStr:String — The name to convert.

Returns
int — The ARGB value corresponding to that name, or 0 if the name is not known.
decodeColor()method 
public static function decodeColor(colorStr:String):uint

Creates an int RGB number which is encoded by the given String.

Parameters

colorStr:String — A String coding a color.

Returns
uint — An int value represented by the given (hex) String.
decodeUserTag()method 
public static function decodeUserTag(context:GraphMLParseContext, attrValue:XML, o:ILookup):void

Parameters

context:GraphMLParseContext
 
attrValue:XML
 
o:ILookup

getExteriorLabelModelParameter()method 
public static function getExteriorLabelModelParameter(key:String):ILabelModelParameter

Creates an ExteriorLabelModel parameter from a given key.

Parameters

key:String — The key string to get the parameter for.

Returns
ILabelModelParameter — The created label model parameter.
getExteriorLabelModelParameterKey()method 
public static function getExteriorLabelModelParameterKey(parameter:ILabelModelParameter):String

Gets a String representation for the given ExteriorLabelModel parameter.

Parameters

parameter:ILabelModelParameter — The parameter to get the key for.

Returns
String — The String representation for the given parameter.
getInteriorLabelModelParameter()method 
public static function getInteriorLabelModelParameter(key:String):ILabelModelParameter

Creates an InteriorLabelModel parameter from a given key.

Parameters

key:String — The key string to get the parameter for.

Returns
ILabelModelParameter — The created label model parameter.
getInteriorLabelModelParameterKey()method 
public static function getInteriorLabelModelParameterKey(parameter:ILabelModelParameter):String

Gets a String representation for the given InteriorLabelModel parameter.

Parameters

parameter:ILabelModelParameter — The parameter to get the key for.

Returns
String — The String representation for the given parameter.
getInteriorStretchLabelModelParameterKey()method 
public static function getInteriorStretchLabelModelParameterKey(parameter:ILabelModelParameter):String

Gets a String representation for the given InteriorStretchLabelModel parameter.

Parameters

parameter:ILabelModelParameter — The parameter to get the key for.

Returns
String — The String representation for the given parameter.
getLabelModel()method 
public static function getLabelModel(modelName:String):ILabelModel

Creates a label model for the given model name.

Parameters

modelName:String — The name of the label model.

Returns
ILabelModel — A label mode represented by the given name.
getLabelModelName()method 
public static function getLabelModelName(model:ILabelModel):String

Gets the name of the given label model.

Parameters

model:ILabelModel — The model to get the name for.

Returns
String — The name of the given label model.
getLabelModelParameter()method 
public static function getLabelModelParameter(key:String, stretch:Boolean = false):ILabelModelParameter

Creates a label model parameter from a given key string.

Parameters

key:String — The key string to parse.
 
stretch:Boolean (default = false) — Whether the label model stretches over the labeled item.

Returns
ILabelModelParameter — The created label model parameter.
getLabelModelParameterKey()method 
public static function getLabelModelParameterKey(parameter:ILabelModelParameter):String

Gets a String representation for the given label model parameter.

Parameters

parameter:ILabelModelParameter — The parameter to get the key for.

Returns
String — The String representation for the given parameter.
getSourceIntersection()method 
public static function getSourceIntersection(edge:IEdge):IPoint

Gets the intersection point of the edge with it's source node.

Parameters

edge:IEdge — The edge to get the intersection for.

Returns
IPoint — The point at which the edge intersects with it's source node's bounds.
parseARGB_Alpha()method 
public static function parseARGB_Alpha(colorStr:String):Number

Parses an ARGB string to get the alpha value.

Parameters

colorStr:String — The String to parse.

Returns
Number — The alpha value.
parseARGB_Color()method 
public static function parseARGB_Color(colorStr:String):uint

Parses an ARGB string to get the RGB color.

Parameters

colorStr:String — The String to parse.

Returns
uint — The RGB value.
parseArrows()method 
public static function parseArrows(arrowsElement:XML, edgeStyle:AbstractEdgeStyle):void

Parses an XML element which represents an edge's arrows and setting the edge style accordingly.

Parameters

arrowsElement:XML — The element to parse.
 
edgeStyle:AbstractEdgeStyle — The style to set the arrows for.

parseBool()method 
public static function parseBool(boolStr:String):Boolean

Converts a String into a Boolean value.

"true" or "1" yield true, all other Strings will yield false

.

Parameters

boolStr:String — The String to parse.

Returns
Boolean — The boolean value represented by the given String.
parseFillColor()method 
public static function parseFillColor(colorStr:String):IFill

Creates a IFill instance with the color coded by the given String.

Parameters

colorStr:String — A String coding a color.

Returns
IFill — A SolidColor instance with the coded color.
parseLineType()method 
public static function parseLineType(element:XML):LineType

Parses a given XML element to create a line type.

Parameters

element:XML — The element to parse.

Returns
LineType — The LineType instance created according to the given element.
parseLocation()method 
public static function parseLocation(element:XML):IPoint

Creates an IPoint instance which holds the coordinates parsed from the given XML element.

Parameters

element:XML — The element to parse.

Returns
IPoint — A point with its coordinates set according to the given element.
parseNamedOrARGBColor()method 
public static function parseNamedOrARGBColor(colorStr:String):ColorStruct

Parses a String for a hex or named representation of a color and creates a corresponding ColorStruct.

Parameters

colorStr:String — The String to parse.

Returns
ColorStruct — The ColorStruct which is represented by the String.
parseNodeLayout()method 
public static function parseNodeLayout(nodeElement:XML, layout:IMutableRectangle):void

Parses the given XML element which represents a node layout and sets the coordinates of the given layout rectangle accordingly.

Parameters

nodeElement:XML — The element to parse.
 
layout:IMutableRectangle — The layout to set.

parsePath()method 
public static function parsePath(pathElement:XML, edge:IEdge, graph:IGraph):void

Parses the given XML element which represents an edge path and sets the given edges path accordingly. This includes creation of new bends if necessary.

Parameters

pathElement:XML — The XML element to parse.
 
edge:IEdge — The edge to set the path for.
 
graph:IGraph — The graph the edge belongs to.

parseRGBAColor()method 
public static function parseRGBAColor(colorStr:String):ColorStruct

Parses a String which encodes a RGBA color ("#RRGGBBAA") and returns a ColorStruct.

Parameters

colorStr:String — The String which encodes the color.

Returns
ColorStruct — A ColorStruct.
parseStroke()method 
public static function parseStroke(colorStr:String, widthStr:String = 0, argb:Boolean = false):IStroke

Creates a (simple) IStroke instance from a given String.

Parameters

colorStr:String — A String which represents the color.
 
widthStr:String (default = 0) — A String which represents the width.
 
argb:Boolean (default = false)true if an alpha value is to be set (not used yet).

Returns
IStroke — A Stroke created from the parameters.
writeEdgelabel()method 
public static function writeEdgelabel(writer:IXmlWriter, edge:IEdge, label:ILabel):void

Writes an XML element representing a given edge label.

Parameters

writer:IXmlWriter — The writer to write to.
 
edge:IEdge — The edge which owns the label.
 
label:ILabel — The label to write the element for.

writeLineType()method 
public static function writeLineType(writer:IXmlWriter, tag:String, lineType:LineType):void

Writes an XML element which codes the given line type.

Parameters

writer:IXmlWriter — The writer to write to.
 
tag:String — The name for the element to be created.
 
lineType:LineType — The line type to write.

writeLocation()method 
public static function writeLocation(writer:IXmlWriter, name:String, location:IPoint):void

Writes the given location's coordinates to the given writer as element with the given name.

Parameters

writer:IXmlWriter — The writer to write to.
 
name:String — The element's name.
 
location:IPoint — The location to write.

writeNodeLabel()method 
public static function writeNodeLabel(writer:IXmlWriter, node:INode, label:ILabel):void

Writes an XML element representing a given node label.

Parameters

writer:IXmlWriter — The writer to write to.
 
node:INode — The node which owns the label.
 
label:ILabel — The label to write.

writeNodeLayout()method 
public static function writeNodeLayout(writer:IXmlWriter, node:INode):void

Writes the given node's layout to the given writer.

Parameters

writer:IXmlWriter — The writer to write to.
 
node:INode — The node whose layout is to be written.

writePath()method 
public static function writePath(edge:IEdge, writer:IXmlWriter):void

Writes the path of the given edge.

Parameters

edge:IEdge — The edge whose path is to be written.
 
writer:IXmlWriter — The writer to write to.

writeRGBAColor()method 
public static function writeRGBAColor(writer:IXmlWriter, tag:String, color:uint, alpha:Number = 1.0):void

Writes an XML element representing the given ARGB color.

Parameters

writer:IXmlWriter — The writer to write to.
 
tag:String — The name of the tag which is to be created.
 
color:uint — The RGB value to write.
 
alpha:Number (default = 1.0) — The alpha value to write.

Constant Detail
FOLDER_PORT_MAPConstant
public static const FOLDER_PORT_MAP:String = com.yworks.io.graphml.realizer.GraphicsSerializationToolkit.FOLDER_PORT_MAP