Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: davidson on August 28, 2016, 12:54:56 pm

Title: Dependency and Custom departments not working
Post by: davidson on August 28, 2016, 12:54:56 pm
I think Sparx EA is an incredibly good tool, and I recommend it to all my clients, but this is an example of how incredibly frustrating it is to get value out of the documentation, and I also notice other commentaries on this.

I am trying to shapescript a UML component in 12.1, to give me a list of dependencies as a separate compartment as per the example on this link.

I have tried and tried and tried and cannot get this to work.

I have cut and pasted the code and pasted it into the target shape script, and still no response. I've refreshed the screen etc. after I loaded and no change whatsoever.

Does this work or not? if it works WHAT ADDITIONAL THINGS DO WE NEED TO DO MR SPARX?


http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/building_models/add_custom_compartments_to_ele.html
shape RelatedElement

{

     //Check if the current connector we are processing has a

     //dependency type.

     if(HasProperty("Connector.Type", "Dependency"))

     {

          //Check if the element we are currently checking is

          //the target of the current connector.

          if(HasProperty("Element.IsTarget"))

          {

               //Set the compartment Name

               SetCompartmentName("dependsOn");

               if(HasProperty("Element.Stereotype", ""))

               {

               }

               else

               {

                    AppendCompartmentText("«#Element.Stereotype#»");

               }

               AppendCompartmentText("#Element.Name#");

          }

     }

}
Title: Re: Exhibit "A", your honour
Post by: DavidM on August 28, 2016, 03:16:19 pm
Can I suggest you use
http://www.sparxsystems.com.au/resources/user-guides/modeling/mdg-technologies.pdf?

Everything about MDG in 1 place.
But in summary, you may have to change your feature visibilities
Title: Re: Exhibit "A", your honour
Post by: davidson on August 28, 2016, 05:29:32 pm
No - I tried that already. It all works as should when you use embedded elements, but the RelatedElements seems to work totally random.

Some time the "dependsOn" title for example comes up when you assign a note to it, sometimes it is the actual other element name with a number. Sometimes when you delete a note link, save it, reload it, the note works again, but allocate the note link again and it dissapears.

I have never got the actual representation to work on the element, even with the features, sometimes the notes link works sometimes it doesn't.

Title: Re: Exhibit "A", your honour
Post by: DavidM on August 28, 2016, 08:16:47 pm
Hi - Sorry I stand corrected, you are right.
It is very random for me also.

Even thought all the features are set on, I tried showing the dependent elements in a compartment, just no show.
Also I tried it with the notes, some results, sometimes it worked, sometimes a number, very random.

I am guessing this is raised as a defect somewhere as it is a feature that is not working?

I'm sure this used to work though.
The embedded features and compartments work ok, its is only the RelatedElements.

No testing before release?
Title: Re: Exhibit "A", your honour
Post by: qwerty on August 28, 2016, 09:13:09 pm
I also could not get this to work. The RelatedElement is rather new. So my guess is, that it just does not work and you need to report a bug. Sparx obviously lacks a test department and anything new goes out for testing to users. We call that banana software: ripens at the customer's site.

q.

P.S. Your subject rather sounds like spam so I did not look into this the first place.
Title: Re: Dependency and Custom departments not working
Post by: davidson on August 29, 2016, 06:24:29 am
Hi Qwerty,
Thanks for your confirmation, I am assuming the process for raising a bug is through the appropriate forum?

It's a shame as I spent a lot of time on this thinking there was something I was doing wrong, and we are just kicking of a project which depends on these features being available.

I changed the title - hope it suites ;-)
Title: Re: Dependency and Custom departments not working
Post by: Glassboy on August 29, 2016, 07:18:21 am
These are user forums, not the place for reporting bugs.  There is a link to the bug submission page in the description of the Bugs and Issues board.
Title: Re: Dependency and Custom departments not working
Post by: Eve on August 29, 2016, 09:18:39 am
Have the compartments been enabled? From memory related element compartments are disabled by default. (ie. a technology author can provide the option, that the technology user can then choose to enable)
Title: Re: Dependency and Custom departments not working
Post by: davidson on August 29, 2016, 06:51:43 pm
Hi Simon,
Thanks for responding.

I'm not too sure what you mean - If you are talking about enabling features etc. on the element for dependencies and realized items then yes, that has been done.

Otherwise can you please clarify?
Title: Re: Dependency and Custom departments not working
Post by: qwerty on August 29, 2016, 07:40:51 pm
I also don't understand what "compartments enabled" would mean. Where can this be turned on/off?

@davidson: Report a bug using the link bottom right in the support section of this page. This is just a user forum.

q.
Title: Re: Dependency and Custom departments not working
Post by: Eve on August 30, 2016, 08:44:09 am
Individual compartments can be enabled or disabled in both the diagram properties and the feature visibility dialog for individual elements.

So if your shape script defines three different relationships compartment types that would be displayed for an element, both those dialogs will add three checkboxes allowing a user to display them individually.
Title: Re: Dependency and Custom departments not working
Post by: DavidM on August 30, 2016, 12:46:33 pm
Hi Simon,
Yes I tried these and no change.
Can you confirm if you have got this to work in 12.1 - If I know it works, I shall  perservere, if you identify it as a bug however, I will give up.

Thanks or the feedback.
Title: Re: Dependency and Custom departments not working
Post by: qwerty on August 30, 2016, 07:29:44 pm
Still I don't see how to en-/disable the compartment for the RelatedElements in any properties dialog.

q.
Title: Re: Dependency and Custom departments not working
Post by: RoyC on August 31, 2016, 12:31:33 pm
Either:
Title: Re: Dependency and Custom departments not working
Post by: KP on August 31, 2016, 01:50:15 pm
Note that the checkboxes won't show for a custom compartment if there is nothing to display in it. So for a related elements compartment, you may need to remove one of the related elements from the current diagram
Title: Re: Dependency and Custom departments not working
Post by: Eve on September 01, 2016, 08:17:09 am
What does the shape script look like?
Title: Re: Dependency and Custom departments not working
Post by: qwerty on September 01, 2016, 09:11:38 am
It's exactly that from the help (see also first post).

q.
Title: Re: Dependency and Custom departments not working
Post by: KP on September 01, 2016, 09:34:59 am
I just got this to work, so I'll retrace my steps. (Note, I'm using EA 13 so the instructions will be for the ribbon interface not the menu).

Drop a class on a diagram. Double-click to open its properties and give it a stereotype, one that doesn't already exist. Click OK. From ribbon, Configure|Reference Data|UML Types and select the stereotype, click the "Shape Script" radio button and click Assign. Paste the shape from the first post in this thread into the shape script editor. Click OK, Save, Close. Drop another element onto the diagram and drag a dependency from the stereotyped class to the new element. Remove the new element from the diagram. Save the diagram. Reload diagram. Select the stereotyped class and press Ctrl+Shift+Y. The checkbox "Dependson" will have appeared under Show Element Compartments. Tick it and click OK.
Title: Re: Dependency and Custom departments not working
Post by: qwerty on September 01, 2016, 07:11:13 pm
There we are. The DependsOn only appears in V13, not in V12.

q.

P.S. As we already grabble in bug box:
a) When I remove the dependency, the shape still states "Depends On". I need to close/open the diagram.
b) Depends On is wrong in this context. It implies that the class showing this text depends on another class. But actually it's vice versa and the other class depends on this one.
Title: Re: Dependency and Custom departments not working
Post by: Giu Platania on June 20, 2019, 02:42:31 am
I know this is an old discussion, however I'm trying to implement the element dependency shape script
https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/add_custom_compartments_to_ele.html
and this is not working

version 14.1.1429 the checkbox Dependson is not present in a steretyped class created  following those instractions:
I just got this to work, so I'll retrace my steps. (Note, I'm using EA 13 so the instructions will be for the ribbon interface not the menu).

Drop a class on a diagram. Double-click to open its properties and give it a stereotype, one that doesn't already exist. Click OK. From ribbon, Configure|Reference Data|UML Types and select the stereotype, click the "Shape Script" radio button and click Assign. Paste the shape from the first post in this thread into the shape script editor. Click OK, Save, Close. Drop another element onto the diagram and drag a dependency from the stereotyped class to the new element. Remove the new element from the diagram. Save the diagram. Reload diagram. Select the stereotyped class and press Ctrl+Shift+Y. The checkbox "Dependson" will have appeared under Show Element Compartments. Tick it and click OK.