Book a Demo

Author Topic: Getter equivalent to SetAppearance() available?  (Read 3743 times)

Marcus Wieschalla

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Getter equivalent to SetAppearance() available?
« on: January 04, 2011, 11:18:01 pm »
Using the Automation Interface, you may set the appearance of an element (background color, font color, ...) with the SetAppearance() method.

Unfortunately, there is no getAppearance() function. Is there a way to read the appearance of an element?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getter equivalent to SetAppearance() available
« Reply #1 on: January 05, 2011, 12:09:59 am »
Have you tried Element.StyleEx? It ain't pretty, but I think this attribute contains all the appearance information.

Geert

Marcus Wieschalla

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Getter equivalent to SetAppearance() available
« Reply #2 on: January 05, 2011, 12:52:28 am »
Yes, I've tried that one because the background color can be found
in <UML:TaggedValue tag="style" value="BackColor=16763025; ... > when you export the package to an XMI file.

Unfortunately, Element.StyleEx is always empty ("").

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getter equivalent to SetAppearance() available
« Reply #3 on: January 05, 2011, 01:19:39 am »
Then it might be that the element itself doesn't have a default style, but only the DiagramObjects (representations of the Element on diagrams).
Try DiagramObject.Style in that case.

Geert

Marcus Wieschalla

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Getter equivalent to SetAppearance() available
« Reply #4 on: January 05, 2011, 03:25:27 am »
Thanks for the hint to DiagramObject.Style.

If I got you right, this would mean that I could only read the color of an element which has been placed on a diagram.

I haven't checked it but I guess that the color that I would get would be -1 for default unless I have changed the color of that particular diagram object. So I still wouldn't know the default background color. Please note that you may choose via Fill Color a particular color or Default Color.

What's more, I try to color elements before I place them into diagrams eventually. Elements themselves do have a default style. I can see it in the XMI export (see posting above) and I deduce it from the fact that I might place the same element into several diagrams, change the default background color and even place the element into a further diagram. All these diagram objects representing the element have the same color.

As we set the background color only via the Automation Interface according to the primary stereotype of each element, I've finally chosen the workaround of placing the RGB code in a tagged value "bgcolor".

When the external "refresh program" is executed, it determines the background color according to the primary stereotype and sets the background color only if the RGB code is different from the value in that tagged value "bgcolor". As I try to avoid concurrency conflicts, I don't want to reset the color of all elements again and again.

By the way, I wouldn't bother if "Synch Stereotype" refreshed not just the tagged values but also the default appearance. But that's another story...

Thanks again for your time.
Marcus
« Last Edit: January 05, 2011, 07:53:06 am by mwieschalla »