skip to main content
Diagrammer > Programmer's documentation > Developing with the JViews Diagrammer SDK > Using and adding renderers > Adding your own renderer
 
Adding your own renderer
Explains how to extend the rendering features of SDM. Shows how to add your own renderer.
*Writing a renderer class
*Describes how to write a renderer class.
*Registering a renderer
*Shows how to register the renderer class in the style sheet.
*Loading and customizing a renderer
*Shows how to load and customize the registered renderer.
Writing a renderer class
SDM renderers are instances of subclasses of IlvSDMRenderer. Instead of creating an instance of this class, you can write a subclass of the Filter class, IlvFilterSDMRenderer, which is the base class for renderers that modify the style sheet rendering without completely replacing it.
Graph Layout renderers are subclasses of IlvGraphLayoutRenderer. For specific examples, see Using graph layout algorithms.
Registering a renderer
Once you have written the renderer class, you must register it in the style sheet. To do this, you can set the Renderers property in the SDM customization rule. The following code example shows the general form of the declaration.
The SDM customization rule
 
SDM {
   Renderers : "MyRendererName=my.package.MyRenderer";
}
In this declaration of the Renderers property, MyRendererName is the name that you will use to customize your renderer; my.package.MyRenderer is the full class name of your renderer class.
This declaration causes addRendererAlias, to be called. The other way to register a renderer is to call this method directly in your Java™ code.
If you register the renderer in the style sheet, then registering, loading and customizing can be seen as a single integration step.
Loading and customizing a renderer
Once the renderer is registered in the style sheet, you can load and customize it by adding to the style sheet. The following code example shows the property to set to load the renderer and the general form of customization declarations (highlighted).
Renderer rules
 
SDM {
   Renderers : "MyRendererName=my.package.MyRenderer";
MyRendererName : "true";
}
MyRendererName {
property1 : "value1";
property2 : "value2";
}

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