Book a Demo

Author Topic: ActivityPartition vertical in diagram - java api  (Read 8050 times)

Jeff Hyams

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
ActivityPartition vertical in diagram - java api
« on: January 20, 2015, 12:51:18 am »
I am using the java api to create a diagram.  I have an ActivityPartition and when I add it as a DiagramObject is shows up horizontal.  I would like to be able to automatically have it be vertical instead.  I can obviously change it through the UI, but I have not been able to figure out how to get the system to make it vertical through the java api.

Here is the psuedo code:

partitionElement = element.GetElements().AddNew("partition", "ActivityPartition");
diagram.GetDiagramObjects().AddNew(partitionElement.GetName(), "");

update/refresh/etc...

Is there an attribute or call I can make to have the system tell it to draw vertically instead of horizontally?

Thanks,

Jeff Hyams

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #1 on: January 20, 2015, 01:33:52 am »
You need to set
Code: [Select]
diagramobject.style="VPartition=1"(without having verified that since t_diagramobjects.ObjectStyle triggers it this way).

q.

Jeff Hyams

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #2 on: January 20, 2015, 01:44:03 am »
Thanks for the quick reply! This was exactly what I needed and it worked perfectly.

For reference, this is the call in java:

diagramObject.SetStyle("VPartition=1");

Is there documentation of the full available style settings somewhere?  

Thanks,

Jeff Hyams

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #3 on: January 20, 2015, 04:11:04 am »
The best you can get is probably my Inside book  :)

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: ActivityPartition vertical in diagram - java a
« Reply #4 on: January 21, 2015, 12:08:43 am »
Quote

diagramObject.SetStyle("VPartition=1");
Be careful with a call like that. You could overwrite existing style options.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #5 on: January 21, 2015, 12:37:25 am »
Well, the EA help states:
Quote
Write only (reading this value gives undefined results)
The style information for this object.
So I guess that =1 wiil make it vertically and =0 will turn it back to horizontally. There's an additional link on setting the style in the help which talks about that semi-colon style. But it's a bit absurd that you can't read the existing style values (except through our beloved trap door SQLQuery).

q.

Jeff Hyams

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #6 on: January 21, 2015, 12:39:55 am »
The web documentation for the Diagram object style has this note :

Write only (reading this value gives undefined results)

Is there a different way to set a single style value without messing up the existing ones, then?  What I have now works for my current problem, but I can see needing to use this in other places in my code.

qwerty,

I am all for books if there is one available send me a link.

Thanks,

Jeff Hyams

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #7 on: January 21, 2015, 05:35:20 am »
Just click the signature below my posts  :)

I'll see what happens with the style and post the results here.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #8 on: January 21, 2015, 05:46:00 am »
So: if you set diagramObject.style="" EA clears all settings. Unlike what the help says diagramObject.style returns the current settings as a semicolon-separated list (Roy, can you cross check this?). So you can check this and append the new value or remove it before assigning style once again.

q.

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: ActivityPartition vertical in diagram - java a
« Reply #9 on: January 21, 2015, 11:30:49 am »
Having taken advice, I have updated this table entry to read:

Read/Write
The style information for this object. Returns a semi-colon delimited string that defines the current style settings. Changing a value will completely overwrite the previously existing value, so caution is advised to avoid losing existing style information that you want to keep.


You should probably test this in a sandbox model to make sure it gives you the results you want, before you use it in your development or production systems.
Best Regards, Roy