The Create Style Rule wizard simplifies the
definition of data rules which can include attribute conditions.
To open the Create Style Rule wizard, choose Edit>Create Style Rule or right-click
a rule and choose Create Style Rule in the pop-up menu.
Whenever you create (or change) a style
rule, a Welcome page displays. If you do not want to see it open
each time, clear the box Show Welcome page at the lower left of the
page. Following the Welcome page, the Conditions page displays,
where you can define the conditions of the rule. See the following
figure:
![diada_conditions16.png](../../JViews_Diagrammer/usrcompdiag/_media/diada_conditions16_default.png)
The Conditions page
Node and link rules
In the Conditions page, the style rule
name will be automatically computed from the conditions that you
define in the pane below. You can however customize this name by
clearing the Generated Name option and typing your preferred name
in the text field. Another option is to rename a rule in the
Style Rules tree: right-click the rule and select Rename in the
pop-up menu. Please note that you can at any time switch back to
the generated name by checking the Generated Name box.
Conditions
You can define conditions for user-defined
types, states, and attributes:
- User-defined type: the object subtype to which the rule will apply, according to the types defined in your data model.
- State: the runtime state to which the rule will apply: selected, expanded, collapsed, in the legend, or level of detail (high, medium, or low). Expanded, and collapsed can only apply to nodes.
- Attribute: the name of an attribute of the object in your data model, for which a specific value is tested.
You can set a more or less restrictive
rule by adding more or less conditions. The plus sign (+) allows
you to add a condition. The minus sign (-) removes the
corresponding condition. The more conditions a rule has, the more
it is specific and the higher its priority.
An attribute condition tests one or more
attributes against a value. If you select an attribute, you must
then set a condition on its value by selecting an operator from
the second drop-down list and entering a value. You can set
several attribute conditions.
The operator drop-down list reflects the type of the attribute:
integer, real or string. For integer or real attributes, the
operator menu offers
equals
,
does not equal
,
greater than
,
greater than or equal to
,
less than
,
less than or equal to
. For string attributes, the operator menu offers
equals
,
does not equal
,
contains
. You can also simply test the presence of an attribute in the
data model (
exists and not null
).
Viewing the data model in the style rule wizards
The Create Style Rule Wizard and the
Change Style Rule Wizard both display a table view of the data
model in the Nodes and Links tabs of the Conditions page. The
tables show the property names and the current value for each
property, on separate tabs for nodes and links.
![diada_datamodelwiz17.png](../../JViews_Diagrammer/usrcompdiag/_media/diada_datamodelwiz17_default.png)
A table view of the data model in a
style rule wizard
When you create or change rules in one of
these wizards, you can view the data properties and values that
you can use to set conditions by selecting the Nodes or Links
tabs.