Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Model child, child editpart and child figure best practice
Model child, child editpart and child figure best practice [message #191002] Mon, 08 August 2005 09:39 Go to next message
Steve Jones is currently offline Steve JonesFriend
Messages: 95
Registered: July 2009
Member
Hi,

In my application I have model elements with associated editparts and
figures. These edit parts implement NodeEditPart and can be moved connected
etc in the normal way without any problem.

The model elements have children. I would like to represent these visually
as child figures (labels and icons and text fields typically) that are
children of the parent node figure. In order to get the desired visual
effect the layout of these child figures I will need to use nested
containers and several types of layout manager. A typical SWT layout
exercise.

My concern is that this nesting breaks the one-to-one MVC pattern the is at
the core of GEF. In many cases my child figures will have parent containers
that are not the node figure.

I can see two possible approaches. I could overload the node edit parts
addChildVisual() method and drill down through the containers to find the
correct figure in which to add the child or I could introduce "dummy" model
elements and edit parts that represent the containers I need to use in the
layout of the real children.

I'm not sure of the possible side effects of the first approach and the
second seems to be very messy.

Any ideas on how best to approach this would be very mush appreciated.

Thanks Steve.
Re: Model child, child editpart and child figure best practice [message #191654 is a reply to message #191002] Wed, 10 August 2005 18:10 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

"Steve Jones" <steve@istech.demon.co.uk> wrote in message
news:dd798j$mj$1@news.eclipse.org...
> Hi,
>
> In my application I have model elements with associated editparts and
> figures. These edit parts implement NodeEditPart and can be moved
connected
> etc in the normal way without any problem.
>
> The model elements have children. I would like to represent these visually
> as child figures (labels and icons and text fields typically) that are
> children of the parent node figure. In order to get the desired visual
> effect the layout of these child figures I will need to use nested
> containers and several types of layout manager. A typical SWT layout
> exercise.
>
> My concern is that this nesting breaks the one-to-one MVC pattern the is
at
> the core of GEF. In many cases my child figures will have parent
containers
> that are not the node figure.

There is no one-to-one restriction, and it can often make sense to not do
that. An EditPart can correspond to a complex combination of figures, and
not just a singe figure. The children figures are always added to the
figure that is returned by your EditPart's getContentPane() method.

>
> I can see two possible approaches. I could overload the node edit parts
> addChildVisual() method and drill down through the containers to find the
> correct figure in which to add the child or I could introduce "dummy"
model
> elements and edit parts that represent the containers I need to use in the
> layout of the real children.
>
> I'm not sure of the possible side effects of the first approach and the
> second seems to be very messy.
>
> Any ideas on how best to approach this would be very mush appreciated.
>
> Thanks Steve.
>
>
>
>
>
>
>
Previous Topic:Auto-positioning EditParts
Next Topic:ActionRegistry
Goto Forum:
  


Current Time: Mon Dec 02 19:53:57 GMT 2024

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

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

Back to the top