Book a Demo

Author Topic: Customising with stereotypes  (Read 7398 times)

ronnie

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Customising with stereotypes
« on: December 11, 2005, 01:27:05 am »
I am playing with creating a set of stereotypes to create a profile for use with Alistair Cockburn's book "Writing Effective Use Cases"...

A couple of things initially:

When setting a custom-shape to a stereotype I would like to be able to either add an 'icon' in a corner or be able to specifiy where the text goes - I am adding sea, cloud, kite, clam and fish levels and would like to add a pictorial adornment to the use case.

I would like to be able to specify more of the formatting elements (specifically the border size)

Stereotypes for connectors don't allow any icon adornment, endings or customisation of the line colour, type and width.

Cheers,
Ronnie
Ronnie

thomaskilian

  • Guest
Re: Customising with stereotypes
« Reply #1 on: December 11, 2005, 05:13:29 am »
There's a new shape scripting feature with 6.0. That might help, although I haven't used it so far and I can't tell whether it will help realy.

ronnie

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: Customising with stereotypes
« Reply #2 on: December 11, 2005, 09:41:26 am »
I have started playing with that but haven't managed to get where I want with it - hence the post!
Ronnie

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Customising with stereotypes
« Reply #3 on: December 11, 2005, 02:41:42 pm »
at present it only works with classes.  Another thread somewhere http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1133996922 explains.

bruce
« Last Edit: December 11, 2005, 03:17:49 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Customising with stereotypes
« Reply #4 on: December 11, 2005, 03:38:21 pm »
Quote
When setting a custom-shape to a stereotype I would like to be able to either add an 'icon' in a corner

Search this forum for "decoration" (or click on my name and click "Show the last 10 posts for this person") and you'll find a shape script that shows how to do this. Unfortunately, decorations don't work for use cases yet, only classes and packages, but that should be sorted for build 781.

Quote
or be able to specifiy where the text goes - I am adding sea, cloud, kite, clam and fish levels and would like to add a pictorial adornment to the use case.


To specify text for a shape script, add a nested shape like this:
Code: [Select]

shape main
{
   layoutType = "border";

  // ...

   AddSubShape("name", "center");

   // ...

   text name
   {
          h_align = "center";
          PrintWrapped("#NAME#");
   }

   // ...
}



Quote
I would like to be able to specify more of the formatting elements (specifically the border size)

Stereotypes for connectors don't allow any icon adornment, endings or customisation of the line colour, type and width.


No adornments for connectors yet.

For the endings you will need a shape target and/or shape source shape. I'll see if I can dig out an example for you.

For connector line style, use the SetPen() command. First three arguments are RGB colour and the 4th is the line thickness. e.g.
Code: [Select]

Shape Main
{
   NoShadow = True;
   SetLineStyle("Dash");
   SetPen(255,0,0,3);    // triple-thickness red line
   LineTo(100,0);
}


Any more questions, please ask...
The Sparx Team
[email protected]

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Customising with stereotypes
« Reply #5 on: December 11, 2005, 08:20:14 pm »
Quote
For the endings you will need a shape target and/or shape source shape. I'll see if I can dig out an example for you.


My colleague AshK has just sent me the following example of a connector shape script (cheers Ash!):
Code: [Select]

shape source
{
   SetPen(255,0,0,0);
   SetFillColor(255,0,0);
   polygon(10,0,3,10, 180);
}

shape target
{
   SetPen(0,255,0,0);
   SetFillColor(0,255,0);
   polygon(10,0,3,10, 180);
}

shape main
{
   SetPen(0,0,255, 2);
   lineto(100,0);
}

HTH,

Neil

The Sparx Team
[email protected]

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Customising with stereotypes
« Reply #6 on: December 12, 2005, 12:22:53 am »
Hi Folks

This is a bit off topic, soz :-[ but am I right in thinking that an icon shape can be attatched to Packages, Classes, Operations and Attributes, Objects, Messages, Components and Nodes; irrespective of stereotypes.

I've just discovered ;D build / Debug / Deploy -  ::) thats so Rational Rose Realtime edition -  TAU and Rhapsody.

Be really cool to have 'Traffic Light' icons indicating compiler Errors and Warnings on the diagram elements.  I'm thinking code coverage and performance indicators.  Coloured snakes, squirming around diagrams, indicating threads of execution  ;D ; ::) all without the VS IDE I shall inform my superiors.

Stay tough
Kevin

ronnie

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: Customising with stereotypes
« Reply #7 on: December 12, 2005, 06:12:12 am »
Wow - what a lot of answers - all looking really graeat - looking forward to build 781 - not all connectors work with the line-ending script - specifically 'uses' which I am after customising for 'includes' and 'extends' - It definately works for 'associate' and 'generalise'.

One thing - with the text, how would I vertically center it? I have played with v_align and h_align and together they don't seem to work - and it stops wrapping!
The v_align seems to align the bottom of the bounding box to the center-line but the wrapping dissapears!
What is the secont parameter to addsubshape?

What would be cool is a converter from EMF to shape script...

Thanks
« Last Edit: December 12, 2005, 06:39:27 am by ronnie »
Ronnie

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Customising with stereotypes
« Reply #8 on: December 12, 2005, 03:32:33 pm »
Quote
What is the secont parameter to addsubshape?

If you set layoutType = "border" then the second parameter of addsubshape() is one of "N", "S", "E", "W" or "CENTER". The first four are the compass points which indicate the edge that you want to attach the sub shape to.

layoutType can also be set to "topbottom" or "leftright", in which case addsubshape() doesn't have a second parameter; shapes get added directly next to the previous one.

Note that you can have different layout types nested within each other. I have used a leftright subshape attached to the southern edge of a border subshape.

Quote
One thing - with the text, how would I vertically center it?
I'm not entirely sure of the best strategy. Maybe we need to introduce a function that returns the height of a text shape in the chosen font (allowing for wrapping onto multiple lines) and allow calculations using that value. That's probably one for the future. Until then, the best strategy I've found (for my tastes) is to have the text a set distance below the top of the shape. You can do this by having a "padding" sub shape and adding it to the top edge of the shape (layoutType being set to "border"):

Code: [Select]
AddSubShape("padding", "N");
AddSubShape("name", "CENTER");

// ...

shape padding
{
   preferredHeight=10;
}



Neil
« Last Edit: December 12, 2005, 03:59:27 pm by KP »
The Sparx Team
[email protected]

Takeshi K

  • EA User
  • **
  • Posts: 632
  • Karma: +43/-1
    • View Profile
    • Sparx Systems Japan
Re: Customising with stereotypes
« Reply #9 on: December 12, 2005, 06:13:40 pm »
Hello,

I make a sample UML profile for DFD by using information
in this thread.

You can write like this,


Please try if you are interested in writing DFD by EA.

http://www.sparxsystems.jp/bin/DFD.xml

--
t-kouno
--
t-kouno

ronnie

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: Customising with stereotypes
« Reply #10 on: December 13, 2005, 01:40:02 am »
KP, the v_align="center" almost works - but isn't quite and screws with the wrapping. It's like it's almost there!

Thanks for the explanations of parameters - I have a lot to play with now....

The padding works - but makes it really hard to have a lot of text fit into an ellipse - added some horizontal padding too which is helping - but really that vertical padding wants to be variable - I expected the values there to be percentages of size but they seem to be pixel or point or some fixes sizing!
« Last Edit: December 13, 2005, 01:46:57 am by ronnie »
Ronnie