In the Transforming symbols using parameters
section you were shown how to add intelligence to symbols with
parameters that represent changes in a real world situation.
A condition triggers an event in a symbol
whenever specific criteria are matched. The event provokes the
symbol to change its representation to display the parameter
change visually, for example, when the object is selected or when
a parameter has a specific value. As with parameters, a condition
can be bound to multiple objects in a symbol.
![diasym_conditionworkflow33.png](../../JViews_Diagrammer/usrsymboldiag/_media/diasym_conditionworkflow33_default.png)
The condition workflow
You will use conditions to show a state in the
basicprogressbar
symbol using a transformation. If progress is below a certain
percentage, the progress bar will be displayed in red.
To transform the basicprogressbar symbol:
-
Open the
basicprogressbar
symbol. -
Create a new Integer parameter,
problem
, with a default value of 35.For more information, see Creating a new parameter. -
Right-click the progressbar object in the Symbol Outline pane.
-
Select New Condition in the pop-up menu.The New Condition dialog box opens.
-
Use the lists in the For Symbols Where pane to set the condition to
progress is less than or equal to problem
.Setting a new conditionNoteA name for the condition is generated automatically. You can change this to a personalized name by deselecting Generated Name and typing a new name in the Condition Name field. -
Click OK.The new condition is added under the progressbar object in the Symbol Outline pane. The Styling Customizer displays the properties for this object when the condition is met.
-
Click the Paint tab.
-
Click the button to the right of the Fill paint field.The button to open the Paint EditorThe Paint Editor opens.
-
Select the RGBA tab in the Color tab.
-
Set the color to 255 (Red), 0 (Green), 51 (Blue).
-
Click Apply.The
basicprogressbar
symbol now changes color to show changes in progress. -
Test your symbol using the procedure explained in Testing your symbol to see the transformations.