In addition to the general rules for renderers, you can write
specific rules to customize the behavior of a renderer on a
per-object basis through rendering
properties. Rendering properties can be seen as additional
properties of the graphic objects which you can set to tell a
renderer how it should handle a particular object.
For example, the
GraphLayout
renderer defines a rendering property called
Fixed
. When this property is set to
true
, the
GraphLayout
renderer will keep the position of the object unchanged. The
following code example shows a style rule that sets the
Fixed
property.
Customizing the layout of a type of node
node.participant { shapeType : "Ellipse"; Fixed : "true"; }
This rule says that the nodes of type
participant
must not be moved when a graph
layout is applied. As you can see, you can mix “real” properties
of graphic objects (such as
shapeType
) with rendering properties (such as
Fixed
).
Important
By convention, most rendering properties
start with an uppercase letter, whereas the properties of graphic
objects start with a lowercase letter.
The following predefined renderers do not
have rendering properties:
- Coloring
- Decoration
- LabelLayout
- Legend
If a rendering property conflicts with a graphic object property
(which should generally not happen), you can use the pseudo-class
construct to restrict a rule to a specified renderer. As an
example, suppose you have written a custom graphic object which
also has a property called
Fixed
. The following code example shows a style rule which specifies
that the property is to be set only in the renderer (not in the
custom graphic object).
Setting a renderer property for a graphic
object
node.participant:renderer { Fixed : "true"; }
The pseudo-class
renderer
is interpreted as the renderer which has the property called
Fixed
.
The pseudo-class specification can also be the name of the renderer
with an initial lowercase letter, for example,
graphLayoutRenderer
.