JViews Diagrammer style sheets

Styling in JViews Diagrammer involves the following constructs:
  • Style rules
  • Composite graphics
  • Backgrounds

JViews Diagrammer style rules

The StyleSheet renderer applies a style sheet to a data model. The style sheet contains style rules in CSS2 format that describe how the objects in the data model are displayed in the diagram.
A style rule consists of two parts:
  • The condition part called the selector applies to the data model, and is used for pattern-matching.
  • The action part called the declarations applies to the corresponding graphic objects, and is used for rendering.
When designing a notation, you create many style rules, each of them matching a particular case in the data model. You define rules that apply to objects represented as nodes, and rules that apply to objects represented as links.
The style rules are usually defined from the most generic to the most specific. The generic rules usually create the base symbol for each type of object. The more specific rules add new shapes, or change graphics properties for the symbol defined in the generic rule.
The style rules are also used to specify the options of a diagram. Such rules have no selector and the declarations customize the way the options operate.
The Designer for JViews Diagrammer is perfectly suited for creating style sheets that define the look-and-feel of diagrams. Within the Designer, styling takes place, but the CSS syntax is largely hidden: selectors are defined in a natural-language editor and declarations are defined by setting graphic properties through panels called Styling Customizers. The style sheet generated by the Designer can be loaded into your application at run time.
Composite graphics are used to create the symbols for your application.
The Composite Graphics capability consists of a set of classes that help you to combine simple graphic objects to build more complex graphic objects according to one of several possible composite layouts.
The composite layout declares the way additional elements are attached to the base shape of the composite graphics.
Composite graphics are designed to be used with style rules that define which elements are displayed and how according to data model conditions. For example, you can dynamically add an alarm icon to a symbol when the status property of a node is equal to alarm.
Composite graphics can be nested to reuse simpler symbols within more complex ones.
When the SDM engine parses the data model, it applies the style rules, and depending on which rules apply, it creates the composite graphics appropriately to display the nodes.
Ultimately, the composite graphics facility creates and deletes graphics objects in the grapher.
Here again, the Designer for JViews Diagrammer helps you to create composite graphics for your application.

Backgrounds and maps

For applications that require a geographic map as a background, you can install a map renderer on your diagram that uses the Rogue Wave JViews Maps for Defense facilities to read map formats—vector or raster—and to display nodes according to their latitude and longitude.