| | | | Browse by category |
Question
How to create a multiline tooltip for an activity?
Answer
You can return HTML text from the getToolTipText()
method of IlvActivityRenderer
orIlvConstraintGraphic
to cause tooltips to be rendered across multiple lines. HTML text must be bracketed with an <html>
tag at the beginning and an </html>
tag at the end. HTML tooltips will work on all currently supported versions of Swing. However, you can verify this by calling theIlvSwingUtil.isHTMLToolTipsSupported()
method. You can refer to this chapter of the Swing tutorial for more details on using HTML text within Swing components: .
If you are not using CSS styling, you will need to override the getToolTipText()
method in your activity renderer subclass to return HTML formatted text. You can use one of the twocreateMultiLineToolTipText
method of the class ilog.views.util.swing.IlvSwingUtil
to generate an HTML text string that can be rendered as multiline tool tip.
activity { class : 'ilog.views.gantt.graphic.renderer.IlvBasicActivityBar'; toolTipText : '@|"<html><center>"+@__ID+"<br>"+@name+"</center> <hr>Start: "+@startTime+"<br>End: "+@endTime+"</html>"';Notice how this example makes use of
<br>
, <hr>
, and other HTML alignment tags to format the tooltip.