Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » 1 node with 2 possible icons
1 node with 2 possible icons [message #197782] Thu, 17 July 2008 15:06 Go to next message
Eclipse UserFriend
Originally posted by: artur.c.ribeiro.criticalsoftware.com

Hello,

Some icon issue, can't figure out the correct solution:

:: what i want to do
I have a boolean atribute on a node. When the user changes this attribute,
the node icon should change aswell on the diagram editor.

:: what i have done
implemented handleNotification on the node editPart so i can handle the
attribute change and then change the icon.

:: Problems
- When the diagram is opened, the icons are all by default, so i have to
recalculate them :/
- When there is a node refresh, the icon is set to default :/ (didn't find
yet how to catch this event properly).

This comes to two questions, first if there is a better (and intended) way
to handle property changes (using handleNotification at the moment), and
second, is there a way to assign 2 icons to a node without having to handle
all refresh events and implement icons calculation on diagram opening?

Thank you,

Artur Ribeiro
Re: 1 node with 2 possible icons [message #197810 is a reply to message #197782] Thu, 17 July 2008 15:55 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 341
Registered: July 2009
Senior Member
hi,

I suppose your editpart has an refreshLabel() method in which the
labelIcon is refreshed by calling the getLabelIcon method.

So you must override the getLabelIcon to return the good icon depending
on the boolean attribute, and call the refreshLabel method in the
handleNotification when the value of this attribute is modified.

Simon

Artur Ribeiro a écrit :
> Hello,
>
> Some icon issue, can't figure out the correct solution:
>
> :: what i want to do
> I have a boolean atribute on a node. When the user changes this attribute,
> the node icon should change aswell on the diagram editor.
>
> :: what i have done
> implemented handleNotification on the node editPart so i can handle the
> attribute change and then change the icon.
>
> :: Problems
> - When the diagram is opened, the icons are all by default, so i have to
> recalculate them :/
> - When there is a node refresh, the icon is set to default :/ (didn't find
> yet how to catch this event properly).
>
> This comes to two questions, first if there is a better (and intended) way
> to handle property changes (using handleNotification at the moment), and
> second, is there a way to assign 2 icons to a node without having to handle
> all refresh events and implement icons calculation on diagram opening?
>
> Thank you,
>
> Artur Ribeiro
>
>
Re: 1 node with 2 possible icons [message #198126 is a reply to message #197810] Mon, 21 July 2008 16:48 Go to previous message
Eclipse UserFriend
Originally posted by: artur.c.ribeiro.criticalsoftware.com

Indeed, changed getLabelIcon on the class that extended CompartmentEditPart
and that fixed it.

Thank you,

Artur Ribeiro

"Simon Bernard" <simon.bernard@anyware-tech.com> wrote in message
news:g5nq25$v4m$1@build.eclipse.org...
> hi,
>
> I suppose your editpart has an refreshLabel() method in which the
> labelIcon is refreshed by calling the getLabelIcon method.
>
> So you must override the getLabelIcon to return the good icon depending on
> the boolean attribute, and call the refreshLabel method in the
> handleNotification when the value of this attribute is modified.
>
> Simon
>
> Artur Ribeiro a
Previous Topic:Blinking Effect for a ConnectionEditPart
Next Topic:eNotification
Goto Forum:
  


Current Time: Sat Jun 06 11:36:52 GMT 2020

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

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

Back to the top