| Package | com.yworks.remote |
| Class | public class RoundtripHandler |
| Inheritance | RoundtripHandler flash.events.EventDispatcher |
| Implements | ResultHandler |
Usually, if the server doesn't keep any state, this result handler will be used for sending the graph currently displayed on the client to the server. The server can then somehow modify the structure, layout or style of the graph and send the changed state back to the client.
Whether this handler conducts communication in both directions or whether the graph
state is just sent or received can be configured using the send and
update flags.
The GraphML (de)serialization of the current graph instance can be controlled using the various methods that configure the GraphMLIOHandlers used for parsing and writing GraphML data.
| Property | Defined by | ||
|---|---|---|---|
| additionalParameters : Object
Get or set an Object containing additional parameters
that should be send to the server.
| RoundtripHandler | ||
| animate : Boolean
Get or set whether the optional update of the current
graph instance should be animated.
| RoundtripHandler | ||
| clearLocalGraph : Boolean
Get or set whether the graph in the canvas should be cleared before
the update.
| RoundtripHandler | ||
| compress : Boolean
Whether to use compression for the graphml data
that is sent to the server.
| RoundtripHandler | ||
| fitContentOnUpdate : Boolean
Gets or sets whether the canvas should fit the contents after the update if
animation is disabled.
| RoundtripHandler | ||
| inputIOHandler : GraphMLIOHandler
Get or set the GraphMLIOhandler instance that will be used
for GraphML input if
update is set. | RoundtripHandler | ||
| outputIOHandler : GraphMLIOHandler
Get or set the GraphMLIOHandler instance that will be used for
GraphML output if
send is set. | RoundtripHandler | ||
| send : Boolean
Gets or sets whether the graph currently displayed in the graph canvas
should be sent to the server.
| RoundtripHandler | ||
| sendOptions : uint
Gets or sets the options to use for sending the graph to the server.
| RoundtripHandler | ||
| update : Boolean
Gets or sets whether the graph instance currently displayed in the graph canvas should
be updated using the GraphML data sent by the server.
| RoundtripHandler | ||
| updateOptions : uint
Get or set the options to use for the graph update.
| RoundtripHandler | ||
| uriEncode : Boolean
Whether to encode the graphML string sent to
the server using the global
encodeURIComponent function. | RoundtripHandler | ||
| useJavaStyles : Boolean | RoundtripHandler | ||
| Property | Defined by | ||
|---|---|---|---|
| graphCanvas : GraphCanvasComponent
[read-only]
| RoundtripHandler | ||
| Method | Defined by | ||
|---|---|---|---|
|
RoundtripHandler(graphCanvas:GraphCanvasComponent, serviceName:String = "roundtrip", options:uint = 255)
Creates a new instance of the round trip handler for the given component.
| RoundtripHandler | ||
|
addDeserializer(deserializer:IDeserializer):void
Adds another IDeserializer instance to a list that will be registered with the created the inputIOHandler.
| RoundtripHandler | ||
|
addMapperAttribute(tag:Object, name:String = null, scope:String, contentType:String):void
Add a graph item attribute that should be considered for input and output.
| RoundtripHandler | ||
|
Create a graph instance that can hold the data that is parsed in by this instance.
| RoundtripHandler | ||
|
handleError(fault:Fault):void
Callback that is invoked when the service request failed.
| RoundtripHandler | ||
|
handleResult(result:XML):void
Callback that is invoked when the server transfered the expected response.
| RoundtripHandler | ||
|
run(params:Object = null):void
Triggers a server round-trip.
| RoundtripHandler | ||
| Method | Defined by | ||
|---|---|---|---|
|
createAction(serviceName:String):ServerAction
Creates the
ServerAction to use for sending the request to the server. | RoundtripHandler | ||
|
Create and configure the
GraphMLIOHandler instance that is used for reading the graph back in. | RoundtripHandler | ||
|
Create and configure the
GraphMLIOHandler instance that is used for writing the graph structure. | RoundtripHandler | ||
|
createParameters():Object
Create the parameters object that is transferred to the server.
| RoundtripHandler | ||
|
dispatchXMLResult(result:XML):void
Dispatches a
XMLResultEvent containing the received XML data. | RoundtripHandler | ||
|
Actually applies the new graph to the current graph in the GraphCanvas.
| RoundtripHandler | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
Dispatched when the run method was called and a valid result is received. | RoundtripHandler | |||
| additionalParameters | property |
additionalParameters:Object [read-write]Get or set an Object containing additional parameters that should be send to the server.
Implementation public function get additionalParameters():Object
public function set additionalParameters(value:Object):void
| animate | property |
animate:Boolean [read-write]Get or set whether the optional update of the current graph instance should be animated.
Implementation public function get animate():Boolean
public function set animate(value:Boolean):void
| clearLocalGraph | property |
clearLocalGraph:Boolean [read-write]Get or set whether the graph in the canvas should be cleared before the update. This is useful if the graph being loaded is a completely new graph and the ids might match ids of older entities.
The default value is <code>false</code>.
public function get clearLocalGraph():Boolean
public function set clearLocalGraph(value:Boolean):void
| compress | property |
compress:Boolean [read-write]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.
public function get compress():Boolean
public function set compress(value:Boolean):void
See also
| fitContentOnUpdate | property |
fitContentOnUpdate:Boolean [read-write]Gets or sets whether the canvas should fit the contents after the update if animation is disabled.
The default value is true.
public function get fitContentOnUpdate():Boolean
public function set fitContentOnUpdate(value:Boolean):void
| graphCanvas | property |
graphCanvas:GraphCanvasComponent [read-only]Implementation
protected function get graphCanvas():GraphCanvasComponent
| inputIOHandler | property |
inputIOHandler:GraphMLIOHandler [read-write]
Get or set the GraphMLIOhandler instance that will be used
for GraphML input if update is set.
public function get inputIOHandler():GraphMLIOHandler
public function set inputIOHandler(value:GraphMLIOHandler):void
| outputIOHandler | property |
outputIOHandler:GraphMLIOHandler [read-write]
Get or set the GraphMLIOHandler instance that will be used for
GraphML output if send is set.
public function get outputIOHandler():GraphMLIOHandler
public function set outputIOHandler(value:GraphMLIOHandler):void
| send | property |
send:Boolean [read-write]Gets or sets whether the graph currently displayed in the graph canvas should be sent to the server.
The default value is true.
public function get send():Boolean
public function set send(value:Boolean):void
| sendOptions | property |
sendOptions:uint [read-write]Gets or sets the options to use for sending the graph to the server.
The options are specified using a combination of
the various OPTION_COPY constants defined in
GraphCanvasComponent.
public function get sendOptions():uint
public function set sendOptions(value:uint):void
| update | property |
update:Boolean [read-write]Gets or sets whether the graph instance currently displayed in the graph canvas should be updated using the GraphML data sent by the server.
The default value is true.
public function get update():Boolean
public function set update(value:Boolean):void
| updateOptions | property |
updateOptions:uint [read-write]Get or set the options to use for the graph update.
The options are specified using a combination of
the various OPTION_COPY constants defined in
GraphCanvasComponent.
public function get updateOptions():uint
public function set updateOptions(value:uint):void
| uriEncode | property |
uriEncode:Boolean [read-write]
Whether to encode the graphML string sent to
the server using the global encodeURIComponent function.
The default value is false.
public function get uriEncode():Boolean
public function set uriEncode(value:Boolean):void
See also
| useJavaStyles | property |
useJavaStyles:Boolean [read-write]Implementation
public function get useJavaStyles():Boolean
public function set useJavaStyles(value:Boolean):void
| RoundtripHandler | () | constructor |
public function RoundtripHandler(graphCanvas:GraphCanvasComponent, serviceName:String = "roundtrip", options:uint = 255)Creates a new instance of the round trip handler for the given component.
ParametersgraphCanvas:GraphCanvasComponent — The component to use for the roundtripping.
|
|
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.
|
|
options:uint (default = 255) — An options object to use for sendOptions and updateOptions
|
| addDeserializer | () | method |
public function addDeserializer(deserializer:IDeserializer):voidAdds another IDeserializer instance to a list that will be registered with the created the inputIOHandler.
Parametersdeserializer:IDeserializer |
| addMapperAttribute | () | method |
public function addMapperAttribute(tag:Object, name:String = null, scope:String, contentType:String):voidAdd a graph item attribute that should be considered for input and output.
Parameterstag: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 — The scope type of the attribute. One of
|
|
contentType:String — The attribute content type. One of
|
| createAction | () | method |
protected function createAction(serviceName:String):ServerAction
Creates the ServerAction to use for sending the request to the server.
The action will use the handleResult method for the callback.
serviceName:String — service name for the ServerAction
|
ServerAction —
A readily configured ServerAction that uses the service name that was passed to the constructor.
|
| createGraph | () | method |
public function createGraph():IGraphCreate a graph instance that can hold the data that is parsed in by this instance.
During a roundtrip, the graph instance is temporarily populated using the parsed GraphML data. The graph instance that is currently visualized in the graph canvas will be updated by comparing both graph instances.
ReturnsIGraph —
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.
ReturnsGraphMLIOHandler —
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.
GraphMLIOHandler —
the configured GraphMLIOHandler instance
|
| createParameters | () | method |
protected function createParameters():ObjectCreate the parameters object that is transferred to the server.
This implementation will include a serialization of the current graph instance contained in the graphCanvas,
if send is true. The GraphML string will be sent as a request parameter named "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 "base64/zlib" to
the "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 thge "graphEncoding" request parameter to "encodeURIComponent".
Object |
See also
| dispatchXMLResult | () | method |
protected function dispatchXMLResult(result:XML):void
Dispatches a XMLResultEvent containing the received XML data.
result:XML |
See also
| doUpdate | () | method |
protected function doUpdate(newGraph:IGraph):voidActually applies the new graph to the current graph in the GraphCanvas. This method is called by handleResult.
ParametersnewGraph:IGraph — the graph to apply to the current GraphCanvas.
|
| handleError | () | method |
public function handleError(fault:Fault):voidCallback that is invoked when the service request failed.
Parametersfault:Fault — Fault that describes the failure.
|
| handleResult | () | method |
public function handleResult(result:XML):voidCallback that is invoked when the server transfered the expected response.
Parametersresult:XML — The xml content of the server response.
|
| run | () | method |
public function run(params:Object = null):voidTriggers a server round-trip.
If send is set, sends the current graph to the server.
The GraphML data that will be sent to the server can be configured using
sendOptions an
addMapperAttribute.
If the update flag is set, the server is expected to send
GraphML data that represents a new state of the currently displayed graph.
The new state will be submitted to the current graph using the morphGraph
method of GraphCanvasComponent.
Whether the graph update will be animated can be set using
the animate property.
This method will trigger an asynchronous call to the service url that was passed upon construction. The following hooks and events are available to be notified of the roundtrip progress:
handleResult method of this instance is called when a XML result
is received from the server.RoundtripHandler instance
When a XML result is received from the server. The event is of type XMLResultEvent
and is dispatched before doUpdate is called.
doUpdate method of this instance is called after the GraphML data received from the
server has been parsed.inputIOHandler after the
GraphML data received from the server has been parsed. The event is of type GraphEvent.GraphCanvasComponent
instance that was passed upon construction. The events are dispatched before and after the
graph structure is updated, respectively. The events are always dispatched, no matter whether the
graph structure update is animated or not.params:Object (default = null) — Additional parameters to be sent.
|
See also
| complete | event |
com.yworks.remote.XMLResultEvent
Dispatched when the run method was called and a valid result is received.
The event is dispatched before doUpdate is called.