Skip to main content



      Home
Home » Eclipse Projects » GEF » Design question
Design question [message #86819] Fri, 11 July 2003 14:48 Go to next message
Eclipse UserFriend
Originally posted by: rahul.dhar.intel.com

I'm trying to design my application so my figure cannot access my my model
or editparts. However, my figure has to get some of its parameters from
the information stored in my model. Is there a way to provide this
information without having to pass in my model as a parameter?
Unfortunately, enumerating each parameter would make the code a pain to
read/maintain.

Thanks,
-Rahul
Re: Design question [message #86831 is a reply to message #86819] Fri, 11 July 2003 15:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.com

Hi,

"Rahul Dhar" <rahul.dhar@intel.com> wrote in message
news:ben0q3$c50$1@eclipse.org...

> or editparts. However, my figure has to get some of its parameters from
> the information stored in my model. Is there a way to provide this
> information without having to pass in my model as a parameter?

The suggested way is to overwrite EditPart#refreshVisuals. This is the right
place where you should configure your figure according to the model. But you
have to call this method every time changes are made inside the model (e.g.
by a command).

> Unfortunately, enumerating each parameter would make the code a pain to
> read/maintain.

Well, although model elements should never be passed to figures it might be
possible to let them implement an interface (something like
IMyFigureConfiguration) and have a method in your figure
MyFigure#initializeFrom(IMyFigureConfiguration config). This is probably
better than doing a hundret times
MyFigure#setFigureProperty(MyModel#getModelProperty()).

Cu, Gunnar
Re: Design question [message #86902 is a reply to message #86831] Fri, 11 July 2003 17:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rahul.dhar.intel.com

Gunnar Wagenknecht wrote:

> Hi,

> "Rahul Dhar" <rahul.dhar@intel.com> wrote in message
> news:ben0q3$c50$1@eclipse.org...

> > or editparts. However, my figure has to get some of its parameters from
> > the information stored in my model. Is there a way to provide this
> > information without having to pass in my model as a parameter?

> The suggested way is to overwrite EditPart#refreshVisuals. This is the right
> place where you should configure your figure according to the model. But you
> have to call this method every time changes are made inside the model (e.g.
> by a command).

This seems to make the most sense. When is refreshVisuals called? Do I
have to set listeners to trigger it? Is there any documentation detailing
this stuff? I'm rather lost at the moment?

-Rahul
Re: Design question [message #86917 is a reply to message #86902] Fri, 11 July 2003 17:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.com

"Rahul Dhar" <rahul.dhar@intel.com> wrote in message
news:ben8uc$lhe$1@eclipse.org...

> This seems to make the most sense. When is refreshVisuals called? Do I
> have to set listeners to trigger it? Is there any documentation detailing
> this stuff? I'm rather lost at the moment?

It is called the first time by GEF. All other times it has be called by you.

The regular way is the following:

your EditPart listens to the model for changes
if your EditPart receives a change event from the model it checks, wheather
the changed property might cause an updated to the figure
if yes, call #refreshVisuals

Cu, Gunnar
Re: Design question [message #86932 is a reply to message #86917] Fri, 11 July 2003 17:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rahul.dhar.intel.com

Gunnar Wagenknecht wrote:

> "Rahul Dhar" <rahul.dhar@intel.com> wrote in message
> news:ben8uc$lhe$1@eclipse.org...

> > This seems to make the most sense. When is refreshVisuals called? Do I
> > have to set listeners to trigger it? Is there any documentation detailing
> > this stuff? I'm rather lost at the moment?

> It is called the first time by GEF. All other times it has be called by you.

> The regular way is the following:

> your EditPart listens to the model for changes
> if your EditPart receives a change event from the model it checks, wheather
> the changed property might cause an updated to the figure
> if yes, call #refreshVisuals

So, what's the order of calls when an EditPart is created?
is it

Constructor
createFigure (if available)
refreshVisuals

or am I completely off base?

-Rahul
Re: Design question [message #86946 is a reply to message #86932] Fri, 11 July 2003 18:05 Go to previous message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.com

"Rahul Dhar" <rahul.dhar@intel.com> wrote in message
news:ben9tc$md6$1@eclipse.org...

> Constructor

mostly called by your EditPartFactory

> createFigure (if available)
> refreshVisuals

createFigure is called the first time someone called getFigure, so it is
save for you to call getFigure inside refeshVisuals

Cu, Gunnar
Previous Topic:programmatically opening GraphicalEditor
Next Topic:tracking tool activate in palette-less applications
Goto Forum:
  


Current Time: Mon Jul 14 00:21:00 EDT 2025

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

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

Back to the top