Author Topic: Element sub-compartments  (Read 13569 times)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Element sub-compartments
« on: November 13, 2014, 01:04:56 pm »
Okie

So, I am trying to do two things:

1. Add a sub-compartment with some tagged values contained in it, and
2. Modify the existing attribute compartment to display some tagged values (belonging to my own custom attribute stereotype) alongside the standard attribute information.

If I can't modify the existing attribute compartment, then I want to add a new compartment with the required attribute information.

However, the sub-compartment method doesn't seem to work with either attributes or tagged values.

It appears (I could be wrong) that:

a) Custom compartments only work with child elements and
b) Attributes & tagged values are not treated as child elements.

All help appreciated.

Cheers :-)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element sub-compartments
« Reply #1 on: November 13, 2014, 08:54:27 pm »
You're talking about shape script, aren't you?

q.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Element sub-compartments
« Reply #2 on: November 14, 2014, 02:55:20 am »
Hey Q, yup I am!

I can copy the examples out of the user manual that adds a custom compartment for properties and it works.

I try to modify it for attributes or tagged values and I get zip.

Jays  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element sub-compartments
« Reply #3 on: November 14, 2014, 07:41:42 am »
In that case I have to confirm your above observation  :-/

Maybe you can create something using the add-in escape?

q.
« Last Edit: November 14, 2014, 07:42:38 am by qwerty »

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Element sub-compartments
« Reply #4 on: November 14, 2014, 08:04:26 am »
Ah, so I thought this was a simple case of gross stupidity on my part which is generally the most common cause of my problems with Sparx.

But if this is a genuine limitation, its a bloody BIG one!

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Element sub-compartments
« Reply #5 on: November 14, 2014, 08:05:29 am »
Oh, actuall Q.
Its there anyway I can change the appearance of the default attributes compartment?
I tried defining a shape script for my attribute stereotype, but it seemed to make no difference.

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Element sub-compartments
« Reply #6 on: November 14, 2014, 08:55:51 am »
The usual method is to define something new with a stereotype and an associated shape script.

This one draws a small, blue person, and includes a tagged value below it:

shape main
{      
      // Blue Person by Andy J;
      fixedAspectRatio = "true";
      setfillcolor(0,192,255); // (R,G,B)
      setpencolor(0,192,255);
      ellipse(70,-15,90,20);  // (x1,y1,x2,y2)
      rectangle(60,25,100,75);// (x1,y1,x2,y2)
      rectangle(70,75,90,110);
      setfillcolor(255,255,255);
      rectangle(80,75,82,110);
      rectangle(66,40,68,75);
      rectangle(92,40,94,75);
      setorigin("CENTER",0,0);
      println(" ");
      println(" ");
      println(" ");
      println(" ");
      println(" ");
      println("#NAME#");
      println("#TAG:Stakeholder Type#");
      println("<<#stereotype#>>");
}      
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element sub-compartments
« Reply #7 on: November 14, 2014, 11:00:56 am »
Yes, but it does not touch the attr/oper compartments in any way. They are rendered independently.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element sub-compartments
« Reply #8 on: November 14, 2014, 11:04:13 am »
Quote
Oh, actuall Q.
Its there anyway I can change the appearance of the default attributes compartment?
I tried defining a shape script for my attribute stereotype, but it seemed to make no difference.
To my knowledge there is no way to react to stereotyped attributes in a shape script. Except (as indicated) maybe with the add-in escape. But even that will likely not allow very much in the direction you'd like it to be, I guess. Shape Script IS limited. See one of the recent suggestions post. Maybe you should join there.

q.

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Element sub-compartments
« Reply #9 on: November 14, 2014, 11:13:42 am »
OK I'm confused.

You know you can display the "tagged values" compartment?

"Feature and Compartment Visibility"

"Show Element Compartments"

Put a tick in the "Tagged Values" box.

So, you can show tagged values on something that isn't controlled by a shape script, and you can show tagged values on something that IS controlled by a shape script.

What's missing?
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Element sub-compartments
« Reply #10 on: November 14, 2014, 11:19:31 am »
Hey there

What I want to do is render a compartment that contains both:

* Attributes, and
* The tagged values belonging to those attributes.

So if the attribute has an enumerated tagged value called "Importance" with values {High, Medium, Low} I would want to display as follows:

Attribute1 (High)
Attribute2 (Medium)
Attribute3 (Low)

But as yet I can't figure out how to do this.

Cheers  :)

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Element sub-compartments
« Reply #11 on: November 14, 2014, 11:22:12 am »
I see, (I think).

Normally I display those as separate things. ie:

Attribute Name:Attribute Name.

The second part of the name is the "type".

In this case the "type" is an enumerated list.

The enumeration can be displayed on the same diagram and associated to the class (or not) as you see fit.

Andy

Edited:

i.e. something like this:

« Last Edit: November 14, 2014, 11:35:19 am by novaphile »
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

Nabil

  • EA User
  • **
  • Posts: 147
  • Karma: +5/-2
    • View Profile
    • View My LinkedIn Profile Here
Re: Element sub-compartments
« Reply #12 on: November 17, 2014, 05:23:45 pm »
Hey Jason,

if you are interested to define Element Compartment via Addin, Refer this post in EA community

http://community.sparxsystems.com/community-resources/500-72showing-classifier-notes-in-a-custom-compartment

Regards,
Nabil
« Last Edit: November 17, 2014, 05:28:57 pm by nabilsparx »
Nabil

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element sub-compartments
« Reply #13 on: November 17, 2014, 05:37:19 pm »
Good point, Nabil. Seems this was already implemented in 9.3. Has passed my attention.

q.

Nabil

  • EA User
  • **
  • Posts: 147
  • Karma: +5/-2
    • View Profile
    • View My LinkedIn Profile Here
Re: Element sub-compartments
« Reply #14 on: November 17, 2014, 06:11:49 pm »
Thanks Q.

Regards,
Nabil
Nabil