Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Change Figure dynamically
Change Figure dynamically [message #68280] Mon, 23 October 2006 17:57 Go to next message
Eclipse UserFriend
Originally posted by: greenl.mot.com

Hi,

Suppose I am creating a diagram of Animals, I hope I can change the animal
presentation dynamically at runtime when user switch state of the animal.
E.g. Display an icon "Zzz..." associated to a figure when user switch the
state of the Animal from "eating" to "sleeping",

Further more, if user decide to change an animal from "Panda" to "Bear", I
can switch the figure type accordingly without breaking the existing
linkages of the figure (and domain model of course).

Any idea how this is implemented?

Thanks,
Green
Re: Change Figure dynamically [message #68357 is a reply to message #68280] Tue, 24 October 2006 03:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk.gmx.de

Green Law wrote:

> Hi,
>
> Suppose I am creating a diagram of Animals, I hope I can change the animal
> presentation dynamically at runtime when user switch state of the animal.
> E.g. Display an icon "Zzz..." associated to a figure when user switch the
> state of the Animal from "eating" to "sleeping",
>
> Further more, if user decide to change an animal from "Panda" to "Bear", I
> can switch the figure type accordingly without breaking the existing
> linkages of the figure (and domain model of course).
>
> Any idea how this is implemented?
>
> Thanks,
> Green

Given that all the animals (e.g. Pandas and bears) are of the same eClass
with only a different "animaltype" flag, you can override notifychanged in
the edit part and call some method on your customized figure setting some
flags on the figure (e.g. state: {eating,sleeping,walking,idle},
animaltype) and then calling refreshVisuals. In the figure you should
override the paint method and draw the different figures depending on the
flags.

But I do not know how you can achieve this if the animals are not of the
same eClass.
Re: Change Figure dynamically [message #68449 is a reply to message #68280] Tue, 24 October 2006 06:15 Go to previous messageGo to next message
Eclipse UserFriend
Hello Green,

Following request prevents you from doing it now: https://bugs.eclipse.org/bugs/show_bug.cgi?id=150257
Just wote for it.

-----------------
Alex Shatalin
Re: Change Figure dynamically [message #68626 is a reply to message #68280] Tue, 24 October 2006 15:01 Go to previous message
Eclipse UserFriend
Generally, these are two different cases and hence different methods should
be applied.

> E.g. Display an icon "Zzz..." associated to a figure when user switch the
> state of the Animal from "eating" to "sleeping",

this is kind of "object _state_ change" and might need tracking domain
attribute to update figure on change. GMF is not providing any support for
this.

> Further more, if user decide to change an animal from "Panda" to "Bear", I
> can switch the figure type accordingly without breaking the existing

This sounds like "object _kind_ change", and for different object
types/kinds you might want to use distinct NodeMappings.


Artem

"Green Law" <greenl@mot.com> wrote in message
news:ehjdss$4nm$1@utils.eclipse.org...
> Hi,
>
> Suppose I am creating a diagram of Animals, I hope I can change the animal
> presentation dynamically at runtime when user switch state of the animal.
> E.g. Display an icon "Zzz..." associated to a figure when user switch the
> state of the Animal from "eating" to "sleeping",
>
> Further more, if user decide to change an animal from "Panda" to "Bear", I
> can switch the figure type accordingly without breaking the existing
> linkages of the figure (and domain model of course).
>
> Any idea how this is implemented?
>
> Thanks,
> Green
>
Previous Topic:Strange differences to mindmap example: How to control layout?
Next Topic:How to decipher .gmfgen generation error messages?
Goto Forum:
  


Current Time: Fri Jul 18 00:49:49 EDT 2025

Powered by FUDForum. Page generated in 0.08223 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top