Packagecom.yworks.io.graphml.realizer
Classpublic class JavaGenericNodeRealizerSerializer
InheritanceJavaGenericNodeRealizerSerializer Inheritance AbstractJavaNodeRealizerSerializer Inheritance Object

A serializer/deserializer which can handle GenericNodeRealizers (yFiles Java) / JavaGenericNodeStyles (yFiles Flex).

As GenericNodeRealizers are serialized only with their configuration name, this deserializer searches for the configuration names in its configuration map for appropriate styles. Thus, when initializing this serializer/deserializer, appropriate styles have to be mapped to their corresponding styles.

The configuration property will be set automatically to the serialized configuration name for styles which are deserialized from GraphML.

Styles which are created on the client must have their configuration property set to a valid configuration name in order to get serialized properly. If that configuration is not in the serializer's configuration map, it will be stored there automatically if such a style is serialized.

See also

addConfiguration


Public Properties
 PropertyDefined By
  fallback : INodeStyle
A style which is used when the configuration is not in the map.
JavaGenericNodeRealizerSerializer
  instance : JavaGenericNodeRealizerSerializer
[static] [read-only] The singleton instance of this serializer/deserializer.
JavaGenericNodeRealizerSerializer
Public Methods
 MethodDefined By
  
addConfiguration(name:String, style:INodeStyle):void
Adds a new configuration to the configuration map.
JavaGenericNodeRealizerSerializer
  
canRead(node:XML, context:GraphMLParseContext):Boolean
[override] Returns true if the given element can be handled by this serializer.
JavaGenericNodeRealizerSerializer
  
canWrite(node:INode, context:GraphMLWriteContext):Boolean
[override] Whether this serializer can handle the style of the given node.
JavaGenericNodeRealizerSerializer
  
[override] Creates a new instance of the style which is represented by the given element.
JavaGenericNodeRealizerSerializer
  
getElementName(item:Object):String
[override] Returns the name of the element that will be written by this serializer given the provided item.
JavaGenericNodeRealizerSerializer
  
[override] Returns the names of all XML elements that can be parsed or written by this serializer.
JavaGenericNodeRealizerSerializer
 Inherited
getNamespace():Namespace
Returns the namespace of the element this serilaizer writes.
AbstractJavaNodeRealizerSerializer
 Inherited
Returns the style class that can be serialized or deserialized by this instance.
AbstractJavaNodeRealizerSerializer
 Inherited
parse(style:INodeStyle, layout:IMutableRectangle, element:XML, context:GraphMLParseContext):void
Parses a serialized yFiles Java node realizer into the given style.
AbstractJavaNodeRealizerSerializer
  
removeConfiguration(name:String):void
Removes the configuration with the given name from the configuration map.
JavaGenericNodeRealizerSerializer
  
write(node:INode, writer:IXmlWriter, context:GraphMLWriteContext):void
[override] Writes the given node's style.
JavaGenericNodeRealizerSerializer
 Inherited
Write the attributes of the realizer xml element
AbstractJavaNodeRealizerSerializer
Protected Methods
 MethodDefined By
 Inherited
Writes the fill style into the XML writer.
AbstractJavaNodeRealizerSerializer
Property Detail
fallbackproperty
fallback:INodeStyle

A style which is used when the configuration is not in the map. May be null if no fallback should be used. If the style does not extend JavaGenericNodeStyle it will be wrapped in a JavaGenericNodeStyleWrapper.

The default value is null.


Implementation
    public function get fallback():INodeStyle
    public function set fallback(value:INodeStyle):void
instanceproperty 
instance:JavaGenericNodeRealizerSerializer  [read-only]

The singleton instance of this serializer/deserializer.


Implementation
    public static function get instance():JavaGenericNodeRealizerSerializer
Method Detail
addConfiguration()method
public function addConfiguration(name:String, style:INodeStyle):void

Adds a new configuration to the configuration map.

Parameters

name:String — The name of the configuration as it is serialized with. If the name already exists in the map, the existing configuration will be replaced.
 
style:INodeStyle — The style which is used for realizers with the given configuration name. If the style does not extend JavaGenericNodeStyle it will be wrapped in a JavaGenericNodeStyleWrapper.

canRead()method 
override public function canRead(node:XML, context:GraphMLParseContext):Boolean

Returns true if the given element can be handled by this serializer.

This is the case if the element name is "GenericNode", and the configuration is mapped in the configuration map or the fallback is not null.

Parameters

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

Returns
Booleantrue if the given element can be parsed.
canWrite()method 
override public function canWrite(node:INode, context:GraphMLWriteContext):Boolean

Whether this serializer can handle the style of the given node.

This is the case if the given node's style is of type JavaGenericNodeStyle

Parameters

node:INode — The node whose style is to be serialized.
 
context:GraphMLWriteContext — The write context.

Returns
Booleantrue if the given node's style can be serialized.
createStyleInstance()method 
override public function createStyleInstance(element:XML, context:GraphMLParseContext):INodeStyle

Creates a new instance of the style which is represented by the given element.

Parameters

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

Returns
INodeStyle — A new instance of the style or the fallback style.
getElementName()method 
override 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 
override 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.
removeConfiguration()method 
public function removeConfiguration(name:String):void

Removes the configuration with the given name from the configuration map.

Parameters

name:String — The name of the configuration to remove.

write()method 
override public function write(node:INode, writer:IXmlWriter, context:GraphMLWriteContext):void

Writes the given node's style.

Parameters

node:INode — The node whose style should be written.
 
writer:IXmlWriter — The XML writer to write to.
 
context:GraphMLWriteContext — The write context.