Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: medina on February 03, 2012, 07:21:33 pm

Title: List the attributes of the element
Post by: medina on February 03, 2012, 07:21:33 pm
I was wondering how I can make a stereotype list the attributes it contains. I have looked in shape script but can't find anything, or is it something i need to add in the profiles diagram for my MDG?. Would really appreciate the help!
Title: Re: List the attributes of the element
Post by: qwerty on February 03, 2012, 10:08:29 pm
Quote
make a stereotype list the attributes it contains
Ehrm - what?

q.
Title: Re: List the attributes of the element
Post by: medina on February 03, 2012, 10:43:24 pm
sorry i meant that i have made a stereotype and this stereotype has attributes that i have added. And i want these attributes to show as a list in this stereotype. Like this image
 
http://www.sparxsystems.com/enterprise_architect_user_guide/images/importtablesdiagram.png
Title: Re: List the attributes of the element
Post by: Geert Bellekens on February 03, 2012, 11:07:27 pm
(meta) attributes on stereotypes will result in tagged values in on the actual elements.

Geert
Title: Re: List the attributes of the element
Post by: qwerty on February 03, 2012, 11:25:46 pm
Quote
sorry i meant that i have made a stereotype and this stereotype has attributes that i have added. And i want these attributes to show as a list in this stereotype. Like this image
 
http://www.sparxsystems.com/enterprise_architect_user_guide/images/importtablesdiagram.png
Geert is right. If you want some kind of default attributes to appear then you need to either use templates (I haven't really used that yet). Or you write an addin which catches element creation and adds attributes.

q.
Title: Re: List the attributes of the element
Post by: medina on February 08, 2012, 02:02:35 am
Hi

No, I do not want to make default attributes automatically to be added to the element.

I just want the Attribute Compartment to be made visible. So if the user adds an attribute, then the attribute (and its value) is to be shown in the compartment - as in this picture.
(http://www.sparxsystems.com/uml_tool_guide/images/class.png))

I'v tried to add the styleex and pdata (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/attribute_values___stylex__pda.htm) to the Diagram Profile (HideAtts=0;) but the attribute compartment still doesn't show in the element, (as in the picture above).
 
I've also turned on (=1) all the _Attxxx listed on Supported Attributes (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/supportedattributes_2.htm)

Maybe it has something to do with the Shape Script?
Using the example on Example Scripts (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/example_scripts.htm)
Code: [Select]
shape main {
       rectangle(0,0,100,100);
       addsubshape("namecompartment", 100, 20);
       addsubshape("stereotypecompartment", 100, 40);
       shape namecompartment {
               h_align = "center";
               editablefield = "name";
               rectangle(0,0,100,100);
               println("name: #name#");

       }
       shape stereotypecompartment {
               h_align = "center";
               editablefield = "stereotype";
               rectangle(0,0,100,100);
               println("stereotype: #stereotype#");
       }
}

with all the avail properties listed in Display Element Properties (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/displaying_element_properties.htm)

I STILL cannot make attributes visible on the element.

Please help


[size=18]tl;dr[/size]
I'm looking for something like
[size=15]println("attribute: #ATTRIBUTE# #ATTRIBUTE.NAME# #ATTRIBUTE.VALUE#");[/size]
Title: Re: List the attributes of the element
Post by: qwerty on February 08, 2012, 02:49:32 am
Check your diagram properties and turn on attribue visibility.

q.
Title: Re: List the attributes of the element
Post by: medina on February 08, 2012, 04:16:11 am
I've done that. No luck.

I'm pretty sure(?) it's a shape script problem.
(hence the pseudo example... println("attribute: #ATTRIBUTE# #ATTRIBUTE.NAME# #ATTRIBUTE.VALUE#"))

Since using the "default" UML-Class element is working ("working"=showing its attributes as in the picture above) in my diagram but my own made element does not (even thou it HAS attributes).

So what is the Shape Script code for the Class element? anyone?
Title: Re: List the attributes of the element
Post by: qwerty on February 08, 2012, 05:07:36 am
A shape script is define only and only for classes with stereotypes since the shape script itself is part of the stereotype. Check Settings/UML/Stereotypes for any shape scripts.

q.
Title: Re: List the attributes of the element
Post by: KP on February 08, 2012, 08:46:48 am
It is a limitation of shape scripts that you cannot list an element's attributes or operations.