Skip to content
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

Structured Activity Types - specifically: Loop Node #3044

Open
nomisge opened this issue Jan 22, 2024 · 1 comment
Open

Structured Activity Types - specifically: Loop Node #3044

nomisge opened this issue Jan 22, 2024 · 1 comment
Labels
feature A new feature

Comments

@nomisge
Copy link

nomisge commented Jan 22, 2024

Is your feature request related to a problem?

I would like to create an activity diagram containing a 'for each loop'.
I would like my students to translate an idea given by the activity diagram into e.g. python code. There the loop would look like for obj in my_list: ...
I haven't found a good way to do this in gaphor yet.

Describe the solution you'd like

I would like gaphor to support 'structured activity types'. There seem to be several:
https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_domains/loop_and_conditional_nodes.html

In my case I would like to have a 'loop node'. A more elaborate example is given at:
https://stackoverflow.com/questions/15792687/loop-in-uml-activity-diagram-using-a-region

It probably is best to have a single structured activity type, where you can toggle up to three partitions (setup, test, body). Like within a class diagram, where you can toggle attributes and operations.

Describe alternatives you've considered

For regular loops I could use simple flow and decision nodes (https://www.softwareideas.net/uml-activity-diagram-loop),
but I wouldn't know how to express a for-each loop nicely with that.

What are your thoughts about that?
Is this easy to implement (happy to help, any way I can)?
Did I miss something and my goal can already be reached somehow?

@amolenaar
Copy link
Member

Hi @nomisge, thank you for your request. We need to implement a bit.

It would be much appreciated if you can help out. In short:

  1. Set up a development environment.
  2. Implement the necessary bits from the UML 2.5 spec (Structured Actions) (search for "LoopNode").
  3. Generate the model (poe uml).
  4. Create a LoopNodeItem in gaphor/UML/actions and add it to the toolbox.
  5. Have a look at the docs for features to implement (e.g. grouping).

To unstuck you, for now you can get away with defining a stereotype and apply that to an action:

image

A bit of CSS will make sure the line is properly dashes:

action[appliedStereotype.classifier.name="loop"] {
 dash-style: 11 5;
 justify-content: start;
}

loop.gaphor.zip

@amolenaar amolenaar added the feature A new feature label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

No branches or pull requests

2 participants