Book a Demo

Author Topic: Shape scripts for connectors  (Read 3591 times)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Shape scripts for connectors
« on: July 31, 2014, 04:15:27 am »
I am trying to create a shape script for a connector that:

1. Overrides the line style of the extended class, and
2. Displays the alias of the stereotype.

#1 is easily done, so no problem there.
#2 is proving far more problematic.

If I write the following code, rather than getting the alias of the underlying stereotype, I get the alias of the invidual connector instead:

shape MiddleBottomLabel {
   println("<<#alias#>>");
}

So far, I have not found a way to access this property from the underlying stereotype. Is there a way or am I barking up the wrong tree?

Cheers

Jays  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape scripts for connectors
« Reply #1 on: July 31, 2014, 08:13:34 am »
Hmm. Did i miss something? What is an alias of a stereotype :-?

q.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Shape scripts for connectors
« Reply #2 on: July 31, 2014, 08:31:54 am »
Hey q

So, when you drag a stereotype onto the canvas, you are presented with the standard things to fill in, including:

* Name, and
* Alias.

If you accept the standard behaviour, then the Name displayed above the connector line.
However, I would like to substitute this with the Alias.

Cheers  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape scripts for connectors
« Reply #3 on: July 31, 2014, 06:49:28 pm »
Now I'm getting lost a bit more. First: you do not drag a stereotype, but a stereotyped element. The element has an alias. Second: in your OP you are talking about connectors.

q.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Shape scripts for connectors
« Reply #4 on: August 01, 2014, 03:11:25 am »
Ok sorry q

I thought I was explaining myself properly, but apparently not.
I will walk through it step by step.

* First I create a stereotype that has the Name "SomeConnector" and an Alias "MyConnector".
* I extend this stereotype from an "Association" meta class.

If I now build my MDG, when I draw an instance of connector the text that shows on the page along with the line is the name of the stereotype i.e. "SomeConnector".

But, what I want to have show is the Alias of the stereotype i.e. "MyConnector".

So I created a script that draws the line and then added the following lines of script which I hoped would achieve what I want:

shape MiddleBottomLabel {
   println("<<#alias#>>");
}

However, rather than displaying the alias of the stereotype I created in my MDG, it displays the alias of the individual instance of the connector I have just drawn, which is of course blank.

Hope that it clearer.

Cheers

Jays :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape scripts for connectors
« Reply #5 on: August 01, 2014, 04:12:25 am »
Well, now I see what you want :D But I can't give you an answer :'(

Just passing it on to the wise guys down under.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape scripts for connectors
« Reply #6 on: August 01, 2014, 09:01:01 am »
The alias isn't available when you are using a profile. My recommendation is to hard code the string