ilog.views.sdm.renderer
Class IlvRendererUtil

java.lang.Object
  |
  +--ilog.views.sdm.renderer.IlvRendererUtil

public class IlvRendererUtil
extends Object

The class IlvRendererUtil defines a set of static utility methods that help implement and manage SDM renderers.

Since:
JViews 4.0

Field Summary
static String Animation
          The alias "Animation" for the class ilog.views.sdm.renderer.animation.IlvAnimationRenderer.
static String Coloring
          The alias "Coloring" for the class ilog.views.sdm.renderer.IlvColoringRenderer.
static String Decoration
          The alias "Decoration" for the class ilog.views.sdm.renderer.IlvDecorationRenderer.
static String DrillDown
          The alias "DrillDown" for the class ilog.views.sdm.renderer.IlvDrillDownRenderer.
static String ExpandCollapse
          The alias "ExpandCollapse" for the class ilog.views.sdm.renderer.IlvSubGraphRenderer.
static String ExpandCollapse40
          The alias "ExpandCollapse40" for the class ilog.views.sdm.renderer.IlvExpandCollapseRenderer.
static String GrapherPin
          The alias "GrapherPin" for the class ilog.views.sdm.renderer.IlvGrapherPinRenderer.
static String GraphLayout
          The alias "GraphLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvGraphLayoutRenderer.
static String HalfZooming
          The alias "HalfZooming" for the class ilog.views.sdm.renderer.IlvHalfZoomingRenderer.
static String InfoBalloon
          The alias "InfoBalloon" for the class ilog.views.sdm.renderer.IlvInfoBalloonRenderer.
static String Interactor
          The alias "Interactor" for the class ilog.views.sdm.renderer.IlvInteractorRenderer.
static String LabelLayout
          The alias "LabelLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvLabelLayoutRenderer.
static String Legend
          The alias "Legend" for the class ilog.views.sdm.renderer.IlvLegendRenderer.
static String LinkLayout
          The alias "LinkLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvLinkLayoutRenderer.
static String Map
          The alias "Map" for the class ilog.views.sdm.renderer.maps.IlvMapRenderer.
static String StyleSheet
          The alias "StyleSheet" for the class ilog.views.sdm.renderer.IlvStyleSheetRenderer.
static String SubGraph
          The alias "SubGraph" for the class ilog.views.sdm.renderer.IlvSubGraphRenderer.
static String SwimLanes
          The alias "SwimLanes" for the class ilog.views.sdm.renderer.graphlayout.IlvSwimLanesRenderer.
 
Method Summary
static void addRendererAlias(String alias, String rendererClassName)
          Adds an alias for a renderer class.
static void customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClasses)
          This method calls IlvSDMRenderer.customize(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, java.lang.String[]) on the root renderer of the SDM engine.
static void customize(IlvSDMEngine engine, Object object, String[] pseudoClasses, boolean redraw)
          This method is similar to customize(ilog.views.sdm.IlvSDMEngine,java.lang.Object,ilog.views.IlvGraphic,java.lang.String[]), but instead of specifying the graphic object yourself, the SDM engine uses the graphic object representing the data object.
static Object getGraphicProperty(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, Class targetClass)
          This method calls the getGraphicProperty method of the root renderer attached to the SDM engine.
static boolean getGraphicPropertyAsBoolean(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, boolean def)
          This method calls getGraphicProperty and converts the result to a Boolean.
static Color getGraphicPropertyAsColor(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, Color def)
          This method calls getGraphicProperty and converts the result to a Color.
static double getGraphicPropertyAsDouble(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, double def)
          This method calls getGraphicProperty and converts the result to a double.
static float getGraphicPropertyAsFloat(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, float def)
          This method calls getGraphicProperty and converts the result to a float.
static int getGraphicPropertyAsInt(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, int def)
          This method calls getGraphicProperty and converts the result to an int.
static long getGraphicPropertyAsLong(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, long def)
          This method calls getGraphicProperty and converts the result to a long.
static String getGraphicPropertyAsString(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, String def)
          This method calls getGraphicProperty and converts the result to a String.
static IlvPrototype getPrototype(String prototypeURL, Class jarClass)
          Loads a prototype from a URL.
static String[] getPseudoClasses(IlvSDMEngine engine, Object object, String[] additionalClasses)
          Returns the pseudo classes associated with the specified data object, concatenated with the specified additional classes.
static IlvSDMRenderer getRenderer(IlvSDMEngine engine, String name)
          Finds a renderer attached to an SDM engine, starting with the root renderer returned by IlvSDMEngine.getRenderer(), and going down the chain of filtering renderers to the final style sheet renderer.
static String getRendererAlias(String className)
          Returns the alias of a renderer class from a class name.
static String[] getRendererAliases()
          Returns all the renderer aliases registered so far.
static String getRendererClassName(String alias)
          Returns the name of a renderer class from an alias.
static String[] getRendererClassNames()
          Returns all the renderer class names registered so far.
static void updateObjectProperties(IlvSDMEngine engine, Object object, String property, Object value, String[] pseudoClasses)
          This method calls IlvSDMRenderer.updateObjectProperties(ilog.views.sdm.IlvSDMEngine, java.lang.Object, java.lang.String, java.lang.Object, java.lang.String[]) on the root renderer of the SDM engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Animation

public static final String Animation
The alias "Animation" for the class ilog.views.sdm.renderer.animation.IlvAnimationRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

Coloring

public static final String Coloring
The alias "Coloring" for the class ilog.views.sdm.renderer.IlvColoringRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

Decoration

public static final String Decoration
The alias "Decoration" for the class ilog.views.sdm.renderer.IlvDecorationRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

ExpandCollapse40

public static final String ExpandCollapse40
The alias "ExpandCollapse40" for the class ilog.views.sdm.renderer.IlvExpandCollapseRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

SubGraph

public static final String SubGraph
The alias "SubGraph" for the class ilog.views.sdm.renderer.IlvSubGraphRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

ExpandCollapse

public static final String ExpandCollapse
The alias "ExpandCollapse" for the class ilog.views.sdm.renderer.IlvSubGraphRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

HalfZooming

public static final String HalfZooming
The alias "HalfZooming" for the class ilog.views.sdm.renderer.IlvHalfZoomingRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

InfoBalloon

public static final String InfoBalloon
The alias "InfoBalloon" for the class ilog.views.sdm.renderer.IlvInfoBalloonRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

Legend

public static final String Legend
The alias "Legend" for the class ilog.views.sdm.renderer.IlvLegendRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

DrillDown

public static final String DrillDown
The alias "DrillDown" for the class ilog.views.sdm.renderer.IlvDrillDownRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

Map

public static final String Map
The alias "Map" for the class ilog.views.sdm.renderer.maps.IlvMapRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

SwimLanes

public static final String SwimLanes
The alias "SwimLanes" for the class ilog.views.sdm.renderer.graphlayout.IlvSwimLanesRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

LabelLayout

public static final String LabelLayout
The alias "LabelLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvLabelLayoutRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

LinkLayout

public static final String LinkLayout
The alias "LinkLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvLinkLayoutRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

GraphLayout

public static final String GraphLayout
The alias "GraphLayout" for the class ilog.views.sdm.renderer.graphlayout.IlvGraphLayoutRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

Interactor

public static final String Interactor
The alias "Interactor" for the class ilog.views.sdm.renderer.IlvInteractorRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

GrapherPin

public static final String GrapherPin
The alias "GrapherPin" for the class ilog.views.sdm.renderer.IlvGrapherPinRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5

StyleSheet

public static final String StyleSheet
The alias "StyleSheet" for the class ilog.views.sdm.renderer.IlvStyleSheetRenderer.
See Also:
addRendererAlias(java.lang.String, java.lang.String)
Since:
JViews 5.5
Method Detail

addRendererAlias

public static void addRendererAlias(String alias,
                                    String rendererClassName)
Adds an alias for a renderer class. Aliases are short names that let you designate a particular renderer class in the SDM style sheet.

By default, the following aliases are defined:

AnimationIlvAnimationRenderer
ColoringIlvColoringRenderer
DecorationIlvDecorationRenderer
ExpandCollapse40IlvExpandCollapseRenderer
SubGraphIlvSubGraphRenderer
ExpandCollapseIlvSubGraphRenderer
HalfZoomingIlvHalfZoomingRenderer
InfoBalloonIlvInfoBalloonRenderer
LegendIlvLegendRenderer
DrillDownIlvDrillDownRenderer
MapIlvMapRenderer
SwimLanesIlvSwimLanesRenderer
LabelLayoutIlvLabelLayoutRenderer
LinkLayoutIlvLinkLayoutRenderer
GraphLayoutIlvGraphLayoutRenderer
InteractorIlvInteractorRenderer
GrapherPinIlvGrapherPinRenderer
StyleSheetIlvStyleSheetRenderer

It is possible to override the definition of a predefined alias. This may be useful if you want to modify a predefined renderer. All you have to do is call addRendererAlias with the existing alias name and the name of the new renderer class. Note, though, that the new class must be a subclass of the predefined renderer.

The aliases for the predefined renderers are defined as static strings (for example, StyleSheet, GraphLayout, and so forth). It is recommended using these static variables to avoid spelling errors.

Parameters:
alias - The alias for the renderer class to add.
rendererClassName - The fully qualified name of the renderer class.

getRendererClassName

public static String getRendererClassName(String alias)
Returns the name of a renderer class from an alias.
Parameters:
alias - The renderer alias.
See Also:
addRendererAlias(java.lang.String, java.lang.String)

getRendererAlias

public static String getRendererAlias(String className)
Returns the alias of a renderer class from a class name.
Parameters:
className - The fully qualified renderer class name.
See Also:
addRendererAlias(java.lang.String, java.lang.String)

getRendererAliases

public static String[] getRendererAliases()
Returns all the renderer aliases registered so far.
See Also:
addRendererAlias(java.lang.String, java.lang.String)

getRendererClassNames

public static String[] getRendererClassNames()
Returns all the renderer class names registered so far.
See Also:
addRendererAlias(java.lang.String, java.lang.String)

getRenderer

public static IlvSDMRenderer getRenderer(IlvSDMEngine engine,
                                         String name)
Finds a renderer attached to an SDM engine, starting with the root renderer returned by IlvSDMEngine.getRenderer(), and going down the chain of filtering renderers to the final style sheet renderer. The renderer can be looked up either by its alias name or by its class name.

Note that, when a renderer is looked up using a class name, only the first renderer whose class is equal to the specified class is returned. This means that if a predefined renderer is redefined with a subclass of the original renderer, this new renderer will not be found. So, it is usually better to query a renderer by its alias name.

The aliases for the predefined renderers are defined as static strings (for example, StyleSheet, GraphLayout, and so forth). It is recommended using these static variables to avoid spelling errors.

Parameters:
engine - The SDM engine.
name - The alias or the fully qualified class name of the renderer.
Returns:
One of the renderers associated with the SDM engine, or null if the renderer could not be found.

getGraphicProperty

public static Object getGraphicProperty(IlvSDMEngine engine,
                                        Object object,
                                        String property,
                                        String[] pseudoClasses,
                                        Class targetClass)
This method calls the getGraphicProperty method of the root renderer attached to the SDM engine.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
targetClass - The target class.

getGraphicPropertyAsString

public static String getGraphicPropertyAsString(IlvSDMEngine engine,
                                                Object object,
                                                String property,
                                                String[] pseudoClasses,
                                                String def)
This method calls getGraphicProperty and converts the result to a String.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.
See Also:
getGraphicProperty(ilog.views.sdm.IlvSDMEngine,java.lang.Object,java.lang.String,java.lang.String[],java.lang.Class)

getGraphicPropertyAsBoolean

public static boolean getGraphicPropertyAsBoolean(IlvSDMEngine engine,
                                                  Object object,
                                                  String property,
                                                  String[] pseudoClasses,
                                                  boolean def)
This method calls getGraphicProperty and converts the result to a Boolean.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

getGraphicPropertyAsInt

public static int getGraphicPropertyAsInt(IlvSDMEngine engine,
                                          Object object,
                                          String property,
                                          String[] pseudoClasses,
                                          int def)
This method calls getGraphicProperty and converts the result to an int.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

getGraphicPropertyAsLong

public static long getGraphicPropertyAsLong(IlvSDMEngine engine,
                                            Object object,
                                            String property,
                                            String[] pseudoClasses,
                                            long def)
This method calls getGraphicProperty and converts the result to a long.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

getGraphicPropertyAsFloat

public static float getGraphicPropertyAsFloat(IlvSDMEngine engine,
                                              Object object,
                                              String property,
                                              String[] pseudoClasses,
                                              float def)
This method calls getGraphicProperty and converts the result to a float.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

getGraphicPropertyAsDouble

public static double getGraphicPropertyAsDouble(IlvSDMEngine engine,
                                                Object object,
                                                String property,
                                                String[] pseudoClasses,
                                                double def)
This method calls getGraphicProperty and converts the result to a double.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

getGraphicPropertyAsColor

public static Color getGraphicPropertyAsColor(IlvSDMEngine engine,
                                              Object object,
                                              String property,
                                              String[] pseudoClasses,
                                              Color def)
This method calls getGraphicProperty and converts the result to a Color.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
def - A default value to return if the property is not defined.

updateObjectProperties

public static void updateObjectProperties(IlvSDMEngine engine,
                                          Object object,
                                          String property,
                                          Object value,
                                          String[] pseudoClasses)
This method calls IlvSDMRenderer.updateObjectProperties(ilog.views.sdm.IlvSDMEngine, java.lang.Object, java.lang.String, java.lang.Object, java.lang.String[]) on the root renderer of the SDM engine.

Parameters:
engine - The SDM engine.
object - The data object.
property - The name of the rendering property.
value - The new value of the property.
pseudoClasses - The pseudo classes of the object. This parameter can be null.
See Also:
IlvSDMRenderer.updateObjectProperties(ilog.views.sdm.IlvSDMEngine, java.lang.Object, java.lang.String, java.lang.Object, java.lang.String[])

customize

public static void customize(IlvSDMEngine engine,
                             Object object,
                             IlvGraphic g,
                             String[] pseudoClasses)
This method calls IlvSDMRenderer.customize(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, java.lang.String[]) on the root renderer of the SDM engine.

This method does not automatically redraw the graphic object. To do so, call the variant customize(ilog.views.sdm.IlvSDMEngine,java.lang.Object,java.lang.String[],boolean).

Parameters:
engine - The SDM engine.
object - The data object used to compute the rendering properties to set.
g - The graphic object to customize.
pseudoClasses - A list of symbolic names that identify the context in which the graphic object must be customized. For example, the pseudo class defines the "pseudo-classes" in the style sheet renderer.

customize

public static void customize(IlvSDMEngine engine,
                             Object object,
                             String[] pseudoClasses,
                             boolean redraw)
This method is similar to customize(ilog.views.sdm.IlvSDMEngine,java.lang.Object,ilog.views.IlvGraphic,java.lang.String[]), but instead of specifying the graphic object yourself, the SDM engine uses the graphic object representing the data object. Another difference is that this method calls IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean) to automatically update and redraw the manager view.

Parameters:
engine - The SDM engine.
object - The data object used to compute the rendering properties to set.
pseudoClasses - A list of symbolic names that identify the context in which the graphic object must be customized. For example, the pseudo class defines the "pseudo-classes" in the style sheet renderer.
redraw - Pass true if you want the object to be redrawn.

getPseudoClasses

public static String[] getPseudoClasses(IlvSDMEngine engine,
                                        Object object,
                                        String[] additionalClasses)
Returns the pseudo classes associated with the specified data object, concatenated with the specified additional classes.
Parameters:
engine - The SDM engine.
object - The data object.
additionalClasses - An array of Strings that identify the pseudo classes to concatenate with the classes associated with the object.
Returns:
An array of Strings containing both the classes that have been associated with the object (using IlvSDMEngine.addPseudoClass(java.lang.Object, java.lang.String)) and additionalClasses.

getPrototype

public static IlvPrototype getPrototype(String prototypeURL,
                                        Class jarClass)
                                 throws MalformedURLException,
                                        IlvReadFileException,
                                        IOException
Loads a prototype from a URL. This method calls IlvPrototypeLibrary.getPrototype(java.lang.String,java.lang.Class).
Parameters:
prototypeURL - A string containing the URL of the prototype.
jarClass - A class loaded from the JAR file where the prototype library file is located.