Author Topic: Instanciate Stereotyped Class as object  (Read 7477 times)

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Instanciate Stereotyped Class as object
« on: September 15, 2024, 10:08:22 am »
Hello all,

I'm setting a customized MDG techno for office management with classes based stereotypes.  For example, I created an Event element embedding a EventType Tagged Value (Meeting, Interview, Appointment, Seminary and so on)

As it works fine when I drag it from my Toolbox to an empty stereotyped diag (thx Phil Chudley) I wonder if that would be possible to  instanciate this Event stereotype not as classe but as an object (maybe onto another stereotyped object diagram ?) that would easily represent each occurence of event.

I feel that setting the TV would be an issue....
Will I need to step back and build each event type as a stereotype


Thank you for your help

Eric

 

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Instanciate Stereotyped Class as object
« Reply #1 on: September 16, 2024, 07:11:39 pm »
Eric,

You should probably create another stereotype for an eventType instance. You can then add the tagged values that are relevant for the instance on that stereotype.
On the EventType stereotype you can indicate which stereotype is to be used for instances.

Geert

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #2 on: September 17, 2024, 10:37:36 pm »
Hi Geert  and one more time thank you for you time !

Quote
You should probably create another stereotype for an eventType instance
Does it means that my toolbox would propose EventTime and EventTimeInstance icons ?

Quote
On the EventType stereotype you can indicate which stereotype is to be used for instances.

Unfortunately, I don't master more than that P.Chudley shows in its Getting the best out of an MDG video
:(

Finally solution seems not linked to diagram's types or properties. But, when you drag a class onto a diagram,what makes it show or not a window to choose between a  link or instance ?

Eric

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Instanciate Stereotyped Class as object
« Reply #3 on: September 17, 2024, 11:06:48 pm »
Does it means that my toolbox would propose EventTime and EventTimeInstance icons ?
Depends on what you put on your toolbox. You could leave only EventTime, and create the instances by dragging an existing EvenTime element on the diagram (holding Ctrl if needed)

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #4 on: September 18, 2024, 07:20:43 am »
You can control which element is intanciated via a profile property. Currently offline, but it's one of the "_" properties. (_instance or so...)

q.

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #5 on: September 19, 2024, 08:44:41 am »
Thank you two !

@Geert: Ctrl+Drag seems clean but I actually I get metaclass icon instead of stereotype one :(
@qwerty : I suppose that's a diagram property... I'll check it out but I'm afraid I'll then get the same glitch (default object icon)

So my work is not over if I want to get both class and object



qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #6 on: September 20, 2024, 07:08:33 am »
It's _instanceType (not sure about case sensitivity, but that's how it' in our profile). Assign the initial value the metatype you want it to be on instantiation. As always it's a lot of trial  and error with EA. The help is also a bit helpless, but more than nothing: https://sparxsystems.com/enterprise_architect_user_guide/17.0/modeling_frameworks/defining_behavior_on_creating_.html

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Instanciate Stereotyped Class as object
« Reply #7 on: September 20, 2024, 03:49:18 pm »
You can set that using the profile helper as well. No chance of typing it wrong.
In fact you can set almost any property using the profile helper. Only a few exceptions.

Geert

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #8 on: September 22, 2024, 09:29:49 am »
Hello and thank you two,

I experimented _instanceType property by setting its value to _metatype value defined for my stereotype  (I hope to be clear...). Drag'n Drop an element from the browser window let me opt an instance of my stereotyped class. But then:
1. I don't catch the difference (aspect and behavior) with creating many times stereotyped elements :

EventType1.Date=date1, EventType2.Date=date2, EventType3.Date=date3...
vs
date1:EventType1, date2:EventType1, date3.EventType1...
(not sure I'm still clear :-[ )

2. There is no visual difference unlike Standard UML profile that underlines name and sets to blue each instance's background.

What I was first expecting was to drag'n drop my stereotyped element directly from a Toolbox (maybe in a  specifically configured diagram's stereotype)  to instantly get a recolored instance of it, pre-fixed with <instance_name> and post-fixed with:<Element_name>

...Thx for reading  :)

Eric

« Last Edit: September 22, 2024, 09:32:11 am by elr »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #9 on: September 22, 2024, 07:23:32 pm »
Yes, not sure what your issue is. However, if you ctrl-drag from the toolbox, EA asks you whether you want to create the element or its instance. Without the ctrl it's kind of game what EA does. (for me it's obvious and I eventually delete the new element, redoing it with the ctrl)

q.

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #10 on: September 23, 2024, 02:33:48 am »
Hi qwerty,

In my case, D'nD and Ctrl+D'nD from Toolbox do exactly the same :(  It places an exemplary  (instance ?) of the element I chose, with an incremented serial number.

https://sparxsystems.com/forums/smf/index.php?topic=37874.0

Maybe my answer could come from recovering this feature...
 ???

Eric




Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8064
  • Karma: +118/-20
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #11 on: September 23, 2024, 09:32:42 am »
In my case, D'nD and Ctrl+D'nD from Toolbox do exactly the same
I think there's been a bit of a mix-up. The Ctrl+Drag function is available when dragging an element from the Browser, not from the Toolbox.

If you want to create the instance, put the instance type on your toolbox.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #12 on: September 23, 2024, 06:42:35 pm »
That's right. I'm no longer a permant EA user and remembered it wrongly.

q.

elr

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Instanciate Stereotyped Class as object
« Reply #13 on: September 24, 2024, 09:51:52 pm »
Thank you Eve !
and no problem, qwerty.  I suspected the mix-up, but the thread I referred, made it as well..
:)

Eric