ibm_ilog.diagram.graphlayout
Property Summary
Method Summary
- Animation(graph, recursive) An internal class that handles graph layout animation.
- GraphAdapter(graph, layout) The implementation of the graph model interface to layout the contents of a Graph.
- LayoutRunner() This class provides the graph layout API for a Graph object.
- ServerSideLayout(graph, url) This class executes a layout algorithm on a server. operation: A ServerSideLayout object is constructed with the Graph object and the URL where the layout service is located. To execute a layout, the user must select the algorithm with the standard client-side GraphLayout API: graph.setNodeLayout(x); graph.setLinkLayout(y); After this, the ServerSideLayout object can be used to execute these algorithms on the server by calling: serverSideLayout.layout(); This will obtain the currently configured layouts on the graph object, including optional settings for laying out internal subgraphs, gather their configured parameters and requesting the equivalent layout on the server. Each time a layout is requested, the graph and the layout settings are serialized into a JSON object sent in the request. The layout() method returns a dojo.Deferred which is signaled after the execution is complete.
- WebWorkerLayout() Executes a graph layout asynchronously in a Web Worker.
- extendLayout(layout)
Attached Objects
Properties
Methods
Parameter | Type | Description |
---|---|---|
graph | ||
recursive |
Parameter | Type | Description |
---|---|---|
graph | ||
layout |
Parameter | Type | Description |
---|---|---|
graph | Graph | The graph to be laid out. |
url | string | String The URL where the server is located. |
The WebWorkerLayout class is similar to the ServerSideLayout class, but instead of sending a request to a REST service on a remote server, it executes the graph layout on the client asynchronously using an HTML 5 Web Worker. This class can be used only if the browser supports web workers (which is not the case of Internet Explorer, for example).
The main advantage of executing a graph layout in a Web Worker is that the browser UI is not blocked while the layout is executed. On the other hand, executing the layout in a worker thread has a cost, mainly due to the initialization of the worker which must load its own version of Dojo and the graph layout code before the layout can be executed. In addition, the graph topology is sent to the web worker and returned back to the calling thread by serializing the whole graph as a JSON string, which takes some additional time for big graphs.
A WebWorkerLayout object is constructed with a Graph object. To execute a layout, the user must select the algorithm with the standard client-side GraphLayout API:
graph.setNodeLayout(x); graph.setLinkLayout(y);
After this, the WebWorkerLayout object can be used to execute these algorithms in a web worker by calling:
webWorkerLayout.layout();
This will obtain the currently configured layouts on the graph object, including optional settings for laying out internal subgraphs, gather their configured parameters and requesting the equivalent layout in the web worker.
Each time a layout is requested, the graph and the layout settings are serialized into a JSON object sent in the request.
The layout() method returns a dojo.Deferred which is signaled after the execution is complete.
The web worker is reused if possible when the same WebWorkerLayout object is called several times on the same graph. The first layout execution will take more time due to the fact that the worker must load Dojo and the graph layout code. Subsequent layout executions will be faster.
The WebWorkerLayout class cannot be used if Dojo is loaded from a CDN, so you must have a local copy of Dojo on your web site.