Book a Demo

Author Topic: Swimlanes  (Read 4570 times)

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Swimlanes
« on: August 27, 2011, 03:33:25 am »
Hi everyone,

Is there a possibility to create a swimlane by Jscript?



OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Swimlanes
« Reply #1 on: August 30, 2011, 07:44:53 pm »
Do you mean lane/pool in BPMN etc ? In which case have a look under View -> Scripting....under the Local Scripts you will find a JScript - Manage Elements Example. Pools and Lanes in this context are just elements and can be managed as such. Not sure however how they are managed in a UML sequence diagram by EA. Ill have to dig a little...

Regards,

Jon.

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Swimlanes
« Reply #2 on: August 30, 2011, 11:18:03 pm »
It is interesting to me how can I place swimlanes on the diagram by means of a JScript/VBScript?
The example of swimlanes is located below:



Thanks.
« Last Edit: September 01, 2011, 02:43:13 am by 666999 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Swimlanes
« Reply #3 on: August 31, 2011, 08:40:20 am »
Look for Diagram.SwimlaneDef.

skrauss

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Swimlanes
« Reply #4 on: September 01, 2011, 12:54:27 am »
I have created a script to create automatically some swimlanes on a diagram. But you have to open the swimlines dialog to reflect the changes.

option explicit

!INC Local Scripts.EAConstants-VBScript

'
' This code has been included from the default Diagram Script template.
' If you wish to modify this template, it is located in the Config\Script Templates
' directory of your EA install path.
'
' Script Name: Create swimlanes for Model Driven RE
' Author:      Sven Stefan Krauss
'                  Curtiss-Wright Antriebstechnik GmbH
' Purpose:     Creat swimlines on a diagram
' Date:        01.07.2011
'
' Current issue:
' You have to open the swimlines dialog to show the results.
' Any ideas?
'
' Diagram Script main function
'
sub OnDiagramScript()

      ' Get a reference to the current diagram
      dim currentDiagram as EA.Diagram
      set currentDiagram = Repository.GetCurrentDiagram()

      if not currentDiagram is nothing then
            ' Get a reference to any selected connector/objects
            dim selectedConnector as EA.Connector
            dim selectedObjects as EA.Collection
            set selectedConnector = currentDiagram.SelectedConnector
            set selectedObjects = currentDiagram.SelectedObjects

            Repository.EnsureOutputVisible("Script")
            Repository.ClearOutput("Script")
            Session.Output currentDiagram.Name
            Session.Output "Creating Swimlane: Customer Requirements..."
            currentDiagram.SwimlaneDef.Swimlanes.Add "Customer Requirements",200
            Session.Output "Creating Swimlane: Components..."
            currentDiagram.SwimlaneDef.Swimlanes.Add "Components",100
            Session.Output "Creating Swimlane: Design Concept..."
            currentDiagram.SwimlaneDef.Swimlanes.Add "Design Concept",100
            Session.Output "Creating Swimlane: Verfication..."
            currentDiagram.SwimlaneDef.Swimlanes.Add "Verfication",100
            Session.Output "Creating Swimlane: Child Requirements..."
            currentDiagram.SwimlaneDef.Swimlanes.Add "Child Requirements",100
            currentDiagram.Update()

            if not selectedConnector is nothing then
                  ' A connector is selected
            elseif not selectedObjects.Count > 0 then
                  ' One or more diagram objects are selected
            else

                  ' Nothing is selected
                  
            end if
      else
            Session.Prompt "This script requires a diagram to be visible", promptOK
      end if

end sub

OnDiagramScript

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Swimlanes
« Reply #5 on: September 01, 2011, 01:50:40 am »
Thanks.
To update swimlanes it is necessary to use the following code:
Code: [Select]
dim currentDiagramID
...
currentDiagram.Update()
currentDiagramID = currentDiagram.DiagramID
Repository.ReloadDiagram(currentDiagramID)
...
« Last Edit: September 01, 2011, 07:50:57 am by 666999 »