| | | | Browse by category |
Question
How do I use the TRUNCATE and WORD_WRAP modes for my IlvGeneralNode and IlvSDMCompositeNode labels?
Answer
If you have very long labels, you may want to consider using automatic word wrapping or truncation to keep the lengths at a reasonable size. Such features are available only if the label is represented by an IlvText
object.
If you use an IlvGeneralNode
(with its useIlvText
property set to the default value true
), its label will always be represented by an IlvText
object. The IlvGeneralNode
includes a labelMode
property to determine how it should wrap large label strings. (See the IlvGeneralMode.setLabelMode
(int mode)
method)
node {
class : "ilog.views.sdm.graphic.IlvGeneralNode" ;
label : "@name" ;
labelMode : "TRUNCATE" ;
useIlvText : "true" ;
}
If you use an IlvSDMCompositeNode
, you have to explicitly declare one of the children as an IlvText
. Then you can set the
wrappingMode
property on the IlvText
child.
node {
class : "ilog.views.sdm.graphic.IlvSDMCompositeNode" ;
children[0] : "@+Text" ;
}
#Text {
class : "ilog.views.graphic.IlvText" ;
label : "@name" ;
wrappingMode : "ilog.views.graphic.IlvText.WRAP_WORD";
wrappingWidth : "60";
}
Both approaches affect the underlying IlvText
object and the wrapping will proceed normally.