1 node with 2 possible icons [message #197782] |
Thu, 17 July 2008 15:06 |
Eclipse User |
|
|
|
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 |
Simon Bernard Messages: 345 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 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02598 seconds