skip to main content
TGO > Programmers documentation > Styling > Using Cascading Style Sheets > Customizing the label of a business object
 
Customizing the label of a business object
Customizing label parameters in the graphic representation of a business object is based on the properties listed in the following table.
CSS properties for labels 
Property Name
Type
Default Value
Description
labelVisible
boolean
true
Controls whether the label is shown or not.
label
String
null
Text to be displayed for the label. If the value is null, the identifier of the business object is displayed.
labelFont
Font
Helvetica 12, except:
- in IltShelf: Helvetica 10
- in IltShelfItem: Helvetica 11 (Courier New 11 on Windows®)
Specifies the font to use to draw the label.
labelForeground
Color
black, except:
- in IltEmptySlot: 50% gray
Gives the color of the label text.
labelBackground
Color
null
Gives the color of the label background. The background is transparent when this value is null.
labelPosition
IlvDirection
Bottom
Defines the position of the label relative to the base or to the information cluster. Its possible values are:
Top
Bottom
Right
Left
Center
BadPosition.
When labelPosition is set to BadPosition, JViews TGO is responsible for defining the label position that best fits with the kind of telecom object being displayed.
labelAntialiasing
boolean
true
Controls whether the label is drawn using anti-aliasing or not.
labelSpacing
float
2: For custom business objects.
0: For predefined business objects.
Defines the distance between the label and the object base.
Predefined business objects also support the property labelOffset that allows you to define the X and Y distance between the label and the base. This property has priority over the property labelSpacing.
labelOffset
IlvPoint
0, 0
Indicates the offset in x,y coordinates between the label and the object base.
labelWrappingMode
short
None
Defines the wrapping mode of the object label representation. The following values are available: None, Word Wrap, Truncate, Wrap and Truncate.
labelWrappingWidth
float
-1
The width is automatically defined by JViews TGO according to the object base dimensions. For off-page connectors, the default value is set to 60 pixels.
Defines the label width above which the label will be truncated or wrapped according to the wrapping mode.
labelWrappingHeight
float
-1
The height is automatically defined by JViews TGO according to the object base dimensions.
Defines the label height above which the label will be truncated.
labelMargin
float
0: for all objects.
35: for IltShelfItem.
Defines the margin between the label and the edge of the shape when performing word wrapping or truncation
labelAlignment
int
-1: The label alignment is automatically computed based on the label position:
- If the label position is Bottom or Top, the alignment will be Center.
- If the label position is Left, the alignment is Right.
- If the label position is Right, the alignment is Left.
Defines the alignment of the label when it has several lines.
Possible values are:
Top
Bottom
Center
Left
Right
labelBorderColor
Color
transparent ( null )
Gives the color used to draw a border around the label; the border will be displayed only if this value is not null.
labelDirection
IlvDirection
Right, except in:
Defines the direction used to draw the label (vertical or horizontal).
Possible values are:
Top
Bottom
Left
Right
labelScaleFactor
float
1
Defines a scale factor that is applied to the label so that it can be adjusted independently from the object base.
lineSpacing
float
-1: The label will use the default TextLayout leading.
Defines the distance between lines when the label is on several lines.
minLabelZoom
float
0.6
Defines the minimum label zoom below which the label becomes invisible.
maxLabelZoom
float
500
Defines the maximum label zoom above which the label becomes invisible.
NOTE >> The customization of labels in a tree component uses all of these properties except labelScaleFactor, minLabelZoom, and maxLabelZoom.
The customization of labels in a table component follows the table cell customization, that is, it uses the properties listed in CSS properties for the table cells .
How to customize the label from a business attribute
The following example shows you how to customize a label according to the name attribute of the business object:
 
object."ilog.tgo.model.IltObject" {
  label: @name;
}
How to customize the label based on specific attribute values
The following example shows you how to customize the graphical representation of the business class IltNetworkElement so that the label foreground color is based on the value of the attribute type :
 
object."ilog.tgo.model.IltNetworkElement"[type="NMW"] {
labelForeground: blue;
}
object."ilog.tgo.model.IltNetworkElement"[type="BSC"] {
labelForeground: green;
}
In this example, IltNetworkElement instances whose type attribute is set to NMW have a blue label. Instances whose type attribute is set to BSC have a green label.
How to customize the label to wrap or truncate automatically
The following example specifies that the network element labels will wrap automatically if they are larger than 50 pixels.
 
object."ilog.tgo.model.IltNetworkElement" {
  labelWrappingMode: Word Wrap;
  labelWrappingWidth: 50;
}
You can also specify that the label will be truncated automatically if it is larger than a specific value. In this case, the label is truncated and ‘ ... ’ is added at the end. The following example specifies that network elements will have their label truncated, except when the object is selected.
 
object."ilog.tgo.model.IltNetworkElement" {
  labelWrappingMode: Truncate;
  labelWrappingWidth: 50;
}
 
object."ilog.tgo.model.IltNetworkElement":selected {
  labelWrappingMode: None;
}

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.