Author Topic: Element marker in tree view  (Read 11979 times)

ja1234

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Element marker in tree view
« 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#


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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element marker in tree view
« Reply #1 on: November 10, 2015, 11:40:07 pm »
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

ja1234

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Element marker in tree view
« Reply #2 on: November 25, 2015, 01:47:09 am »
Quote
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?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element marker in tree view
« Reply #3 on: November 25, 2015, 03:24:56 am »
Quote
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.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Element marker in tree view
« Reply #4 on: November 25, 2015, 03:52:24 am »
Quote
Quote
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
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element marker in tree view
« Reply #5 on: November 25, 2015, 04:16:34 am »
Quote
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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element marker in tree view
« Reply #6 on: November 25, 2015, 06:07:39 am »
Quote
Quote
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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element marker in tree view
« Reply #7 on: November 25, 2015, 06:56:20 am »
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!
« Last Edit: November 25, 2015, 07:10:44 am by qwerty »

philchudley

  • EA User
  • **
  • Posts: 743
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Element marker in tree view
« Reply #8 on: November 25, 2015, 07:59:24 pm »
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
Models are great!
Correct models are even greater!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Element marker in tree view
« Reply #9 on: November 25, 2015, 08:24:08 pm »
Quote
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
My theories are always correct, just apply them to the right reality.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element marker in tree view
« Reply #10 on: November 25, 2015, 09:44:20 pm »
I use Paint.net for my icons.
It worked just fine with the default settings when saving as .bmp

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element marker in tree view
« Reply #11 on: November 25, 2015, 10:06:37 pm »
Quote
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:


As you can see the toolbox shows the icon, but the browser does not.

q.
« Last Edit: November 25, 2015, 10:23:41 pm by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element marker in tree view
« Reply #12 on: November 26, 2015, 03:54:15 am »
There must be something wrong with the way you define the stereotype.
Can you post an image of the Bike stereotype you used?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Element marker in tree view
« Reply #13 on: November 26, 2015, 04:00:56 am »
It looks like this:

Note that I added the icon to the metaclass later as test. It did not change anything.

And here my toolbox:

q.
« Last Edit: November 26, 2015, 09:12:39 am by qwerty »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Element marker in tree view
« Reply #14 on: November 26, 2015, 09:26:06 am »
Quote
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
The Sparx Team
[email protected]