Getting started with Label Layout in a diagram component

For information on how to load a style file into the diagram component and how to access the node layout, link layout, and label layout renderers, see Basic concepts.
To support labels in CSS:
  1. Write a style rule specifying that links have labels.
    The following CSS specification indicates that each link has one label with the text coming from the “name” property of the model links of the SDM data model:
    link {
        class: "ilog.views.sdm.graphic.IlvGeneralLink";
        label: "@name";
    }
    
  2. Specify, for example, that each label should be placed at the left side of the corresponding link:
    link:labelLayout {
        allowedSide: "Left";
        sideAssociation: "GLOBAL";
    }
    
  3. To enable label layout, specify the label layout renderer:
    SMD {
        LabelLayout: "true";
    }
    
  4. Set global label layout parameters in the Label Layout section. For example, the following specification defines the minimum offsets between pairs of labels (5) and between a label and an obstacle (10):
    LabelLayout {
        labelOffset: "5";
        obstacleOffset: "10";
    }
    
When a style file with these CSS specifications is loaded into the diagram component, the Annealing Label layout is automatically performed. The label layout renderer always uses the Annealing Label layout, therefore it is not necessary to specify which label layout must be performed.
The complete CSS specification and a simple application that loads the specification and performs a label layout are available as a sample at: <installdir>jviews-diagrammer89/codefragments/labellayout