Author Topic: shapescript example attributes compartment  (Read 831 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7737
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
shapescript example attributes compartment
« on: February 21, 2017, 05:22:22 pm »
Hi,

Does anyone has a shapescript example of how to make an attributes compartment, pretty much the same as in regular UML classes?

I checked my library, and the examples in the help, but I couldn't locate such an example.

Thanks

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5880
  • Karma: +71/-77
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: shapescript example attributes compartment
« Reply #1 on: February 21, 2017, 05:45:19 pm »
Hi Geert,

Based on my recent (and unhappy) experience with compartments, I don't think it's possible.

The compartment functionality relies on new level 0 shapes:
ChildElement
RelatedElement
to process the appropriate collections.

The SetCompartmentName() and AppendCompartmentText() statements can only be executed within one of those two shapes.

There is no FeaturedAttribute or FeaturedOperation shapes to process the appropriate collection.

As usual, Sparx has almost implemented the functionality we need.

Paolo  :(
« Last Edit: February 21, 2017, 05:54:45 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7737
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: shapescript example attributes compartment
« Reply #2 on: February 21, 2017, 07:28:19 pm »
Really, that would be seriously disappointing, especially since this is already implemented in the standard class shape (for which we don't have the code).

I guess an add-in call is the only solution then?

That of course makes things a lot complexer then it should be.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5880
  • Karma: +71/-77
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: shapescript example attributes compartment
« Reply #3 on: February 22, 2017, 10:37:54 am »
Yeah...

As I said, that's just my understanding.  But, given NO Sparxians or other users have contradicted, sounds like I got it.

As you say, shame.  I think part of the problem is that (as was revealed many years ago), the Sparx internal code uses an internal API, which is not available to us.   Consequently, they have to maintain two (non-identical) code bases.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2436
  • Karma: +29/-2
    • View Profile
Re: shapescript example attributes compartment
« Reply #4 on: February 22, 2017, 11:48:02 am »
But, given NO Sparxians or other users have contradicted, sounds like I got it.

Just a reminder that you can't assume anything from the absence of a reply from Sparx. This is a user forum.
The Sparx Team
support@sparxsystems.com

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5880
  • Karma: +71/-77
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: shapescript example attributes compartment
« Reply #5 on: February 22, 2017, 12:49:19 pm »
But, given NO Sparxians or other users have contradicted, sounds like I got it.

Just a reminder that you can't assume anything from the absence of a reply from Sparx. This is a user forum.
Hence the "or other users"

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7737
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: shapescript example attributes compartment
« Reply #6 on: February 22, 2017, 04:00:00 pm »
I asked Sparx support to be sure (and to not assume anything ;D)

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7737
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: shapescript example attributes compartment
« Reply #7 on: February 24, 2017, 03:41:31 pm »
Yep, turns out that this is simply not supported (yet).
The have logged a feature request on my behalf.
In the meantime I'll try to cobble something up with an add-in function. It won't be the same as an actual attributes compartment, but there should be little or no visual difference.

I'll update this thread when I have a solution.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5880
  • Karma: +71/-77
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: shapescript example attributes compartment
« Reply #8 on: February 24, 2017, 06:03:32 pm »
Yep, turns out that this is simply not supported (yet).
The have logged a feature request on my behalf.
In the meantime I'll try to cobble something up with an add-in function. It won't be the same as an actual attributes compartment, but there should be little or no visual difference.

I'll update this thread when I have a solution.

Geert
Does that (your cobbling) mean we might be able to create arbitrary compartments and fill them with arbitrary text?  (like we should have been able to do from day one?  ;)

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7737
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: shapescript example attributes compartment
« Reply #9 on: February 24, 2017, 07:59:14 pm »
Yep, turns out that this is simply not supported (yet).
The have logged a feature request on my behalf.
In the meantime I'll try to cobble something up with an add-in function. It won't be the same as an actual attributes compartment, but there should be little or no visual difference.

I'll update this thread when I have a solution.

Geert
Does that (your cobbling) mean we might be able to create arbitrary compartments and fill them with arbitrary text?  (like we should have been able to do from day one?  ;)
I hope so.
I'm also thinking about adding some "all purpose" operations in EA-Matic that can be used by for example shapescripts (or MDA templates?). That would allow me to write a script rather then add-in code to return the text needed by the shapescript.

Geert
Paolo

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6197
  • Karma: +47/-5
    • View Profile
Re: shapescript example attributes compartment
« Reply #10 on: March 06, 2017, 09:31:57 am »
Does that (your cobbling) mean we might be able to create arbitrary compartments and fill them with arbitrary text?  (like we should have been able to do from day one?  ;)
Add-in compartments have existed LONG before shape scripts got that capability. I don't generally recommend them because EA will call your add-in with EVERY draw. If you aren't extremely careful about caching everything it will turn your diagram rendering to the worst kind of sludge. Unfortunately, because EA doesn't know anything about the source of your information it needs to call the add-in every time.

http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/compartments_2.html

In contrast, because we have provided explicit situations for shape scripts to render a compartment, EA can handle the caching transparently for you.
Simon

support@sparxsystems.com