Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ja1234 on November 10, 2015, 09:17:39 pm
-
Hi,
Sparx offers a nice visual detail in the TreeView, after connecting with an external solution, for example C#
(http://i.imgur.com/nGbSJob.png?1)
Would it be possible to add the same type of marker (an image at the corner) for an element?
Also, in the diagrams, I know it is possible to change the color of an element, by defining a stereotype and altering color, but is it possible to add an image at the corner, for an existing element?
What I am looking for is a way to define an image file that will display at the corner of elements in the treeview and in the diagrams.
Looking forward to your answers.
-
The closest thing you could do is create your own stereotypes in a UML profile, and link an icon to the stereotype.
This icon will then be used both in the project browser as in the toolbox.
Geert
-
The closest thing you could do is create your own stereotypes in a UML profile, and link an icon to the stereotype.
This icon will then be used both in the project browser as in the toolbox.
Geert
Thanks Geert. I do know how to create a stereotype in the UML profile, but I am not sure hwo I can link the icon to the stereotype. How to do that?
-
The closest thing you could do is create your own stereotypes in a UML profile, and link an icon to the stereotype.
This icon will then be used both in the project browser as in the toolbox.
Geert
The icon can be shown in toolboxes, but it does not appear in the project browser. How can that be managed?
q.
-
The closest thing you could do is create your own stereotypes in a UML profile, and link an icon to the stereotype.
This icon will then be used both in the project browser as in the toolbox.
Geert
The icon can be shown in toolboxes, but it does not appear in the project browser. How can that be managed?
q.
Oh dear - didn't you just release a book on how to write MDG Technologies? ;D
Anyway, I can't recall having done this with packages, but it certainly works with elements. Check the help page Extending UML Models -- MDG Technology SDK -- MDG Technologies - Creating -- Create Toolbox Profiles -- Assign Icons To Toolbox Items.
If you extend the «metaclass» ToolboxItemImage, only the toolbox icon is affected. But if you use an "icon" attribute, both the toolbox and the project browser icons are affected.
BUT all that gives you is a different, but fixed, icon. There is no way to create an overlay of the type EA can place on packages.
Back to the OP, you can add an image to a shape script, and you can set a toolbox / project browser icon.
You could set different images in a shape script depending on some condition the script can evaluate (eg the element's status), which would give you a kind of overlay-type function, but that will only work in diagrams because the icon is fixed and not part of the shape script.
Cheers,
/Uffe
-
Oh dear - didn't you just release a book on how to write MDG Technologies? ;D
Well, yes. And the icon will (as I said) appear in the toolbox. But not in the project browser. So again: how to achieve that?
q.
-
Oh dear - didn't you just release a book on how to write MDG Technologies? ;D
Well, yes. And the icon will (as I said) appear in the toolbox. But not in the project browser. So again: how to achieve that?
q.
My Icons appear in both the toolbox as the project browser.
You have to set them on the stereotype in your UML profile.
I use the profile helper so I don't have to remember all the funny attribute names.
There's a note somewhere that says that if you add the icon, that you also have to fill in in the Metatype. If you don't it doesn't work (silently of course)
The trick to getting good icons is to make a .bmp of 16x16 pixels, and use color C0C0C0 (192,192,192) as the "transparent" background.
Geert
-
Very strange. I do not see them in the project browser but only in the toolbox. Seems I need to dig into this even more.
q.
P.S. I even have added the _icon attribute to the stereotype and its metaclass but still i see only a class icon rather than my own. It only appears in the toolbar. Help!
-
I too have experience this problem
I tracked it down to my Icon graphics program saving the bitmap as 32 bpp
I resaved my icon using 16 bpp and it worked.
Specifically, the Icon editor I use is Pixelformer, and my design is export as
Format A1:R5:G5:B5 (16bpp)
Which works just fine
Just for information the other formats available in Pixelformer are
A4:R4:G4:B4 (16bpp)
A8:R8:G8:B8 (32bpp)
Have not tied the other 16bpp setting but for sure the 32bpp setting does not work
Try saving the Icon bitmap as 16bpp and see if it makes any difference.
Phil
-
P.S. I even have added the _icon attribute
There's your problem.
This particular special attribute must not have the underscore prefix. It must be named "icon", not "_icon".
Its value is the file path to the icon file, Windows-style, plain text, no double backslashes or anything like that.
And it goes on the «stereotype» class, not the «metaclass» class.
/U
-
I use Paint.net for my icons.
It worked just fine with the default settings when saving as .bmp
Geert
-
This particular special attribute must not have the underscore prefix. It must be named "icon", not "_icon".
It was a typo in the post. Actually I have used it without the underscore. (The use of underscores in these properties obviously follows a rule that was first created by a kangaroo hopping over a switchboard.)
I have cross checked with the 16 bit (it was, and I used Pixelformer to create a new copy). But still no luck:
(https://dl.dropboxusercontent.com/u/66691423/pic%202015-11-25%20um%2012.16.33.PNG)
As you can see the toolbox shows the icon, but the browser does not.
q.
-
There must be something wrong with the way you define the stereotype.
Can you post an image of the Bike stereotype you used?
Geert
-
It looks like this: (https://dl.dropboxusercontent.com/u/66691423/pic%202015-11-25%20um%2017.59.54.PNG)
Note that I added the icon to the metaclass later as test. It did not change anything.
And here my toolbox: (https://dl.dropboxusercontent.com/u/66691423/pic%202015-11-25%20um%2023.11.13.PNG)
q.
-
There's a note somewhere that says that if you add the icon, that you also have to fill in in the Metatype. If you don't it doesn't work (silently of course)
This
-
There's a note somewhere that says that if you add the icon, that you also have to fill in in the Metatype. If you don't it doesn't work (silently of course)
This
Indeed, and if you do that you don't even have to define an icon on the toolbox profile.
It will automatically use the icon from the stereotype.
Geert
-
So can anyone tell me as to where I have to add [highlight]Icon[/highlight] and where not? I first had it just in the ToolBoxItemImage (which showed it in the toolbox). Then I tried adding it to metaclass and later even to the stereotype. I AM CONFUSED.
q.
-
The «stereotype» class must have two attributes: Icon and _metatype. That's all.
You can also add Icon attribute to the stereotype that extends ToolboxItemImage in the toolbox profile, but you will probably only need to for hidden submenus or patterns.
-
Aaahhh! Thank you! I'll have to try that tomorrow.
q.
-
Finally I got it to work. It's not only that you need to add _metatype. Moreover it must be unique. I first tried with _metatype=Class but that did not work (my instinct in finding traps does not always help). Once I defined _metatype=Bike the icon did appear. Thanks to all!
q.