Creating the FSA meta-model: Improving State appearance

The final step is to adapt the appearance of a state depending if it is initial or final. Let's add two booleans to the state entity for the user to specify if the current state is initial or final:  


Now, we will add two graphical contraints to modify the appearance depending if the new variables are set to true or to false. Go in the "state" entity appearance section, and modify it so it looks like that. (add two new objects, a circle and a line):  


Then, click on the constraint button and create a new constraint called "initialcheck" with the following code:  


Take notice that every object on the appearance canvas are mapped to a ID_Key variable named : (gf0, gf1, ...). The logic behind the "initialcheck" code is to hide the line graphical object (gf3) if the user did not set isInitial to true. So in your case, depending if you created the line or the circle first, you may have to modify the code to hide the correct graphical object. Create a second constraint for the final state with the following code:  


As you can see again, the circle graphical object is hided when isFinal=0 with the line self.gf2.setVisible(0)