skip to main content
Diagrammer > Programmer's documentation > Developing with the JViews Diagrammer SDK > Performance enhancements > Optimizing the performance of diagrams
 
Optimizing the performance of diagrams
Shows you how to improve the performance of your diagrams.
*The Overview pane
*Describes the Overview pane and its use in optimizing diagrams.
*Grids in a diagram
*Describes the use of grids in a diagram.
*Rendering Done mode
*Describes the Rendering Done mode in the SDM engine.
*Composite renderer
*Shows how to disable composite rendering in the SDM engine.
*Load on demand
*Shows how to set the load-on-demand mode in the SDM engine.
*Content on demand
*Shows how to set the content-on-demand mode in the SDM engine.
*Adjusting modes
*Shows how to use adjusting modes in the SDM engine.
*Detail level
*Shows how to set the levels of detail for displaying nodes and links in the SDM engine.
*Better SDM/Java transition
*Shows how to disconnect SDM to improve performance.
The Overview pane
Each time a change happens in a diagram, only the area in the diagram that has been changed is refreshed. However, the whole diagram in the Overview pane has to be repainted, causing a large performance reduction. The overview pane is represented by an IlvDiagrammerOverview object. This pane is to be used when you design your Diagrammer or Dashboard application. Using the Overview pane in a run time application can reduce performance. This is particularly true when you use dynamic symbols.
Grids in a diagram
When the grid is enabled in JViews Diagrammer applications, it consumes a lot of graphic resources. To improve performance do not enable the grid in your diagram. In the Designer GUI, the grid can be enabled or disabled using the View menu. You disable the grid by calling clearing the grid in the IlvManagerView. The following code example shows how to clear the grid:
 
IlvSDMEngine e = dashDiag.getEngine();
e.getReferenceView().setGrid(null);
Rendering Done mode
In the SDM engine, the rendering process is controlled by a CSS style sheet, which lets you tell the SDM engine how you want each particular kind of data object to be displayed in the grapher. When the data model is loaded, the SDM engine explores it and creates graphic objects representing the nodes and links defined by the data model in the grapher. When the state of an object in the data model changes, the SDM engine updates the graphic object representing the modified data object. The object state may change due to an external application event or after a direct edit of an object property by the user. A property is a named characteristic of a graphic object to which you can assign values.
To improve performance while changing a model property, disable rendering done mode. This is especially beneficial for renderers that perform post-processing; such as link layout.
The following code example shows how to disable rendering done mode in the SDM engine.
 
IlvSDMEngine e = dashDiag.getEngine();
int old = e.getRenderingDoneMode();
try {
  e.setRenderingDoneMode(e.NEVER);
  // modify model here, without set adjusting
  ...
} finally {
  e.setRenderingDoneMode(old);
}
NOTE Setting rendering done mode to IlvSDMEngine.NEVER does not prevent the graphic from being customized.
Composite renderer
Composite rendering manages interaction and smart link connections, that is, the link ports, and the link connection rectangle for composite graphic and symbols. When dealing with basic non-interactive symbols, disabling composite rendering relieves the renderer toolchain and improves performance.
To disable composite rendering, set the Composite option in the SDM section of the initial stylesheet to false.
 
SDM {
   Map : "false";
   LinkLayout : "true";
   Composite : "false";
   GraphLayout : "false";
   HalfZooming : "false";
}
Load on demand
Using load on demand mode in the IlvSubGraphRenderer class, subnodes of a collapsed subgraph are created only when the subgraph is first expanded. This technique usually gives better startup times, at the expense of a slower expansion. The following code example shows how to set load-on-demand mode.
 
IlvDiagrammer diagrammer;
 
...
 
IlvSDMEngine engine = diagrammer.getEngine();
IlvSubGraphRenderer renderer = (IlvSubGraphRenderer)
  IlvRendererUtil.getRenderer(engine, IlvRendererUtil.SubGraph);
renderer.setLoadOnDemand(true);
Content on demand
The content on demand feature allows an SDM model to delay the loading of its object content in order to save resources. This assumes that empty model objects have low memory and time footprints, and are rendered with cheap graphic objects. Content on demand allows you to fill them when required and empty them when they are no longer needed.
The classes of the content on demand feature are located in the package ilog.views.sdm.modeltools. The entry point is the class IlvContentController.
Typically, content on demand is associated with a zoom listener. This allows the supervision of a map that contains a huge number of empty objects. Starting at a certain threshold, when the user zooms in, only the visible objects are filled. Objects outside the area of interest remain unloaded.
A content on demand sample is available in <installdir>/jviews-diagrammer/samples/diagrammer/content-on-demand/index.html. For more information, see Content on demand.
Adjusting modes
Rogue Wave® JViews Diagrammer applications use the SDM to calculate changes in the model. By default, after changes are calculated and validated in the SDM, the graphic objects effected by these changes are recalculated.
To render this process in the IlvSDMEngine more efficient, call IlvSDMEngine.setAdjustingMode(true). The SDM will then process all the modifications at once. You open an adjusting sequence by calling IlvSDMEngine.setAdjustingMode(true). To close an adjusting sequence, call IlvSDMEngine.setAdjustingMode(false).
Alternatively, you can close the adjusting sequence using IlvSDMEngine.clearAdjusting(). This method also validates the model changes, but prevents SDM from processing the modifications. Use it only if you are sure the model changes do not impact the display in any way.
The following code example shows how to use adjusting modes:
 
IlvSDMEngine engine = ...;
 
try {
  engine.setAdjusting(true);
 
  // perform changes on diag model, i.e. engine.getModel()
 
} finally {
  // commit changes
  engine.setAdjusting(false);
  // or commit silently:
  //engine.clearAdjusting();
}
Detail level
Style rules allow you to define three different levels of detail for displaying the nodes and links in a diagram: high (default), medium, low.
For example, you could define the following information to be displayed for each detail level:
*level: the nodes have a fill and a label
*medium level: the nodes have no fill but they have a label
*low level: the nodes have no fill and no label
A low level of detail allows you to speed the rendering of the diagram. The following code example shows how to set the level of detail to low.
 
IlvDiagrammer diagrammer;
 
...
 
IlvSDMEngine engine = diagrammer.getEngine();
engine.setDetailLevel(engine.LOW_DETAIL_LEVEL);;
...
Better SDM/Java transition
SDM manages the graphic objects according to the model state and style specification. To improve the performance or to execute tasks that are outside the SDM scope, you may need to tackle the grapher directly. In most cases, you will need to disconnect SDM so that it does not interfere and undo your actions.
To disconnect SDM, invoke the following method:
IlvSDMEngine.plugAllListeners(false);
This call will remove all SDM listeners set on the model, the view, and the manager. Without listeners, SDM does not react to modifications and you can safely perform actions on graphic objects and on the SDM model. The mapping between the SDM model and the graphic objects still works (IlvSDMEngine.getGraphic()) as well as most of the other SDM utility functions.
You can reconnect the SDM engine using IlvSDMEngine.plugAllListeners(true), but be aware that the engine will not catch up automatically the modifications that occurred while it was disconnected. To synchronize again the view with the model, each modified object should be refreshed manually.
For a finer control over SDM listeners, there are specific methods for each type of listener. See
*plugManagerListener
*plugViewListener
*plugSelectionListener
*plugModelListener

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.