[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Editparts, Figures and children

"Pat" <spam@xxxxxxxxxx> wrote in message
news:cndbj7$scg$1@xxxxxxxxxxxxxxxxxx
> Hi all,
>
> I've designed a GEF editor to edit bean properties. I have a
> BeanEditPart and a PropertyEditPart. The BeanEditPart will have a child
> PropertyEditPart for every property (as defined via commons Attributes
> xdoclet markup).
>
> I have all this working, but would like a sanity check on my use of
> Figures and EditParts.
>
> My BeanEditPart has a EditPolicy.COMPONENT_ROLE as it is not strictly a
> container in the GEF sense of the word. I.e. It has children but this is
> a fixed number of PropertyEditParts. You cannot add/delete or move these
> children so it is not a GEF container.

####
Doesn't matter.  It's still a container.  Containment is defined by ability
to have children.  The constraints on the children are irrelevant.

>
> The PropertyEditPart is a container which allows a single child - the
> value that will set the property of the bean. When a value is set, this
> in turn will cause a BeanEditPart to be created etc, etc.
>
> Now, when I created my figures, the PropertyEditPart simply returns a
> Figure with a FlowLayout; no problem there. I want the BeanEditPart to
> construct a Figure containing both labels and PropertyEditPart figures.
> Ultimately I want to achieve something like this:
>
> ------------                 ------------
> | property | is greater than | property |
> ------------                 ------------
>
> I.e. Parts of the figure are just non-editable layout and information to
> describe the interrelation of the properties.
>
> And finally the question:
> Is it safe to override addChildVisual and removeChildVisual to do
> nothing. I can then take the responsibility for adding child
> PropertyEditPart figures in the createFigure() method. I have so far
> added placeholders for the child figures and replaced them by overridden
> add/removeChildVisual() methods.

####
Okay, I'm not familiar with the xdoclet markup and hence it's not entirely
clear to me what you're trying to do.  But it seems that you have a case
where two distinct model entities are to be shown as having a parent/child
relationship on the screen.  While their relationship may not be as such in
the model, it's perfectly fine to have the BeanEditPart be the parent of the
PropertyEditParts (if that's how you want to represent them).

To answer your actual question, there's nothing stopping you from overriding
those methods.  If you're not ever going to have children editparts, it
shouldn't create any problems.  However, I wouldn't recommend it; moreso
because it seems you don't need to.  It's easy to end up with some ugly code
if you don't know what you're doing or don't understand the framework
entirely.

>
> Thanks for your help. Looking forward to a response.
>
> Pat
>
> p.s. Appreciated all of the mails in the newsgroup. This is certainly a
> valuable resource to understanding GEF.