-
-
Notifications
You must be signed in to change notification settings - Fork 216
Add trigger and action for State Machine transitions #3385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Code working, still has some comments. Previous versions of gaphor don't seem to be able load these models. Note that in `transition.py`, line 22 there is a mypy #type ignore
Also added spaces between trigger, guard and action, since they are hard to read in a proportional font.
So they do not conflict in the model.
State transition code is now up to date with the latest (model) changes in the main branch.
Hi @ghillebrand, You're definitely on the right track. The code looks okay. To fix the mypy issue, I moved some code around. Some other changes:
I was wondering if trigger and action should actually refer to exiting behaviors, such as a activity, state machine, and Interaction. Currently it's creating a new "Behavior" instance, with no relation to the rest of the model (Behavior should have been an abstract class in the model). |
Thank you :) That all makes sense. ITO the behaviour issue, the OP was happy if the trigger-guard-action could be displayed "properly", without too much methodology behind it. I certainly don't know/ use UML enough to begin to make a call on that! My goal is to create a new model type, higraph, which would heavily re-use the STM code, and this was an excellent project to get my head around how the bits of gaphor interact. I should open a feature request, yes? I will outline the steps as I see them, and be guided by you guys on how/ where to implement the various parts. |
You refer to this? The text positioning is mostly done automatic. The Text placement is the same for all lines/vertices. |
This PR looks good. So I'll merge it. |
Yes, this is what I meant, and this looks like the code I was looking for. Other tools write the text above the line. When I get a chance, I will play with the hinting values, and see how they behave/ influence things. Controlling text position I would like to be able to do for higraphs. |
Adds
trigger
andaction
to a State Transition Models, in addition toguard
, as per Issue #2845trigger and action associations have been added to the UML model Transition Class Diagram , and the code updated to edit and display these attributes as
trigger [guard] /action
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently, only
guard
text can be entered, which is displayed below the transition as[guard]
.Issue Number: #2845
What is the new behavior?
Now
trigger
andaction
can independently be entered in the properties dialog, and are displayed according to the UML spectrigger[guard]/action
on the transition. The text is below the transition, rather than above, which seems to be the UML preference for this.Does this PR introduce a breaking change?
This does not seem to be backwards compatible - models created with these changes do not open in older versions of gaphor. This seems to be related to the file loading code. On trying to open a model created with these changes, gaphor (2.25.1 under windows) does nothing - no error, no crash, no model or diagram displayed.
Other information
My first PR/ change, so if I have omitted/ mangled something, my apologies!