check [Solved] Unmask in a Sequence Diagram

1 week 3 days ago - 6 days 23 hours ago #4865 by Iorek
Hi everybody,

When in my Jython script I try to unmask two or more lifelines in a sequence diagram, like this:
...
seqDiagHandle = diagService.getDiagramHandle(seqDiag)
...
...
seqDiagHandle.unmask(lifeLine1, 0,0)
seqDiagHandle.unmask(lifeLine2, 500,100)
...


The lifelines are represented superimposed in the high left corner of the diagram, as if the x,y parameters were not taken into account.
The diagram is OK, however, and it is possible to drag them manually at the right place.

The Sequence Diagram is stereotyped as a SysMLSequenceDiagram. The same code as above works well with e.g. classes in a Class diagram.

Am I missing something?

Thanks,
Francesco

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

1 week 2 days ago #4867 by ebr
Dear Franscesco,

The mecanisms are not the same between Sequence Diagram and the other mainly because you can not unmask sequence diagram anywhere...
Please check the following code for your lifeLine unmasking
from org.eclipse.draw2d.geometry import Rectangle

interaction = session.getModel().createInteraction()
interaction.setOwner(elt)

diagram = session.getModel().createSequenceDiagram()
diagram.setOrigin(interaction)

lifeLine1 = session.getModel().createLifeline()  
lifeLine1.setOwner(interaction)

lifeLine2 = session.getModel().createLifeline()
lifeLine2.setOwner(interaction)

diagService = Modelio.getInstance().getDiagramService()

try :
  seqDiagHandle = diagService.getDiagramHandle(diagram)

  dgs = seqDiagHandle.getDiagramGraphics(lifeLine2)
  for dg2 in dgs:
    if isinstance(dg2,IDiagramNode):
      rect = Rectangle(300, 0, 300, 250);
      dg2.setBounds(rect);
    
  seqDiagHandle.save()
 
finally :   
  if seqDiagHandle :
    seqDiagHandle.close()
    seqDiagHandle = None
   
Modelio.getInstance().getEditionService().openEditor(diagram)

Hoping it helps.
EBR

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

1 week 2 days ago #4868 by Iorek
Thank you so much, ebr.
I included in my script the relevant lines from your example and now it works perfectly!

Thanks again,
Francesco

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

Moderators: tmaaabcdeebr
Time to create page: 0.026 seconds
^ Back to Top