Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Design issue related to EditParts
Design issue related to EditParts [message #191481] Wed, 10 August 2005 16:41 Go to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
My model consists of elements that have 2 types of children. I want to
display the children separately in a box each within the element. Since the
children should be selectable, they have their own EditParts and are
returned by getModelChildren() on the element's EditPart. I wanted to create
the box around each list of children by adding a figure per type (a
compartment which only draws a box around itself) to the element's figure,
and then adding the children's figures to the figure of their type. However,
I ran into the problem that the children's figures are automatically added
to the element's figure. I can resolve this by adding an EditPart and
corresponding model for the compartment (which contains the children of a
particular type), but I am not really happy with that because my model does
not need that compartment at all.

Does anybody have any thoughts on this?
Re: Design issue related to EditParts [message #191521 is a reply to message #191481] Wed, 10 August 2005 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Your exact case is not clear to me, but the following will hopefully help:

1) It seems the box you want to draw can easily be done by adding a border.
2) An EditPart doesn't have to match to a single figure. It can be a
combination of figures. The children will be added to the figure returned
by getContentPane() method (which, by default, returns getFigure()).
3) You can have EditParts that don't correspond to any model object. An
example is the CompartmentEditPart used in the EDiagram example.


"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dddag6$3f5$1@news.eclipse.org...
> My model consists of elements that have 2 types of children. I want to
> display the children separately in a box each within the element. Since
the
> children should be selectable, they have their own EditParts and are
> returned by getModelChildren() on the element's EditPart. I wanted to
create
> the box around each list of children by adding a figure per type (a
> compartment which only draws a box around itself) to the element's figure,
> and then adding the children's figures to the figure of their type.
However,
> I ran into the problem that the children's figures are automatically added
> to the element's figure. I can resolve this by adding an EditPart and
> corresponding model for the compartment (which contains the children of a
> particular type), but I am not really happy with that because my model
does
> not need that compartment at all.
>
> Does anybody have any thoughts on this?
>
>
Re: Design issue related to EditParts [message #191568 is a reply to message #191521] Wed, 10 August 2005 17:17 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Please see my replies below.

"Pratik Shah" <none@unknown.com> wrote in message
news:dddblh$4ra$1@news.eclipse.org...
> Your exact case is not clear to me, but the following will hopefully help:
>
> 1) It seems the box you want to draw can easily be done by adding a
> border.
This is what I am doing with the figure for the compartment, which then
contains the children. I cannot add the border to the element's figure
because I need 2 rectangles (one for each type of child) drawn, not just
one. And I cannot add the border to the children, because the rectangle
should go around all the children of a particular type.

> 2) An EditPart doesn't have to match to a single figure. It can be a
> combination of figures. The children will be added to the figure returned
> by getContentPane() method (which, by default, returns getFigure()).
Thanks, this is good to know, but then I have the problem that my version of
getContentPane() would have to know beforehand which type of child is being
added in order to return the proper compartment figure. Children of type 1
should go to compartment 1, children of type 2 to compartment 2.

> 3) You can have EditParts that don't correspond to any model object. An
> example is the CompartmentEditPart used in the EDiagram example.
Very good, but where do I find this example? I only have the flow, logic,
shapes and text examples that came with GEF. I also looked at your
documentation page on eclipse.org, but didn't see anything that said
EDiagram.

>
>
> "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> news:dddag6$3f5$1@news.eclipse.org...
>> My model consists of elements that have 2 types of children. I want to
>> display the children separately in a box each within the element. Since
> the
>> children should be selectable, they have their own EditParts and are
>> returned by getModelChildren() on the element's EditPart. I wanted to
> create
>> the box around each list of children by adding a figure per type (a
>> compartment which only draws a box around itself) to the element's
>> figure,
>> and then adding the children's figures to the figure of their type.
> However,
>> I ran into the problem that the children's figures are automatically
>> added
>> to the element's figure. I can resolve this by adding an EditPart and
>> corresponding model for the compartment (which contains the children of a
>> particular type), but I am not really happy with that because my model
> does
>> not need that compartment at all.
>>
>> Does anybody have any thoughts on this?
>>
>>
>
>
Re: Design issue related to EditParts [message #191605 is a reply to message #191568] Wed, 10 August 2005 17:23 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

After re-reading your problem statement, I think I now understand what
you're trying to do. And the solution would be to do it exactly like the
EDiagram example does it. In there, the ClassEditPart displays attributes
and methods in two separate compartments. You can load the ediagram example
from CVS (look at our FAQs to see how to do that).

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dddck6$60e$1@news.eclipse.org...
> Please see my replies below.
>
> "Pratik Shah" <none@unknown.com> wrote in message
> news:dddblh$4ra$1@news.eclipse.org...
> > Your exact case is not clear to me, but the following will hopefully
help:
> >
> > 1) It seems the box you want to draw can easily be done by adding a
> > border.
> This is what I am doing with the figure for the compartment, which then
> contains the children. I cannot add the border to the element's figure
> because I need 2 rectangles (one for each type of child) drawn, not just
> one. And I cannot add the border to the children, because the rectangle
> should go around all the children of a particular type.
>
> > 2) An EditPart doesn't have to match to a single figure. It can be a
> > combination of figures. The children will be added to the figure
returned
> > by getContentPane() method (which, by default, returns getFigure()).
> Thanks, this is good to know, but then I have the problem that my version
of
> getContentPane() would have to know beforehand which type of child is
being
> added in order to return the proper compartment figure. Children of type 1
> should go to compartment 1, children of type 2 to compartment 2.
>
> > 3) You can have EditParts that don't correspond to any model object. An
> > example is the CompartmentEditPart used in the EDiagram example.
> Very good, but where do I find this example? I only have the flow, logic,
> shapes and text examples that came with GEF. I also looked at your
> documentation page on eclipse.org, but didn't see anything that said
> EDiagram.
>
> >
> >
> > "Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
> > news:dddag6$3f5$1@news.eclipse.org...
> >> My model consists of elements that have 2 types of children. I want to
> >> display the children separately in a box each within the element. Since
> > the
> >> children should be selectable, they have their own EditParts and are
> >> returned by getModelChildren() on the element's EditPart. I wanted to
> > create
> >> the box around each list of children by adding a figure per type (a
> >> compartment which only draws a box around itself) to the element's
> >> figure,
> >> and then adding the children's figures to the figure of their type.
> > However,
> >> I ran into the problem that the children's figures are automatically
> >> added
> >> to the element's figure. I can resolve this by adding an EditPart and
> >> corresponding model for the compartment (which contains the children of
a
> >> particular type), but I am not really happy with that because my model
> > does
> >> not need that compartment at all.
> >>
> >> Does anybody have any thoughts on this?
> >>
> >>
> >
> >
>
>
Previous Topic:How to change the focus color?
Next Topic:rotating a text label
Goto Forum:
  


Current Time: Tue Dec 03 09:44:51 GMT 2024

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

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

Back to the top