Customizing the diagram dynamically

Style Rules change the aspect of a node or link when one of the data properties attains a specific value. In Linking predefined interactors to parameters, you connected the state of a button to the @status data property.
To add dynamic customization to a diagram using the Designer, you will use a style rule to change the aspect of a node as the @status property changes, that is, when a user clicks a node:
  1. Open the diagram you created in Linking predefined interactors to parameters.
  2. Right-click node in the Style Rules pane and click Create Style Rule in the pop-up menu.
    diada_createstylerule7.png
    Create Style Rule command
    The Create Style Rule Wizard appears.
  3. In the Create Style Rule Wizard, click Next.
  4. In the Style Rule tab, set the following condition:
    status does not equal BUTTON_DOWN
    diada_interactorstylerule8.png
    Creating a new style rule
  5. Click Finish.
  6. Click Assign Symbol in the Styling Customizer.
    The Assign Symbol dialog opens.
  7. Select the Rectangular symbol.
    diada_assignsymbol9.png
    Assigning the rectangular symbol to the style rule
  8. Click Apply.
  9. Select the status does not equal BUTTON_DOWN rule in the Style Rules pane.
  10. Set the value of the push_state field in the Styling Customizer to @status for this rule.
You have created a style rule that ensures the normal node symbol is displayed when a node is not being pressed. To verify that this rule has been correctly applied, validate the CSS.
To validate the CSS:
  1. Right-click the status does not equal BUTTON_DOWN rule and select View in the pop-up menu.
    The View as CSS dialog appears.
    diada_viewascss10.png
    Viewing the CSS of a style rule
  2. When you have validated the CSS rule, click OK.
To display a different symbol when a node is pressed down:
  1. Right-click node in the Style Rules pane and select Create Style Rule in the pop-up menu.
    The Create Style Rule Wizard appears.
  2. Click Next.
  3. In the Style Rule tab, select status equals BUTTON_DOWN.
  4. Click Finish.
  5. Select the status equals BUTTON_DOWN rule in the Style Rules pane.
  6. Click the Assign symbol button in the Styling Customizer.
    The Assign Symbol dialog opens.
    diada_assignsymbolwindow11.png
    Assigning the Oval symbol to the style rule
  7. Select the Oval symbol.
  8. Click Apply.
  9. Set the value of the push_state field in the Styling Customizer to @status for this rule.
The symbol used to represent a node now changes when any of the nodes in the diagram is clicked.