Specifying constraints in CSS for HL

There are two ways to specify constraints in a style sheet:
  • In an external file that contains the constraints
  • By means of style rules in the style file directly
When you do not use a diagram component with style sheet capabilities, you can still use constraints.
Writing style rules that specify constraints is very powerful but complex. It is illustrated in section For experts: specifying constraints in CSS directly (HL). This topic concentrates on specifying constraints in an external file.
In the CSS file, you can write:
GraphLayout {
    graphLayout          : "Hierarchical";
    constraintsURL       : "url(Constraints.txt)";
}
This means that the layout constraints are specified in a separate file named Constraints.txt . This file contains the constraint in a very simple format, for example:
SameLevelConstraint {
  firstNode: node2
  secondNode: node5
}
RelativeLevelConstraint {
  lowerSubject: { node5 }
  higherSubject: { node9 }
  priority: 50.0
}
LevelRangeConstraint {
  subject: { node11, node12 }
  minLevel: 3
  maxLevel: 4
}
The complete example can be found at:
The style files are in the subdirectory data . The example shows how to specify constraints by loading an external file as well as how to specify constraints by writing style rules directly.