Packagecom.yworks.io.graphml.realizer
Classpublic class SimpleLabelRealizerSerializer
InheritanceSimpleLabelRealizerSerializer Inheritance Object
Implements ILabelSerializer

Parses edge and node labels written by yFiles Java. Writing labels takes place in specific node/edge realizerserializers.



Public Properties
 PropertyDefined By
  instance : SimpleLabelRealizerSerializer
[static] [read-only] The shared instance of this serializer.
SimpleLabelRealizerSerializer
Public Methods
 MethodDefined By
  
canRead(element:XML, context:GraphMLParseContext):Boolean
Whether this instance can deserialize the given xml element in the given context.
SimpleLabelRealizerSerializer
  
canWrite(label:ILabel, context:GraphMLWriteContext):Boolean
Returns false.
SimpleLabelRealizerSerializer
  
Create a style instance that can represent the label layout information of the given xml element.
SimpleLabelRealizerSerializer
  
getElementName(item:Object):String
Returns the name of the element that will be written by this serializer given the provided item.
SimpleLabelRealizerSerializer
  
Returns the names of all XML elements that can be parsed or written by this serializer.
SimpleLabelRealizerSerializer
  
getNamespace():Namespace
Returns the namespace of the element this serilaizer writes.
SimpleLabelRealizerSerializer
  
Returns the style class that can be serialized or deserialized by this instance.
SimpleLabelRealizerSerializer
  
parse(label:ILabel, style:ILabelStyle, element:XML, context:GraphMLParseContext):void
Parses a serialized yFiles Java node realizer into the given style.
SimpleLabelRealizerSerializer
  
write(label:ILabel, writer:IXmlWriter, context:GraphMLWriteContext):void
does nothing.
SimpleLabelRealizerSerializer
  
Write the attributes of the label xml element
SimpleLabelRealizerSerializer
Protected Methods
 MethodDefined By
  
getTextContent(element:XML):String
Fetch the text content from the label element.
SimpleLabelRealizerSerializer
  
Parse a <y:EdgeLabel> element.
SimpleLabelRealizerSerializer
  
Parse a xml element for an EdgeLabelModel.
SimpleLabelRealizerSerializer
  
parseLabelBackground(context:GraphMLParseContext, label:ILabel, style:ILabelStyle, element:XML):void
Parse a xml element representing the label's background.
SimpleLabelRealizerSerializer
  
Parse a <y:NodeLabel> element.
SimpleLabelRealizerSerializer
  
parseTextFormat(labelElement:XML):UITextFormat
Parse the text format information in a GraphML label element into an UITextFormat object.
SimpleLabelRealizerSerializer
Property Detail
instanceproperty
instance:SimpleLabelRealizerSerializer  [read-only]

The shared instance of this serializer.


Implementation
    public static function get instance():SimpleLabelRealizerSerializer
Method Detail
canRead()method
public function canRead(element:XML, context:GraphMLParseContext):Boolean

Whether this instance can deserialize the given xml element in the given context.

Parameters

element:XML — The xml element
 
context:GraphMLParseContext — The parse context

Returns
Booleantrue if this instance can deserialize the style of the given xml element.
canWrite()method 
public function canWrite(label:ILabel, context:GraphMLWriteContext):Boolean

Returns false. Writing labels takes place in specific node/edge realizerserializers.

Parameters

label:ILabel
 
context:GraphMLWriteContext

Returns
Boolean
createStyleInstance()method 
public function createStyleInstance(element:XML, context:GraphMLParseContext):ILabelStyle

Create a style instance that can represent the label layout information of the given xml element.

Parameters

element:XML — The XML element.
 
context:GraphMLParseContext — The parse context.

Returns
ILabelStyle — An instance of ILabelStyle that represents the label layout information of the given xml element.
getElementName()method 
public function getElementName(item:Object):String

Returns the name of the element that will be written by this serializer given the provided item.

Parameters

item:Object

Returns
String — the name of the item
getElementNames()method 
public function getElementNames():Array

Returns the names of all XML elements that can be parsed or written by this serializer.

Returns
Array — The names of all xml elements this serializer can handle as Array.
getNamespace()method 
public function getNamespace():Namespace

Returns the namespace of the element this serilaizer writes.

Returns
Namespace — the namespace of the elements
getStyleClass()method 
public function getStyleClass():Class

Returns the style class that can be serialized or deserialized by this instance.

Returns
Class — The class that can be serialized by this instance.
getTextContent()method 
protected function getTextContent(element:XML):String

Fetch the text content from the label element.

Parameters

element:XML — The label element.

Returns
String — The label text.
parse()method 
public function parse(label:ILabel, style:ILabelStyle, element:XML, context:GraphMLParseContext):void

Parses a serialized yFiles Java node realizer into the given style.

Parameters

label:ILabel — A label instance whose style is to be configured.
 
style:ILabelStyle — A label style that is used to display the appearance of the yFiles Java label.
 
element:XML — the graphml node element
 
context:GraphMLParseContext — the current parsing context

parseEdgeLabel()method 
protected function parseEdgeLabel(context:GraphMLParseContext, label:ILabel, style:ILabelStyle, labelElement:XML):ILabelModelParameter

Parse a <y:EdgeLabel> element.

Parameters

context:GraphMLParseContext — The current parse context.
 
label:ILabel — The label item
 
style:ILabelStyle — The label style
 
labelElement:XML — The label element to be parsed.

Returns
ILabelModelParameter — An ILabelModelParameter instance for the given label.
parseEdgeLabelModel()method 
protected function parseEdgeLabelModel(context:GraphMLParseContext, label:ILabel, labelElement:XML):ILabelModelParameter

Parse a xml element for an EdgeLabelModel.

If the parse context has the property "mapJavaLabelModels" set to true the label models center_slider, side_slider, six_pos, three_center, two_pos and centered will be mapped to SliderEdgeLabelModel, all other label models will be mapped to FreeEdgeLabelModel. If the property is set to false or not set, all label models will be mapped to FreeEdgeLabelModel. The property will be set automatically by the JavaCompatGraphMLIOHandler, according to its mapJavaLabelModels property.

Parameters

context:GraphMLParseContext — The current parse context.
 
label:ILabel — The label item
 
labelElement:XML — The label element to be parsed.

Returns
ILabelModelParameter — An ILabelModelParameter instance for the given label.
parseLabelBackground()method 
protected function parseLabelBackground(context:GraphMLParseContext, label:ILabel, style:ILabelStyle, element:XML):void

Parse a xml element representing the label's background.

Parameters

context:GraphMLParseContext — The current parse context.
 
label:ILabel — The label item
 
style:ILabelStyle — The label style to write the background to
 
element:XML — The element to be parsed.

parseNodeLabel()method 
protected function parseNodeLabel(context:GraphMLParseContext, label:ILabel, style:ILabelStyle, labelElement:XML):ILabelModelParameter

Parse a <y:NodeLabel> element.

Parameters

context:GraphMLParseContext — The current parse context.
 
label:ILabel — The label item
 
style:ILabelStyle — The label style
 
labelElement:XML — The label element to be parsed.

Returns
ILabelModelParameter — An ILabelModelParameter instance for the given label.
parseTextFormat()method 
protected function parseTextFormat(labelElement:XML):UITextFormat

Parse the text format information in a GraphML label element into an UITextFormat object.

Parameters

labelElement:XML — A GraphML label element

Returns
UITextFormat — An UITextFormat object that was configured using the text format information in the label element.
write()method 
public function write(label:ILabel, writer:IXmlWriter, context:GraphMLWriteContext):void

does nothing. Writing labels takes place in specific node/edge realizerserializers.

Parameters

label:ILabel
 
writer:IXmlWriter
 
context:GraphMLWriteContext

writeAttributes()method 
public function writeAttributes(style:ILabelStyle, writer:IXmlWriter, context:GraphMLWriteContext):void

Write the attributes of the label xml element

Parameters

style:ILabelStyle — A label style that can be serialized to a format that can be read by yFiles Java.
 
writer:IXmlWriter — The xml writer.
 
context:GraphMLWriteContext — The current write context.