public class IlvBlinkingRenderer extends IlvFilterSDMRenderer
IlvBlinkingRenderer
is a
filtering renderer that makes the grapher objects
blinking. It works together the classes
IlvBlinkingColor
,
IlvBlinkingPaint
,
IlvBlinkingMultiColor
, and
IlvBlinkingMultiPaint
.
This example shows how to toggle the colors of the grapher objects every seconds.
SDM { Blinking : "true"; } Blinking { onPeriod : 1000; // Every second offPeriod : 1000; // Every second } node { class : "ilog.views.sdm.graphic.IlvGeneralNode" ; label : "@name" ; // toggles from red to black (2 states): fillColor1 : "B1000/1000[red/black]" ; // toggles from black to transparent red to yellow (3 states): labelColor : "B500[black/#aaff0000/yellow]" ; }An alternative way to specify blinking 2-state colors is by using the
blinkingColor
function:
node { class : "ilog.views.sdm.graphic.IlvGeneralNode" ; label : "@name" ; // toggles from red to black: fillColor1 : "@|blinkingColor(red,black)" ; // toggles from black to fully transparent (that is, invisible): labelColor : "@|blinkingColor(black,#00000000)" ; }This example extract shows how to specify a more complex blinking paint that toggles between two paints every seconds.
node { class : "ilog.views.graphic.IlvGeneralPath"; fillPaint : "@=fillPaint"; fillOn : "true"; } Subobject#fillPaint { class : "ilog.views.util.java2d.IlvBlinkingPaint(onPaint,offPaint,onPeriod,offPeriod)"; onPaint : "@#onPaint"; offPaint : "@#offPaint"; onPeriod : "1000"; offPeriod : "1000"; } Subobject#onPaint { class : "java.awt.GradientPaint(point1,color1,point2,color2)"; point1 : "0.0,0.0"; color1 : "white"; point2 : "72.0,72.0"; color2 : "255,0,51"; } Subobject#offPaint { class : "java.awt.GradientPaint(point1,color1,point2,color2)"; point1 : "0.0,0.0"; color1 : "255,0,51"; point2 : "72.0,72.0"; color2 : "white"; }Besides blinking colors and paints, the rendering property
ToggleVisibility
switches the visibility of the objects. For instance:
SDM { Blinking: "true"; } Blinking { onPeriod: 1000; // Every second offPeriod: 1000; // Every second } node { ToggleVisibility : "true"; class : "ilog.views.sdm.graphic.IlvGeneralNode"; label : @Name; }
IlvBlinkingColor
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TOGGLE_VISIBILITY
The ToggleVisibility renderer property.
|
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvBlinkingRenderer()
Creates a new
IlvBlinkingRenderer renderer
with a null filtered renderer. |
IlvBlinkingRenderer(IlvSDMRenderer renderer)
Creates a new
IlvBlinkingRenderer renderer for a specified
filtered renderer. |
Modifier and Type | Method and Description |
---|---|
void |
addNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Adds the graphic object returned by
createNodeGraphic()
to the grapher of the SDM engine. |
void |
customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClasses)
This method simply calls the
customize method
of the filtered renderer. |
IlvBlinkingColor |
getColor(Color onColor,
Color offColor,
long onPeriod,
long offPeriod)
Returns a blinking color to be used by this blinking manager.
|
int |
getOffPeriod()
Returns the off period.
|
int |
getOnPeriod()
Returns the on period.
|
boolean |
isEnabled()
Tests if blinking is enabled.
|
void |
propertiesChanged(IlvSDMEngine engine,
Object node,
Collection<String> propertyNames,
IlvGraphic graphic)
This method simply calls the
propertiesChanged method
of the filtered renderer. |
void |
registerToggleGraphic(IlvGraphic graphic) |
void |
removeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Removes a graphic object representing a node of the SDM data model
from the grapher.
|
void |
setEnabled(boolean on)
Sets whether blinking is enabled.
|
void |
setOffPeriod(int offPeriod)
Sets the off period.
|
void |
setOnPeriod(int onPeriod)
Sets the on period
|
void |
unregisterToggleGraphic(IlvGraphic graphic) |
addLinkGraphic, computeBBox, createLinkGraphic, createNodeGraphic, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, linkGraphicAdded, moveResizeNodeGraphic, nodeGraphicAdded, nodeGraphicBBoxChanged, prepareRendering, processServerAction, removeAll, removeLinkGraphic, renderingDone, setFilteredRenderer, updateObjectProperties
addViewListeners, callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, getParameter, needsViewListeners, propertyChanged, removeViewListeners, setAlias, setEngine, setLayerName, setParameter
public static final String TOGGLE_VISIBILITY
public IlvBlinkingRenderer(IlvSDMRenderer renderer)
IlvBlinkingRenderer
renderer for a specified
filtered renderer.renderer
- the next renderer in chainpublic IlvBlinkingRenderer()
IlvBlinkingRenderer
renderer
with a null
filtered renderer.public void setOnPeriod(int onPeriod)
onPeriod
- the new valuepublic int getOnPeriod()
public void setOffPeriod(int offPeriod)
offPeriod
- the new valuepublic int getOffPeriod()
public void setEnabled(boolean on)
on
- Set to false
to disable blinking. The default value is
false
.public boolean isEnabled()
true
is returned.public IlvBlinkingColor getColor(Color onColor, Color offColor, long onPeriod, long offPeriod)
onColor
- The color of the on period.offColor
- The color of the off period.onPeriod
- duration in milliseconds of the period to display the
onColor
offPeriod
- duration in milliseconds of the period to display the
offColor
public void addNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
createNodeGraphic()
to the grapher of the SDM engine.
addNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object will be added.node
- The node to translate into an IlvGraphic
.graphic
- The graphic object returned by createGraphic
.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.createNodeGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object)
public void removeNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
removeNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher from which
the graphic object will be removed.node
- The node that has been removed or modified in the data model.graphic
- The graphic object that must be removed from the grapher.redraw
- If true
, the region covered by the
graphic object must be redrawn.public void propertiesChanged(IlvSDMEngine engine, Object node, Collection<String> propertyNames, IlvGraphic graphic)
propertiesChanged
method
of the filtered renderer.propertiesChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.node
- The data object whose property has changed.propertyNames
- The names of the properties that have been modified.graphic
- The graphic object associated with object
.public void customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClasses)
customize
method
of the filtered renderer.customize
in class IlvFilterSDMRenderer
engine
- The SDM engine.object
- The data object that the graphic object represents.g
- The graphic object to customize.pseudoClasses
- The pseudo-classes of the object. This parameter
can be null
.public void registerToggleGraphic(IlvGraphic graphic)
graphic
- the graphicpublic void unregisterToggleGraphic(IlvGraphic graphic)
graphic
- the graphic© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.