Book a Demo

Author Topic: Include a table/matrix in diagram  (Read 11154 times)

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Include a table/matrix in diagram
« on: May 16, 2013, 11:36:34 pm »
I would like to present certain relationships in a diagram as a table/matrix, either inside the same diagram or dedicated diagram or as some kind of listview. Is this possible in EA?

A table like this:

Information      |  Sender         |   Target            |  ....
Incident report         Servicedesk     Serviceboard  

I'm aware how to access the information through script, but not how to generate a table like this inside an EA diagram.

The "list view" is close but don't show the information I need.

Any thoughts?

Thank you for the help!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #1 on: May 16, 2013, 11:40:42 pm »
Either you create a matrix swimlane and place the info manually inside the grid. Or you create an image of it externally and place the image inside EA.

q.

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #2 on: May 16, 2013, 11:55:16 pm »
The matrix idea could work. Is it possible to create those through scripts?

Can only find Swimlane as part of a diagram object.

Is there any documentation of the EA objects accessable by the script engine? The sample scripts aren't really enough here ...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #3 on: May 17, 2013, 12:21:54 am »
I haven't really used it, but there is a SwimlaneDef attribute for diagrams. I guess you need to define horizontal and vertical swimlanes (the GUI offers a matrix, but i guess this is mapped to h/v swimlanes).

q.

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #4 on: May 17, 2013, 12:57:53 am »
I managed to access swimlanes, but it seems the matrices are hidden somewhere else. They don't show up as a swimlane class and I can't find anything in the object model which hints where the matrices are.

Have emailed Sparx for information about this.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #5 on: May 17, 2013, 06:28:49 am »
The swimlanes in diagrams are no model elements, but diagram attributes. If you need model elements choose Partitions.

q.

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #6 on: May 17, 2013, 08:44:26 pm »
Thank you for the input. Tho, I got another idea, perhaps much simpler.

Is it possible to create Notes or Text elements by scripts? I could live with using those.

I have found how to read and write to Note-elements. But what attribute makes a note-element to a note? It has no stereotype for example..

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #7 on: May 17, 2013, 10:02:08 pm »
Use Package.Elements.AddNew ("", "Note");

You may supply a name as first parameter, but it's almost never used by anybody.

You should place the note directly in a diagram (via DiagramObject) since you get a zombie element else.

q.
« Last Edit: May 17, 2013, 10:03:56 pm by qwerty »

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #8 on: May 17, 2013, 10:35:44 pm »
Great! Thank you!

I feel kinda silly when it was that simple. I could have sworn that I tried that.

I guess I was fooled by thinking the second parameter to AddNew had to be a stereotype, and when I checked the stereotype of a Note it returned an empty string.

Thank you again.
« Last Edit: May 17, 2013, 10:36:15 pm by Sorno »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #9 on: May 17, 2013, 10:47:42 pm »
A look into my Scripting book would have helped in that case :-)

q.

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #10 on: May 21, 2013, 05:07:14 pm »
I finally did manage something.

Is there anyway to generate tables in notes? I noticed that it parsed some richtext tags like <b>, why I tried, to no avail, a html table.

For the moment I solved it by calculating the width of the longest string for each column and then add the right amount if blankspace to every other string to get even columns. It feels like an ugly way to do it, but at least it looks like a table.

But this "solution" requires the usage of a monospace font like courier... so my followup question is: Is it possible to set the font of an element by script? In the reference it seems that it's only possible to change color and borders.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #11 on: May 21, 2013, 06:43:57 pm »
Look at Repository.GetFieldFromFormat and GetFormatFromField.

However, EA does not support formatted tables in notes. Except you like ASCII art.

q.
« Last Edit: May 21, 2013, 06:45:01 pm by qwerty »

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Include a table/matrix in diagram
« Reply #12 on: May 23, 2013, 09:03:14 pm »
Regarding creation of a matrix, Sparx have responded:

"The Swimlane matrix is unrelated to the swimlanes (despite being in the same dialog). So the automation support is only for the swimlanes not the matrix.

I will submit this internally as a feature request. "

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Include a table/matrix in diagram
« Reply #13 on: May 23, 2013, 09:56:34 pm »
Thanks for the update. Seems you will have to find some work around...

q.