Packagecom.yworks.remote
Classpublic class AbstractRoundtripHandler
InheritanceAbstractRoundtripHandler Inheritance flash.events.EventDispatcher
Implements mx.core.IMXMLObject
Subclasses RoundtripHandler

Abstract base class for the RoundtripHandler

This base class provides methods for the configuration of the GraphMLIOHandlers for input and output. Furthermore, its method createParametersFromGraph() creates an object which serves as parameter set for a HttpService and contains a serialized graph and deserialization info for a GraphRoundtripSupport at the server side.

See also

RoundtripHandler
createParametersFromGraph()


Public Properties
 PropertyDefined By
  additionalParameters : Object
Get or set an Object containing additional request parameters that should be send to the server.
AbstractRoundtripHandler
  adjustFontSize : Boolean
Whether to adjust the font size when serializing / deserializing fonts.
AbstractRoundtripHandler
  autoReadMapperData : Boolean
Whether mapper data contained in the GraphML data should be automatically deserialized and registered with the graph's mapper registry.
AbstractRoundtripHandler
  autoWriteMapperData : Boolean
Whether mapper data registered with the graph's mapper registry should be automatically serialized.
AbstractRoundtripHandler
  compress : Boolean
Whether to use compression for the graphml data that is sent to the server.
AbstractRoundtripHandler
  localViewMode : Boolean
Whether to read/write only the local view for folded graphs.
AbstractRoundtripHandler
  mapperAttributes : Array
An array of MapperAttribute instances.
AbstractRoundtripHandler
  readPortLayout : Boolean
Whether to update the port location on reading using the port layout data.
AbstractRoundtripHandler
  sendLocalRoot : Boolean
If the graph that is send is a IFoldedGraph, this property determines whether the id of the node that is set as the folded graph's localRoot is sent as a request parameter to the server.
AbstractRoundtripHandler
  serviceName : String
The service name to use for roundtripping.
AbstractRoundtripHandler
  uriEncode : Boolean
Whether to encode the graphML string sent to the server using the global encodeURIComponent function.
AbstractRoundtripHandler
  useJavaStyles : Boolean
Whether to use style implementations that were created for compatibility with the yFiles Java realizers.
AbstractRoundtripHandler
Protected Properties
 PropertyDefined By
  _sendOptions : uint = 0xFFFFFFFF
The options to use for configuration of the output IO handler.
AbstractRoundtripHandler
  _updateOptions : uint = 0xFFFFFFFF
The options to use for configuration of the input IO handler.
AbstractRoundtripHandler
Public Methods
 MethodDefined By
  
AbstractRoundtripHandler(serviceName:String = roundtrip)
Creates a new instance of the round trip handler.
AbstractRoundtripHandler
  
addDeserializer(deserializer:IDeserializer):void
Adds another IDeserializer instance to a list that will be registered with the created the inputIOHandler.
AbstractRoundtripHandler
  
addMapperAttribute(tag:Object, name:String = null, scope:String, contentType:String):void
Add a graph item attribute that should be considered for input and output.
AbstractRoundtripHandler
  
addObjectMapperAttribute(tag:Object, scope:String, serializer:ISerializer, deserializer:IDeserializer):void
Add a graph item attribute of complex type that will be read and written using the provided serializer and deserializer instances.
AbstractRoundtripHandler
  
addSerializer(serializer:ISerializer):void
Adds another ISerializer instance to a list that will be registered with the created the outputIOHandler.
AbstractRoundtripHandler
  
initialized(document:Object, id:String):void
Called automatically by the MXML compiler when the instance is created using an MXML tag.
AbstractRoundtripHandler
Protected Methods
 MethodDefined By
  
Convenience method to create a graph which is configured (default styles, mappers) like the given graph and additionally has the mappers which are registered at this handler.
AbstractRoundtripHandler
  
Create and configure the GraphMLIOHandler instance that is used for reading the graph back in.
AbstractRoundtripHandler
  
Create and configure the GraphMLIOHandler instance that is used for writing the graph structure.
AbstractRoundtripHandler
  
createParametersFromGraph(graph:IGraph, outputIOHandler:GraphMLIOHandler):Object
Convenience method to create the parameters object for a graph that is transferred to the server.
AbstractRoundtripHandler
  
onXmlGenerated(xml:XML):void
Called after the graph has been serialized in the method createParametersFromGraph().
AbstractRoundtripHandler
Public Constants
 ConstantDefined By
  PARAM_ENCODING : String = graphEncoding
[static] The name of the request parameter which determines the graph encoding.
AbstractRoundtripHandler
  PARAM_GRAPH : String = graph
[static] The name of the request parameter which holds the GraphML string.
AbstractRoundtripHandler
  VALUE_COMPRESS : String = base64/zlib
[static] Indicates that the GraphML string which is sent to the server is compressed.
AbstractRoundtripHandler
  VALUE_URI_ENCODE : String = encodeURIComponent
[static] Indicates that the GraphML string which is sent to the server is URL encoded.
AbstractRoundtripHandler
Property Detail
_sendOptionsproperty
protected var _sendOptions:uint = 0xFFFFFFFF

The options to use for configuration of the output IO handler.

The options are specified using a combination of the various OPTION_COPY constants defined in GraphCanvasComponent.

_updateOptionsproperty 
protected var _updateOptions:uint = 0xFFFFFFFF

The options to use for configuration of the input IO handler.

The options are specified using a combination of the various OPTION_COPY constants defined in GraphCanvasComponent.

additionalParametersproperty 
additionalParameters:Object

Get or set an Object containing additional request parameters that should be send to the server.

Important: The following parameter names are reserved for internal use:

This property can be used as the source for data binding.


Implementation
    public function get additionalParameters():Object
    public function set additionalParameters(value:Object):void
adjustFontSizeproperty 
adjustFontSize:Boolean

Whether to adjust the font size when serializing / deserializing fonts.

On reading the Font size will be multiplied by the factor specified by fontSizeFactor. On writing, the font will be divided by that factor. This is necessary when deserializing a font from a .NET server, because .NET interprets the font size as points (1/72 inch) whereas Flex interprets the size as pixel (1/96 inch).

The default factor which is applied if this property is set to true is 0.75 which is appropritate to convert between point (server) and pixel (client). If a different factor is needed, it has to be set on the inputIOHandler and outputIOHandler's fontSizeFactor properties.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get adjustFontSize():Boolean
    public function set adjustFontSize(value:Boolean):void

See also

autoReadMapperDataproperty 
autoReadMapperData:Boolean

Whether mapper data contained in the GraphML data should be automatically deserialized and registered with the graph's mapper registry.

For complex data, this will only work if a IDeserializer is registed that can handle the complex data type.

Note that this property has to be set before createInputIOHandler() is called.

The default value is true.


Implementation
    public function get autoReadMapperData():Boolean
    public function set autoReadMapperData(value:Boolean):void

See also

autoWriteMapperDataproperty 
autoWriteMapperData:Boolean

Whether mapper data registered with the graph's mapper registry should be automatically serialized.

For complex data, this will only work if a ISerializer is registed that can handle the complex data type.

Note that this property has to be set before createOutputIOHandler() is called.

The default value is true.


Implementation
    public function get autoWriteMapperData():Boolean
    public function set autoWriteMapperData(value:Boolean):void

See also

compressproperty 
compress:Boolean

Whether to use compression for the graphml data that is sent to the server.

If true, the value of the "graph" parameter will be compressed using zlib compression and encoded using base64 encoding.

The default value is true.

This property can be used as the source for data binding.


Implementation
    public function get compress():Boolean
    public function set compress(value:Boolean):void

See also

localViewModeproperty 
localViewMode:Boolean

Whether to read/write only the local view for folded graphs.

If an IFoldedGraph is found in the graph's lookup, the folded graph's master graph will be written instead, including all view states. This behavior can be prevented by enabling localViewMode. In local view mode, only a single view is read/written to/from the graph.

Note that this property has to be set before createOutputIOHandler() or createInputIOHandler() is called

The default value is false.


Implementation
    public function get localViewMode():Boolean
    public function set localViewMode(value:Boolean):void

See also

mapperAttributesproperty 
mapperAttributes:Array

An array of MapperAttribute instances.

The mapper attributes defined in this array are set to the inputIOHandler and outputIOHandler upon first access of these handlers. Subsequent changes will not be detected. Use addMapperAttribute() for more flexible handling.

This property can be used to define mapper attributes in

		 <yworks:RoundtripHandler>
		   <yworks:mapperAttributes>
		     <yworks:MapperAttribute tag="MyTag" name="MyName" scope="node" type="string" />
		     <yworks:MapperAttribute tag="AnotherTag" name="AnotherName" scope="edge" type="int" />
		   </yworks:mapperAttributes>
		 </yworks:RoundtripHandler>
		 


Implementation
    public function get mapperAttributes():Array
    public function set mapperAttributes(value:Array):void
readPortLayoutproperty 
readPortLayout:Boolean

Whether to update the port location on reading using the port layout data.

If true and the port's owner is of type INode, the port layout data is interpreted relative to the node's center location and a new IPortLocationModelParameter is created and assigned using this location and the port's IPort.locationModelParameter's model.

Note that if the updateOptions include GraphCanvasComponent.OPTION_COPY_PORT_MODEL, the new port location is only determined by the read port location model parameter. In this case the port layout data is ignored.

The default value is true.


Implementation
    public function get readPortLayout():Boolean
    public function set readPortLayout(value:Boolean):void
sendLocalRootproperty 
sendLocalRoot:Boolean

If the graph that is send is a IFoldedGraph, this property determines whether the id of the node that is set as the folded graph's localRoot is sent as a request parameter to the server.

If the localRoot is null, the parameter will not be sent. If a non-null local root is set, the id can be obtained from the localRoot request parameter.

The default value is true.


Implementation
    public function get sendLocalRoot():Boolean
    public function set sendLocalRoot(value:Boolean):void
serviceNameproperty 
serviceName:String

The service name to use for roundtripping. The service name is used in createAction to create a server action for the given service name.

This property can be used as the source for data binding.


Implementation
    public function get serviceName():String
    public function set serviceName(value:String):void
uriEncodeproperty 
uriEncode:Boolean

Whether to encode the graphML string sent to the server using the global encodeURIComponent function.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get uriEncode():Boolean
    public function set uriEncode(value:Boolean):void

See also

useJavaStylesproperty 
useJavaStyles:Boolean

Whether to use style implementations that were created for compatibility with the yFiles Java realizers. If false, the serialized realizer information will be mapped to default yFiles FLEX styles where this is possible.

The default value is false.

This property can be used as the source for data binding.


Implementation
    public function get useJavaStyles():Boolean
    public function set useJavaStyles(value:Boolean):void
Constructor Detail
AbstractRoundtripHandler()Constructor
public function AbstractRoundtripHandler(serviceName:String = roundtrip)

Creates a new instance of the round trip handler.

Parameters
serviceName:String (default = roundtrip) — The service name to use for roundtripping. The service name is used in createAction to create a server action for the given service name.
Method Detail
addDeserializer()method
public function addDeserializer(deserializer:IDeserializer):void

Adds another IDeserializer instance to a list that will be registered with the created the inputIOHandler.

Parameters

deserializer:IDeserializer

addMapperAttribute()method 
public function addMapperAttribute(tag:Object, name:String = null, scope:String, contentType:String):void

Add a graph item attribute that should be considered for input and output.

This method will register a mapper for the given tag with the temporary graph instance that is used while parsing, and register a MapperRegistryAttributeInputHandler with the inputIOHandler and a MapperRegistryAttributeOutputHandler with the outputIOHandler.

To read/write complex mapper attributes that require custom (de)serialization, addObjectMapperAttribute() can be used.

Parameters

tag:Object — The attribute tag. the attribute mapper has to be registered in the graph's mapper registry with this tag.
 
name:String (default = null) — The name that should be used for the graphml attr.name attribute.
 
scope:String (default = NaN) — The scope type of the attribute. One of
  • GraphMLConstants.SCOPE_NODE
  • GraphMLConstants.SCOPE_EDGE
  • GraphMLConstants.SCOPE_PORT
  • GraphMLConstants.SCOPE_GRAPH
  • GraphMLConstants.SCOPE_GRAPHML
  • GraphMLConstants.SCOPE_ALL
 
contentType:String (default = NaN) — The attribute content type. One of
  • GraphMLConstants.TYPE_STRING
  • GraphMLConstants.TYPE_LONG
  • GraphMLConstants.TYPE_INT
  • GraphMLConstants.TYPE_FLOAT
  • GraphMLConstants.TYPE_DOUBLE
  • GraphMLConstants.TYPE_BOOLEAN

See also

addObjectMapperAttribute()method 
public function addObjectMapperAttribute(tag:Object, scope:String, serializer:ISerializer, deserializer:IDeserializer):void

Add a graph item attribute of complex type that will be read and written using the provided serializer and deserializer instances.

Parameters

tag:Object — The attribute tag. the attribute mapper has to be registered in the graph's mapper registry with this tag. A string representation of the tag will also be used as the attribute name for the GraphML attribute.
 
scope:String — The scope type of the attribute. One of
  • GraphMLConstants.SCOPE_NODE
  • GraphMLConstants.SCOPE_EDGE
  • GraphMLConstants.SCOPE_PORT
  • GraphMLConstants.SCOPE_GRAPH
  • GraphMLConstants.SCOPE_GRAPHML
  • GraphMLConstants.SCOPE_ALL
 
serializer:ISerializer — The serializer instance that will be used for writing the attribute objects.
 
deserializer:IDeserializer — The deserializer instance that will be used for reading the attribute objects.

See also

addSerializer()method 
public function addSerializer(serializer:ISerializer):void

Adds another ISerializer instance to a list that will be registered with the created the outputIOHandler.

Parameters

serializer:ISerializer

createGraphFromTemplate()method 
protected function createGraphFromTemplate(originalGraph:IGraph):IGraph

Convenience method to create a graph which is configured (default styles, mappers) like the given graph and additionally has the mappers which are registered at this handler.

The subclass RoundtripHandler uses this method to create a temporary copy of the graph in its graphCanvas property and parses the result into that temporary copy.

Parameters

originalGraph:IGraph — A template to configure the newly created IGraph.

Returns
IGraph — The created and configured graph instance

See also

createInputIOHandler()method 
protected function createInputIOHandler():GraphMLIOHandler

Create and configure the GraphMLIOHandler instance that is used for reading the graph back in.

The default input I/O handler will be able to read both the native yFiles FLEX GraphML format and yFiles Java GraphML data.

Returns
GraphMLIOHandler — the configured GraphMLIOHandler instance
createOutputIOHandler()method 
protected function createOutputIOHandler():GraphMLIOHandler

Create and configure the GraphMLIOHandler instance that is used for writing the graph structure.

The default output I/O handler will use the yFiles FLEX native GraphML format for serialization of graph item visualizations. To write the style information in a yFiles Java compatible format, use a com.yworks.io.graphml.JavaCompatGraphMLIOHandler instead.

Returns
GraphMLIOHandler — the configured GraphMLIOHandler instance
createParametersFromGraph()method 
protected function createParametersFromGraph(graph:IGraph, outputIOHandler:GraphMLIOHandler):Object

Convenience method to create the parameters object for a graph that is transferred to the server.

This implementation will include a serialization of the given graph instance if send is true. The GraphML string will be sent as a request parameter named PARAM_GRAPH ("graph").

If compress is true, the GraphML serialization of the graph will be compressed and base64-encoded. This is indicated to the server by prepending VALUE_COMPRESS ("base64/zlib") to the PARAM_ENCODING ("graphEncoding") request parameter. If uriEncode is true, the GraphML string will be encoded using the global encodeURIComponent function. This is indicated to the server by setting the PARAM_ENCODING ("graphEncoding") request parameter to VALUE_URI_ENCODE ("encodeURIComponent").

Parameters

graph:IGraph — The graph to serialize and add to the parameters.
 
outputIOHandler:GraphMLIOHandler — The GraphMLIOHandler instance for serializing the graph.

Returns
Object

See also

initialized()method 
public function initialized(document:Object, id:String):void

Called automatically by the MXML compiler when the instance is created using an MXML tag.

This implementation does nothing.

Parameters

document:Object — The MXML document containing this instance.
 
id:String — The id of this instance.

onXmlGenerated()method 
protected function onXmlGenerated(xml:XML):void

Called after the graph has been serialized in the method createParametersFromGraph(). Can be used for debugging purposes.

Parameters

xml:XML — The serialized graph as GraphML.

Constant Detail
PARAM_ENCODINGConstant
public static const PARAM_ENCODING:String = graphEncoding

The name of the request parameter which determines the graph encoding.

PARAM_GRAPHConstant 
public static const PARAM_GRAPH:String = graph

The name of the request parameter which holds the GraphML string.

VALUE_COMPRESSConstant 
public static const VALUE_COMPRESS:String = base64/zlib

Indicates that the GraphML string which is sent to the server is compressed.

This value is sent as value of the PARAM_ENCODING parameter.

VALUE_URI_ENCODEConstant 
public static const VALUE_URI_ENCODE:String = encodeURIComponent

Indicates that the GraphML string which is sent to the server is URL encoded.

This value is sent as value of the PARAM_ENCODING parameter.