file Property Pages

5 years 1 month ago #3495 by ebr
What do you mean by customized not only for tools but for commands?
You want to create, for example, a stereotyped class, unmask it into a diagram with a dedicated layout, am I right? This is possible by specifying a dedicated diagram style but in this case all classes (independently of the applied stereotype) will have the same graphical properties.
BTW What do you mean by the rounded shape?

Please Log in or Create an account to join the conversation.

5 years 1 month ago - 5 years 1 month ago #3497 by ua138
Let me illustrate better my concern.

1) When I create an "interface" using the command menu (see first image)



2) I can drag and drop the "interface" to any diagram and it will be displayed as an image (What I was referring to by rounded shape, see second image)





When doing this for my own stereotype. I have managed, thanks to you, to create the element and visualize it as an image when I create it from a tool (see third image)



But when I create my element from the command, and afterwards I drag and drop it to other diagram, the representation mode becomes "Simple" again and not "Image". Nevertheless, when I create an "Interface" from the command, wherever I drag and drop it it displays as in the second image.

How is this possible? What enables it to behave like that?

Thank you very much.
Attachments:

Please Log in or Create an account to join the conversation.

5 years 1 month ago #3502 by ebr
For this, you have to define your own diagram style.
A diagram style is a file defining our own graphical properties values for example I attahe the one used for SysML block diagram.

In order to use this feature you have to:
  1. register your custom style in the start of your module session with the following code
     Path mdaplugsPath = this.module.getConfiguration().getModuleResourcesPath();
    
            Modelio.getInstance()
            .getDiagramService()
            .registerStyle("sysml", "default",
                    new File(mdaplugsPath.resolve("res" + File.separator + "style" + File.separator + "sysml.style").toString()));
  2. set the style when you create a diagram
     IDiagramService ds = Modelio.getInstance().getDiagramService();
                    IDiagramHandle handler = ds.getDiagramHandle(diagram);
                    IDiagramDG dg = handler.getDiagramNode();
    
                    for (IStyleHandle style : ds.listStyles()){
                        if (style.getName().equals("sysml")){
                            dg.setStyle(style);
                            break;
                        }
                    }
    
                    handler.save();
                    handler.close();

Please Log in or Create an account to join the conversation.

5 years 3 weeks ago #3517 by ua138
Thank you very much for your response. I have been able to display the images with the styles. Nevertheless I still have some doubts:

1) I have two stereotypes with the metaclass "class". Is it possible, from the .style file to configure them to show one as "image" and the other as "structured"?

2) Is it possible to unmask automatically the relationships between elements in a diagram? How is this done? I have tried in the ".style" file DEPENDENCY_AUTOUNMASK=true but is not working.

3) How are colours represented in this .style file? I have tried "USECASE_FILLCOLOR=217,236,255" in the .style file but is not working. In the tool I have been successfully managed to use the fill color with the code you gave me.
if ((graph != null) && (graph.size() > 0) && (graph.get(0) instanceof IDiagramNode)){
            IDiagramNode dnode = (IDiagramNode)graph.get(0);                    
            dnode.setProperty("FILLCOLOR", "255,255,185");
            dnode.setProperty("FILLMODE", "SOLID");
            dnode.setProperty("LINECOLOR", "128,0,0");
        }


Thank you very much again.

Please Log in or Create an account to join the conversation.

4 years 9 months ago #3643 by ebr
See my response:
  1. No, that is not possible thanks to the .style file. It can only be done by implementing a new command for each stereotype
  2. If it is not possible in the style editor, it is not possible thanks to a .style file but it is still possible in Java
  3. The correct syntax should be USECASE_FILLCOLOR=217 236 255

Best,

EBR

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.357 seconds
^ Back to Top