UML 2 sequence diagram symbols in UMLet?

2k Views Asked by At

I would like to know if there is any possibility of representing the UML2 Boundary/Control/Entity symbols of a Sequence Diagram in UMLet ? (http://www.uml.org.cn/oobject/images/seq02.gif)

Do I have to write their java code myself or does it already exist somewhere ?

3

There are 3 best solutions below

0
On BEST ANSWER

This is the snippet I used to create a boundary symbol in UMLet. You can alter it as needed.

int h = height - textHeight() * textlines.size();
int radius = h/2;
drawCircle(width-radius, radius, radius);
drawLine(0, 10, 0, h-10);
drawLine(0, radius, width-h, radius);

int y = textHeight()+5;
for(String textline : textlines) {
    printCenter(textline, height-3);
}

Preview:

enter image description here

2
On

I am not sure whether you are referring to Sequence, or Sequence all-in-one.

While those new lifelines are not supported, you can easily add a custom element to the former. There is a nice and easy tutorial how to add a new element here http://www.umlet.com/ce/ce.htm

If you want to add it to the all-in-one, you would need to dive into the internals, since it would require also changes in the text parser.

0
On

So I sort of made some models based on Noah's own. It's far from being a professional thing, and is pretty dirty code, but it does the trick for some time, I guess. So if anyone ever gets the same problem as me before these symbols are better implemented in UMLet :

Entity :

int h = height - textHeight() * textlines.size();
int radius = h*2/5;
int w = radius*2 ;

double x = (width - w)/2 + radius ;
double y = h/10 + radius;

double x2 = x + radius/4 * Math.sqrt(3);
double y2 = y - radius/4 ;

drawCircle((int)x, (int) y, radius);
drawLine((int)x-radius , (int)y + radius  ,  (int) x+ radius, (int) y+radius);
drawLine((int)x - radius , (int) y - 2*radius  , (int) x + radius, (int) y - 2*radius);

for(String textline : textlines) {
    printCenter(textline, h);
}

Control :

    int h = height - textHeight() * textlines.size();
int radius = h*2/5;
int w = radius*2 ;

double x1 = (width - w)/2 + radius ;
double y1 = h/10;

double x2 = x1 + radius/4 * Math.sqrt(3);
double y2 = y1 - radius/4 ;

double x3 =  x1 +  radius/4 * Math.sqrt(3);
double y3 =  y1 + radius/4;

drawCircle((int)x1, (int) y1+radius, radius);
drawLine((int)x1, (int) y1 , (int)x2, (int)y2);
drawLine((int)x1, (int) y1 , (int)x3, (int)y3);

int y = textHeight()+5;

for(String textline : textlines) {
    printCenter(textline, h);
}