Usecase alias not available in rectangle?

+1 vote
asked May 24, 2014 in Bug by anonymous

LS,

I would expect the code below to generate two png's, each with an actor called "Alice" and a usecase called "Usecase N", inside a rectangle. However, actor and usecase in the first png are printed outside of the rectangle; in the second png they are drawn using their aliases and not recognized as actor and usecase resp. Also, the 'left to right direction' keywords are not honored.

I tried to 'classify' actor and use case inside the rectangles by enclosing them with ':' and '()' resp. That helped to draw them correctly in de second png, but they where still placed outside the rectangle.

I use plantuml version 7999 as a stand-alone jar. Any help is much appreciated.

@startuml
 
left to right direction
skinparam packageStyle rect
 
usecase (Usecase 1) as usecase1
usecase (Usecase 2) as usecase2
 
actor :Alice: as user
 
rectangle Test1 {
  user -> usecase1
}
 
newpage
left to right direction
skinparam packageStyle rect
 
rectangle Test2 {
  user -> usecase2
}
 
@enduml
 
Regards,
Willem.
commented Dec 15, 2017 by madeng
+1, I am having this issue in version v1.2017.15

was it solved in a new release?

2 Answers

0 votes
answered Jan 22, 2017 by xuju (140 points)

I got the same problem, defining usecases outside of the rectangle and then using their alias inside the rectangle generates usecases outside of the rectangle on the resulting image.

The only way I found for this to work is to just define the usecases inside the rectangle, but I really would like to be able to use the aliases inside the rectangle.

commented Jan 28, 2017 by anonymous
Thanks for you answer. Regards, Willem.
0 votes
answered Dec 15, 2017 by plantuml (295,000 points)

You can use the following diagram:

@startuml
left to right direction
skinparam packageStyle rect
 
rectangle Test1 {
actor :Alice: as user
usecase (Usecase 1) as usecase1
usecase (Usecase 2) as usecase2
  user -> usecase1
}
 
newpage
left to right direction
skinparam packageStyle rect
 
rectangle Test2 {
usecase (Usecase 1) as usecase1
usecase (Usecase 2) as usecase2
  user -> usecase2
}
 
@enduml

Is this what you are looking for ?

commented Dec 22, 2017 by Willem
I had hoped (if I remember correctly) to define the usecases and actor beforehand,  and then re-use them in rectangles. So to make the code more readable. But this will do nicely, thanks!
...