public class IlvRendererUtil extends Object
IlvRendererUtil
defines a set
of static utility methods that help implement and manage SDM
renderers.Modifier and Type | Field and Description |
---|---|
static String |
Animation
The alias
"Animation" for the class ilog.views.sdm.renderer.animation.IlvAnimationRenderer . |
static String |
Blinking
The alias
"Blinking" for the class ilog.views.sdm.renderer.IlvBlinkingRenderer . |
static String |
Coloring
The alias
"Coloring" for the class ilog.views.sdm.renderer.IlvColoringRenderer . |
static String |
Composite
The alias
"Composite" for the class ilog.views.sdm.renderer.IlvCompositeRenderer . |
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 |
Lanes
The alias
"Lanes" for the class ilog.views.sdm.renderer.IlvLaneRenderer . |
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 . |
Modifier and Type | Method and Description |
---|---|
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 void |
ensureTracing(IlvSDMEngine engine)
Ensures that the SDM engine can trace rendering calls.
|
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 boolean |
isTracingEnabled()
Returns whether tracing of all renderer method calls is enabled.
|
static void |
setTraceRenderers(String... rendererAliases)
Specify which renderers should be traced.
|
static void |
setTraceStream(PrintStream out)
Specifies the trace stream.
|
static void |
setTracingDisabled(String... methodNames)
Specify which methods should not be traced.
|
static void |
setTracingEnabled(boolean enable)
Enables tracing of renderer method calls.
|
static void |
setTracingEnabled(String... methodNames)
Specify which methods should be traced.
|
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. |
public static final String Blinking
"Blinking"
for the class ilog.views.sdm.renderer.IlvBlinkingRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Composite
"Composite"
for the class ilog.views.sdm.renderer.IlvCompositeRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Animation
"Animation"
for the class ilog.views.sdm.renderer.animation.IlvAnimationRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Coloring
"Coloring"
for the class ilog.views.sdm.renderer.IlvColoringRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Decoration
"Decoration"
for the class ilog.views.sdm.renderer.IlvDecorationRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ExpandCollapse40
"ExpandCollapse40"
for the class ilog.views.sdm.renderer.IlvExpandCollapseRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String SubGraph
"SubGraph"
for the class ilog.views.sdm.renderer.IlvSubGraphRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ExpandCollapse
"ExpandCollapse"
for the class ilog.views.sdm.renderer.IlvSubGraphRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String HalfZooming
"HalfZooming"
for the class ilog.views.sdm.renderer.IlvHalfZoomingRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String InfoBalloon
"InfoBalloon"
for the class ilog.views.sdm.renderer.IlvInfoBalloonRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Legend
"Legend"
for the class ilog.views.sdm.renderer.IlvLegendRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String DrillDown
"DrillDown"
for the class ilog.views.sdm.renderer.IlvDrillDownRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Map
"Map"
for the class ilog.views.sdm.renderer.maps.IlvMapRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String SwimLanes
"SwimLanes"
for the class ilog.views.sdm.renderer.graphlayout.IlvSwimLanesRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Lanes
"Lanes"
for the class ilog.views.sdm.renderer.IlvLaneRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String LabelLayout
"LabelLayout"
for the class ilog.views.sdm.renderer.graphlayout.IlvLabelLayoutRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String LinkLayout
"LinkLayout"
for the class ilog.views.sdm.renderer.graphlayout.IlvLinkLayoutRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String GraphLayout
"GraphLayout"
for the class ilog.views.sdm.renderer.graphlayout.IlvGraphLayoutRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String Interactor
"Interactor"
for the class ilog.views.sdm.renderer.IlvInteractorRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String GrapherPin
"GrapherPin"
for the class ilog.views.sdm.renderer.IlvGrapherPinRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String StyleSheet
"StyleSheet"
for the class ilog.views.sdm.renderer.IlvStyleSheetRenderer
.addRendererAlias(java.lang.String, java.lang.String)
,
Constant Field Valuespublic static void addRendererAlias(String alias, String rendererClassName)
By default, the following aliases are defined:
Blinking | IlvBlinkingRenderer |
Composite | IlvCompositeRenderer |
Animation | IlvAnimationRenderer |
Coloring | IlvColoringRenderer |
Decoration | IlvDecorationRenderer |
ExpandCollapse40 | IlvExpandCollapseRenderer |
SubGraph | IlvSubGraphRenderer |
ExpandCollapse | IlvSubGraphRenderer |
HalfZooming | IlvHalfZoomingRenderer |
InfoBalloon | IlvInfoBalloonRenderer |
Legend | IlvLegendRenderer |
DrillDown | IlvDrillDownRenderer |
Map | IlvMapRenderer |
SwimLanes | IlvSwimLanesRenderer |
LabelLayout | IlvLabelLayoutRenderer |
LinkLayout | IlvLinkLayoutRenderer |
GraphLayout | IlvGraphLayoutRenderer |
Interactor | IlvInteractorRenderer |
GrapherPin | IlvGrapherPinRenderer |
StyleSheet | IlvStyleSheetRenderer |
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.
alias
- The alias for the renderer class to add.rendererClassName
- The fully qualified name of the renderer class.public static String getRendererClassName(String alias)
alias
- The renderer alias.addRendererAlias(java.lang.String, java.lang.String)
public static String getRendererAlias(String className)
className
- The fully qualified renderer class name.addRendererAlias(java.lang.String, java.lang.String)
public static String[] getRendererAliases()
public static String[] getRendererClassNames()
public static IlvSDMRenderer getRenderer(IlvSDMEngine engine, String name)
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.
engine
- The SDM engine.name
- The alias or the fully qualified class name of the renderer.null
if the renderer could not be found.public static Object getGraphicProperty(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, Class<?> targetClass)
getGraphicProperty
method
of the root renderer attached to the SDM engine.
The implementation of the getGraphicProperty
method
in IlvStyleSheetRenderer
retrieves the value
of the CSS declaration with the same name as property
.
Hence, this method can be used to obtain declaration values of
the CSS specification for specific nodes and links of the CSS model.
Example CSS:
node[name] { label : "@name"; }To access the actual value of the label, use
IlvRendererUtil.getGraphicProperty(engine, node, "label", null, null);In this example, it returns the value of the "name" property in the SDM model (which is the value of the "label" CSS declaration).
The pseudoClasses
can be used to select declaration in
specific rules; for instance new String[] { "selected" }
can be passed to search declarations for selected nodes (that is,
declarations in rules such as node:selected { ... }
).
engine
- The SDM engine.object
- The data object (an object of the SDM model).property
- The name of the rendering property.pseudoClasses
- The pseudo classes of the object. This parameter
can be null
.targetClass
- The target class. This is the class of the object on
which the property will be set. The method can introspect the class to
determine the type of the property, and convert the value if necessary.
If this argument is null
, the property should be returned
without conversion.public static String getGraphicPropertyAsString(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, String def)
getGraphicProperty
and converts the result to a String.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.getGraphicProperty(ilog.views.sdm.IlvSDMEngine,java.lang.Object,java.lang.String,java.lang.String[],java.lang.Class)
public static boolean getGraphicPropertyAsBoolean(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, boolean def)
getGraphicProperty
and converts the result to a Boolean.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static int getGraphicPropertyAsInt(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, int def)
getGraphicProperty
and converts the result to an int
.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static long getGraphicPropertyAsLong(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, long def)
getGraphicProperty
and converts the result to a long
.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static float getGraphicPropertyAsFloat(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, float def)
getGraphicProperty
and converts the result to a float
.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static double getGraphicPropertyAsDouble(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, double def)
getGraphicProperty
and converts the result to a double
.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static Color getGraphicPropertyAsColor(IlvSDMEngine engine, Object object, String property, String[] pseudoClasses, Color def)
getGraphicProperty
and converts the result to a Color
.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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.public static void updateObjectProperties(IlvSDMEngine engine, Object object, String property, Object value, String[] pseudoClasses)
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.
engine
- The SDM engine.object
- The data object (an object of the SDM model).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
.IlvSDMRenderer.updateObjectProperties(ilog.views.sdm.IlvSDMEngine, java.lang.Object, java.lang.String, java.lang.Object, java.lang.String[])
public static void customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClasses)
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)
.
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.public static void customize(IlvSDMEngine engine, Object object, String[] pseudoClasses, boolean redraw)
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.
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.public static String[] getPseudoClasses(IlvSDMEngine engine, Object object, String[] additionalClasses)
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.IlvSDMEngine.addPseudoClass(java.lang.Object, java.lang.String)
)
and additionalClasses
.public static IlvPrototype getPrototype(String prototypeURL, Class<?> jarClass) throws MalformedURLException, IlvReadFileException, IOException
IlvPrototypeLibrary.getPrototype(java.lang.String,java.lang.Class)
.prototypeURL
- A string containing the URL of the prototype.jarClass
- A class loaded from the JAR file where the prototype library file is located.MalformedURLException
IlvReadFileException
IOException
public static void setTracingEnabled(boolean enable)
setTraceStream(java.io.PrintStream)
public static boolean isTracingEnabled()
setTracingEnabled(boolean)
public static void setTracingEnabled(String... methodNames)
setTraceRenderers(java.lang.String...)
, otherwise all
renderers are traced.
This should be called at the beginning of the application
before the style sheet is set.
Example to enable tracing for methods
IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
and
IlvSDMRenderer.customize(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, java.lang.String[])
:
IlvRenderingUtil.setTracingEnabled("renderingDone", "customize");The trace methods can also be specified is CSS, in the following way:
SDM { TraceMethods: "renderingDone,customize" ; }To trace all methods, specify in CSS
SDM { TraceMethods: "All" ; }
methodNames
- The method names of IlvSDMRenderer
to be traced.setTraceStream(java.io.PrintStream)
,
setTracingEnabled(boolean)
public static void setTracingDisabled(String... methodNames)
setTraceRenderers(java.lang.String...)
, otherwise all
renderers are traced.
This should be called at the beginning of the application
before the style sheet is set.
Example to enable tracing for all methods except
IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
and
IlvSDMRenderer.customize(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, java.lang.String[])
:
IlvRenderingUtil.setTracingDisabled("renderingDone", "customize");
methodNames
- The method names of IlvSDMRenderer
that should not be traced.setTraceStream(java.io.PrintStream)
,
setTracingEnabled(boolean)
public static void setTraceRenderers(String... rendererAliases)
IlvRenderingUtil.setTraceRenderers("GraphLayout", "LinkLayout");The trace renderers can also be specified is CSS, in the following way:
SDM { TraceRenderers: "GraphLayout,LinkLayout" ; }To trace all renderers, specify in CSS
SDM { TraceRenderers: "All" ; }
rendererAliases
- The alias names of the renderers.setTracingEnabled(boolean)
,
setTraceStream(java.io.PrintStream)
public static void setTraceStream(PrintStream out)
System.err
can be used as trace stream. By default, and if null
is used, the trace is logged to the "ilog.views.sdm" logger as
finest messages.
The trace stream can also be specified is CSS, in the following way:
SDM { TraceStream: "window" ; }The CSS options are "window", "System.out" and "System.err".
setTracingEnabled(boolean)
public static void ensureTracing(IlvSDMEngine engine)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.