change the figure of an edit part [message #242571] |
Mon, 28 April 2008 08:54 |
Eclipse User |
|
|
|
Originally posted by: wirth.ase.jku.at
Hi, my GEF-based editor should get another type of view. Thus, I added
some switch-functionality to my editparts' createFigure method to create
the currect type of view, based on the current state of the model. When I
start the editor this i working just great.
I just have one problem: I want to change this state during runtime. Thus,
the editpart would need to remove its view and create another one, without
the hierarchy of the model and/or the editpart itself having changed (i.e.
just one boolean changed in the model).
Of course, this would be possible if I removed the old model-object and
created a new one. Then the parent editpart would take care of creating a
new editpart and a new view (in AbstractEditPart.refreshChildren). As i do
not change the model itself (don't add or remove anything) but just change
some variable inside one object, this is obviously not working.
I would need to tell the parent of the current editpart to recreate the
child's view. My last idea was to overwrite
AbstractEditPart.refreshChildren and add functionality to change the view,
but: "This method should not be overridden."
Is there a suggested way to do what I want?
Thanks in advance,
Christian Wirth
|
|
|
Re: change the figure of an edit part [message #242628 is a reply to message #242571] |
Wed, 30 April 2008 01:45 |
Xiang Qinxian Messages: 119 Registered: July 2009 |
Senior Member |
|
|
Hi,
Christian Wirth 写道:
> Hi, my GEF-based editor should get another type of view. Thus, I added
> some switch-functionality to my editparts' createFigure method to create
> the currect type of view, based on the current state of the model. When
> I start the editor this i working just great.
>
> I just have one problem: I want to change this state during runtime.
> Thus, the editpart would need to remove its view and create another one,
> without the hierarchy of the model and/or the editpart itself having
> changed (i.e. just one boolean changed in the model).
>
> Of course, this would be possible if I removed the old model-object and
> created a new one. Then the parent editpart would take care of creating
> a new editpart and a new view (in AbstractEditPart.refreshChildren). As
> i do not change the model itself (don't add or remove anything) but just
> change some variable inside one object, this is obviously not working.
>
> I would need to tell the parent of the current editpart to recreate the
> child's view. My last idea was to overwrite
> AbstractEditPart.refreshChildren and add functionality to change the
> view, but: "This method should not be overridden."
It means, at most case:) NO problems If you ensure your childpart right
processed. ex. change ZOrder need reorder children.
>
> Is there a suggested way to do what I want?
>
> Thanks in advance, Christian Wirth
>
Yes, refreshChildren is an option.
And Figure self is an option too.
And refreshVisuals too, same like figure style.
Cheers,
Qinxian
|
|
|
Powered by
FUDForum. Page generated in 0.02923 seconds