Book a Demo

Author Topic: Diagram swimlane orientation  (Read 6988 times)

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Diagram swimlane orientation
« on: August 10, 2017, 12:04:45 pm »
Hi there,

How can I add both horizontal and vertical swimlanes to a diagram?

Here is what I have so far:

    Dim heading As EA.Swimlane
    Set heading = testDiagram.SwimlaneDef.Swimlanes.Add("", 50)
    testDiagram.SwimlaneDef.Orientation = soHorizontal

But this will make all swimlanes in the diagram horizontal.
I want some to be vertical and some to be horizontal.

Thanks,
Rupert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Diagram swimlane orientation
« Reply #1 on: August 10, 2017, 02:53:02 pm »
Rupert,

You are changing it on diagram level, but you can also change it at diagramObject level.

Here's the code I use to change the Activitypartitions from Horizontal to vertical (or vice versa)

Code: [Select]
public void setOrientation(bool vertical)
{
string currentStyle = this.wrappedDiagramObject.Style.ToString();
string vPartitionValue;
vPartitionValue = vertical ? "1":"0";
this.wrappedDiagramObject.SetStyleEx("VPartition",vPartitionValue);
string styleAfter = this.wrappedDiagramObject.Style.ToString();
}

Geert

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Diagram swimlane orientation
« Reply #2 on: August 10, 2017, 03:51:06 pm »
Hi Geert,

Thanks for your replay.

I seem to be having a bot of trouble wih it:

Function setOrientation(d As EA.diagram, vertical As Boolean)
Dim diagramObjects As EA.Collection
Set diagramObjects = d.diagramObjects
Dim testDiagramObject As EA.diagramObject
Set testDiagramObject = diagramObjects.AddNew("Test", Swimlane)
testDiagramObject.Style = testDiagramObject.SetStyleEx("VPartition", vertical)
End Function

Can you see what I'm doing wrong?

Many thanks,
Rupert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Diagram swimlane orientation
« Reply #3 on: August 10, 2017, 04:04:58 pm »
You don't call the final Update.

SetStyleEx does not return anything.

q.
« Last Edit: August 10, 2017, 04:07:21 pm by qwerty »

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Diagram swimlane orientation
« Reply #4 on: August 11, 2017, 12:15:46 pm »
I changed it to match Geert's code more closely but I'm still not having any joy:

    Sub setOrientation(vertical As Boolean, tdo As EA.diagramObject)
    Dim currentStyle As String
    currentStyle = tdo.Style
    Dim vPartitionValue As String
    vPartitionValue = vertical
    tdo.SetStyleEx("VPartition",vPartitionValue)
    Dim styleafter As String
    styleafter = this.wrappedDiagramObject.Style
    End Sub

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Diagram swimlane orientation
« Reply #5 on: August 11, 2017, 05:50:22 pm »
You still dont call Update.

q.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Diagram swimlane orientation
« Reply #6 on: August 14, 2017, 10:26:04 am »
What qwerty means is that you need to call tdo.Update() in your code to commit your changes.