|| | |||Browse by category|
How to have local-component tooltips in an SDM prototype?
When you move the mouse over a prototype, the default behavior is that a single tooltip is returned for the entire
IlvGraphicGroup instance inside the prototype. In some cases, you might wish a tooltip to appear for each separate graphic element in the prototype, instead.
The attached example creates an SDM, then reads an .xml file and a .css file. These files create 2 prototype instances connected by links. The prototype is defined in the .ivl file. It is a straightforward prototype consisting of an
IlvGeneralNode object and an
IlvZoomableLabel object. Each graphic within the prototype has been assigned a tooltip using Composer.
As you move the mouse over the prototype, the tooltip for the separate graphics in the prototype appear ("frame" and "zoomable label"). This overrides the default behavior, which would return a tooltip for the entire prototype instance.
To enable the tooltips to function this way, you need to subclass
IlvGraphicHandle and to override the
getToolTipText method to detect the mouse position and the graphic object beneath the mouse. The
getToolTipText method is then invoked on the graphic object itself, not on the prototype instance as a whole.
In the .css file, there is some fairly tricky syntax required. For each prototype instance, you need to state that the new
IlvGraphicHandle subclass (
TooltipHandle) will be used. In addition, the line
@#proto is required to state that you must use the object described by the
#proto rule. The
#proto rule states where the prototype is defined.
See the attached file SDM_Tooltips_Prototype_Sample.zip.
Note: In order to run this sample in JViews 8.7 or newer, you must call the ilog.views.util.IlvProductUtil.DeploymentLicenceRequired method with the appropriate argument.