Change Figure dynamically [message #68280] |
Mon, 23 October 2006 17:57  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #68626 is a reply to message #68280] |
Tue, 24 October 2006 15:01  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.08223 seconds