Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to refresh a Figure and all its child Figures?
How to refresh a Figure and all its child Figures? [message #221395] Sat, 12 August 2006 05:59 Go to next message
Eclipse UserFriend
Originally posted by: zouzhile.gmail.com

Hi, I am facing such a problem: I am generating my draw2D diagram from a
set of models, when the model change, i want to refresh all the figures.
This means also refreshing the parent/child relationship to refect of
the underlying model changes. suppose the top container figure is
topFigure, I called the repaint() method on it, but the diagram didn't
change. so what is wrong or i missed something? do i have to override
the paint() method for each figure? and what happens when the repaint()
method is called? thanks in advance:)

Best Regards
Robin
Re: How to refresh a Figure and all its child Figures? [message #221412 is a reply to message #221395] Sun, 13 August 2006 00:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zouzhile.gmail.com

Robin Zou 写道:
> Hi, I am facing such a problem: I am generating my draw2D diagram from a
> set of models, when the model change, i want to refresh all the figures.
> This means also refreshing the parent/child relationship to refect of
> the underlying model changes. suppose the top container figure is
> topFigure, I called the repaint() method on it, but the diagram didn't
> change. so what is wrong or i missed something? do i have to override
> the paint() method for each figure? and what happens when the repaint()
> method is called? thanks in advance:)
>
> Best Regards
> Robin
Hi, the problem is solved. I keep a handle of the FigureCanvas where the
figures are drawn, every time the model changes, I just rebuild the
figure and then set the contents of the canvas to be the TopFigure
again, and at last redraw() the canvas. The code is like this:

public class TopContainerFigure extends FreeformLayeredPane
{
public TopContainerFigure(FigureCanvas canvas)
{
...
}

private void buildFigure()
{
...
}
public void refresh()
{
this.buildFigure();
canvas.setContents(this);
canvas.redraw();
}
)

Best Regards:)
Robin
Re: How to refresh a Figure and all its child Figures? [message #221460 is a reply to message #221412] Mon, 14 August 2006 18:25 Go to previous message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
Don't you just have to call invalidate/revalidate and the figure should
automatically reflect whatever in the changed model (as long as the
getModelChildren() returns the correct children)?

Nhu Le

Robin Zou wrote:
> Robin Zou 写道:
>> Hi, I am facing such a problem: I am generating my draw2D diagram from a
>> set of models, when the model change, i want to refresh all the figures.
>> This means also refreshing the parent/child relationship to refect of
>> the underlying model changes. suppose the top container figure is
>> topFigure, I called the repaint() method on it, but the diagram didn't
>> change. so what is wrong or i missed something? do i have to override
>> the paint() method for each figure? and what happens when the repaint()
>> method is called? thanks in advance:)
>>
>> Best Regards
>> Robin
> Hi, the problem is solved. I keep a handle of the FigureCanvas where the
> figures are drawn, every time the model changes, I just rebuild the
> figure and then set the contents of the canvas to be the TopFigure
> again, and at last redraw() the canvas. The code is like this:
>
> public class TopContainerFigure extends FreeformLayeredPane
> {
> public TopContainerFigure(FigureCanvas canvas)
> {
> ...
> }
>
> private void buildFigure()
> {
> ...
> }
> public void refresh()
> {
> this.buildFigure();
> canvas.setContents(this);
> canvas.redraw();
> }
> )
>
> Best Regards:)
> Robin
Previous Topic:Selection in a viewer
Next Topic:Save Problem
Goto Forum:
  


Current Time: Thu Apr 25 03:53:33 GMT 2024

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

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

Back to the top