Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Layout of figures in an editpart
Layout of figures in an editpart [message #78242] Wed, 07 May 2003 09:16 Go to next message
Eclipse UserFriend
Originally posted by: j.verschoor.nefli.nl

Hello

I've create an editpart that has a number of child editparts.
The parent editpart creates a figure that extends from a rectanglefigure and
adds a label in top of the rectangle.
The child figures should be inside the parent, and aligned right, right
under the parentlabel:

+-------------+
| Label |
| |
| child |
| child |
| child |
+-------------+

My problem is that I can't get the positioning / alignment done properly. I
get something that looks like:
+-------------+
| child |
| child |
| child |
| Label |
+-------------+

If somone could tell me where I should specify the layout, I'd appreciate
it.

Thanks.
Re: Layout of figures in an editpart [message #78352 is a reply to message #78242] Wed, 07 May 2003 15:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

The children cannot have other sibling figures like the label you describe.
You need to create a "contents pane" figure for containing the children:

+------------+
| Label |
| +---------+|
| | child| |
| | child| |
| +---------+|
+-----------+

For the outer-most figure, use a ToolbarLayout
For the contents pane, use a ToolbarLayout, with
setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)

"Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
news:b9aiod$na9$1@rogue.oti.com...
> Hello
>
> I've create an editpart that has a number of child editparts.
> The parent editpart creates a figure that extends from a rectanglefigure
and
> adds a label in top of the rectangle.
> The child figures should be inside the parent, and aligned right, right
> under the parentlabel:
>
> +-------------+
> | Label |
> | |
> | child |
> | child |
> | child |
> +-------------+
>
> My problem is that I can't get the positioning / alignment done properly.
I
> get something that looks like:
> +-------------+
> | child |
> | child |
> | child |
> | Label |
> +-------------+
>
> If somone could tell me where I should specify the layout, I'd appreciate
> it.
>
> Thanks.
>
>
>
Re: Layout of figures in an editpart [message #78431 is a reply to message #78352] Wed, 07 May 2003 19:15 Go to previous messageGo to next message
Stefan Junsved is currently offline Stefan JunsvedFriend
Messages: 56
Registered: July 2009
Member
I have a question relating to figure use.

I use a org.eclipse.draw2d.Label figure with a text on the top and an image
under it. I put source and target anchors on the figure but when the text is
wider than the image, the anchors don't reach all the way to the imgae.
Instead they start and end at the width of the text. See attached file.

Should I use some kind of decorator to solve the problem or is it possible
to create one Label without an image and an ImageFigure and try to connect
to two?

Thanks.

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b9b9ic$agq$1@rogue.oti.com...
> The children cannot have other sibling figures like the label you
describe.
> You need to create a "contents pane" figure for containing the children:
>
> +------------+
> | Label |
> | +---------+|
> | | child| |
> | | child| |
> | +---------+|
> +-----------+
>
> For the outer-most figure, use a ToolbarLayout
> For the contents pane, use a ToolbarLayout, with
> setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
>
> "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> news:b9aiod$na9$1@rogue.oti.com...
> > Hello
> >
> > I've create an editpart that has a number of child editparts.
> > The parent editpart creates a figure that extends from a rectanglefigure
> and
> > adds a label in top of the rectangle.
> > The child figures should be inside the parent, and aligned right, right
> > under the parentlabel:
> >
> > +-------------+
> > | Label |
> > | |
> > | child |
> > | child |
> > | child |
> > +-------------+
> >
> > My problem is that I can't get the positioning / alignment done
properly.
> I
> > get something that looks like:
> > +-------------+
> > | child |
> > | child |
> > | child |
> > | Label |
> > +-------------+
> >
> > If somone could tell me where I should specify the layout, I'd
appreciate
> > it.
> >
> > Thanks.
> >
> >
> >
>
>


  • Attachment: snap.gif
    (Size: 1.78KB, Downloaded 92 times)
Re: Layout of figures in an editpart [message #78446 is a reply to message #78431] Wed, 07 May 2003 19:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

see LabelAnchor

"Stefan Junsved" <stefan.junsved@comactivity.net> wrote in message
news:b9blvs$llb$1@rogue.oti.com...
> I have a question relating to figure use.
>
> I use a org.eclipse.draw2d.Label figure with a text on the top and an
image
> under it. I put source and target anchors on the figure but when the text
is
> wider than the image, the anchors don't reach all the way to the imgae.
> Instead they start and end at the width of the text. See attached file.
>
> Should I use some kind of decorator to solve the problem or is it possible
> to create one Label without an image and an ImageFigure and try to connect
> to two?
>
> Thanks.
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:b9b9ic$agq$1@rogue.oti.com...
> > The children cannot have other sibling figures like the label you
> describe.
> > You need to create a "contents pane" figure for containing the children:
> >
> > +------------+
> > | Label |
> > | +---------+|
> > | | child| |
> > | | child| |
> > | +---------+|
> > +-----------+
> >
> > For the outer-most figure, use a ToolbarLayout
> > For the contents pane, use a ToolbarLayout, with
> > setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
> >
> > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > news:b9aiod$na9$1@rogue.oti.com...
> > > Hello
> > >
> > > I've create an editpart that has a number of child editparts.
> > > The parent editpart creates a figure that extends from a
rectanglefigure
> > and
> > > adds a label in top of the rectangle.
> > > The child figures should be inside the parent, and aligned right,
right
> > > under the parentlabel:
> > >
> > > +-------------+
> > > | Label |
> > > | |
> > > | child |
> > > | child |
> > > | child |
> > > +-------------+
> > >
> > > My problem is that I can't get the positioning / alignment done
> properly.
> > I
> > > get something that looks like:
> > > +-------------+
> > > | child |
> > > | child |
> > > | child |
> > > | Label |
> > > +-------------+
> > >
> > > If somone could tell me where I should specify the layout, I'd
> appreciate
> > > it.
> > >
> > > Thanks.
> > >
> > >
> > >
> >
> >
>
>
>
Re: Layout of figures in an editpart [message #78520 is a reply to message #78352] Thu, 08 May 2003 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: j.verschoor.nefli.nl

Hi, I think you misunderstand me.
I have two EditParts (the container and the children)
They both have figures. (they are editparts because I want to be able to
select a child and remove / rename it etc)
So I don't really have a LayoutManager for the editparts..

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b9b9ic$agq$1@rogue.oti.com...
> The children cannot have other sibling figures like the label you
describe.
> You need to create a "contents pane" figure for containing the children:
>
> +------------+
> | Label |
> | +---------+|
> | | child| |
> | | child| |
> | +---------+|
> +-----------+
>
> For the outer-most figure, use a ToolbarLayout
> For the contents pane, use a ToolbarLayout, with
> setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
>
> "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> news:b9aiod$na9$1@rogue.oti.com...
> > Hello
> >
> > I've create an editpart that has a number of child editparts.
> > The parent editpart creates a figure that extends from a rectanglefigure
> and
> > adds a label in top of the rectangle.
> > The child figures should be inside the parent, and aligned right, right
> > under the parentlabel:
> >
> > +-------------+
> > | Label |
> > | |
> > | child |
> > | child |
> > | child |
> > +-------------+
> >
> > My problem is that I can't get the positioning / alignment done
properly.
> I
> > get something that looks like:
> > +-------------+
> > | child |
> > | child |
> > | child |
> > | Label |
> > +-------------+
> >
> > If somone could tell me where I should specify the layout, I'd
appreciate
> > it.
> >
> > Thanks.
> >
> >
> >
>
>
Re: Layout of figures in an editpart [message #78652 is a reply to message #78520] Thu, 08 May 2003 14:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Actually, that is what I understood. The label is getting pushed down to
the bottom in refreshChildren because it is a sibling of the children
editparts' figures. Your container edipart must consist of 3 separate
figures, one for the editpart, one for the label, and one to contain the
children editparts.

+Figure in ToolbarLayout
|-Label
|-+ Figure in ToolbarLayout
| - figure from first child editpart
| - figure from second child editpart


"Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
news:b9dd63$m3f$1@rogue.oti.com...
> Hi, I think you misunderstand me.
> I have two EditParts (the container and the children)
> They both have figures. (they are editparts because I want to be able to
> select a child and remove / rename it etc)
> So I don't really have a LayoutManager for the editparts..
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:b9b9ic$agq$1@rogue.oti.com...
> > The children cannot have other sibling figures like the label you
> describe.
> > You need to create a "contents pane" figure for containing the children:
> >
> > +------------+
> > | Label |
> > | +---------+|
> > | | child| |
> > | | child| |
> > | +---------+|
> > +-----------+
> >
> > For the outer-most figure, use a ToolbarLayout
> > For the contents pane, use a ToolbarLayout, with
> > setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
> >
> > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > news:b9aiod$na9$1@rogue.oti.com...
> > > Hello
> > >
> > > I've create an editpart that has a number of child editparts.
> > > The parent editpart creates a figure that extends from a
rectanglefigure
> > and
> > > adds a label in top of the rectangle.
> > > The child figures should be inside the parent, and aligned right,
right
> > > under the parentlabel:
> > >
> > > +-------------+
> > > | Label |
> > > | |
> > > | child |
> > > | child |
> > > | child |
> > > +-------------+
> > >
> > > My problem is that I can't get the positioning / alignment done
> properly.
> > I
> > > get something that looks like:
> > > +-------------+
> > > | child |
> > > | child |
> > > | child |
> > > | Label |
> > > +-------------+
> > >
> > > If somone could tell me where I should specify the layout, I'd
> appreciate
> > > it.
> > >
> > > Thanks.
> > >
> > >
> > >
> >
> >
>
>
Re: Layout of figures in an editpart [message #78695 is a reply to message #78652] Thu, 08 May 2003 15:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: j.verschoor.nefli.nl

Ok I understand that, but what I don't understand is where and how I can
add() a child to the figure with toolbar layout
I create a figure in createFigure(), and gef does some magic, so there's no
way of adding the figure to another figure instead of the figure I return in
createFigure()

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b9dr8d$2mt$1@rogue.oti.com...
> Actually, that is what I understood. The label is getting pushed down to
> the bottom in refreshChildren because it is a sibling of the children
> editparts' figures. Your container edipart must consist of 3 separate
> figures, one for the editpart, one for the label, and one to contain the
> children editparts.
>
> +Figure in ToolbarLayout
> |-Label
> |-+ Figure in ToolbarLayout
> | - figure from first child editpart
> | - figure from second child editpart
>
>
> "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> news:b9dd63$m3f$1@rogue.oti.com...
> > Hi, I think you misunderstand me.
> > I have two EditParts (the container and the children)
> > They both have figures. (they are editparts because I want to be able to
> > select a child and remove / rename it etc)
> > So I don't really have a LayoutManager for the editparts..
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:b9b9ic$agq$1@rogue.oti.com...
> > > The children cannot have other sibling figures like the label you
> > describe.
> > > You need to create a "contents pane" figure for containing the
children:
> > >
> > > +------------+
> > > | Label |
> > > | +---------+|
> > > | | child| |
> > > | | child| |
> > > | +---------+|
> > > +-----------+
> > >
> > > For the outer-most figure, use a ToolbarLayout
> > > For the contents pane, use a ToolbarLayout, with
> > > setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
> > >
> > > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > > news:b9aiod$na9$1@rogue.oti.com...
> > > > Hello
> > > >
> > > > I've create an editpart that has a number of child editparts.
> > > > The parent editpart creates a figure that extends from a
> rectanglefigure
> > > and
> > > > adds a label in top of the rectangle.
> > > > The child figures should be inside the parent, and aligned right,
> right
> > > > under the parentlabel:
> > > >
> > > > +-------------+
> > > > | Label |
> > > > | |
> > > > | child |
> > > > | child |
> > > > | child |
> > > > +-------------+
> > > >
> > > > My problem is that I can't get the positioning / alignment done
> > properly.
> > > I
> > > > get something that looks like:
> > > > +-------------+
> > > > | child |
> > > > | child |
> > > > | child |
> > > > | Label |
> > > > +-------------+
> > > >
> > > > If somone could tell me where I should specify the layout, I'd
> > appreciate
> > > > it.
> > > >
> > > > Thanks.
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Layout of figures in an editpart [message #78769 is a reply to message #78695] Thu, 08 May 2003 16:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

create a field in your graphicaleditpart subclass called contentsPane. in
createFigure, hold onto the contentsPane. override getContentsPane to return
the contentsPane field.


"Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
news:b9ds1c$3je$1@rogue.oti.com...
> Ok I understand that, but what I don't understand is where and how I can
> add() a child to the figure with toolbar layout
> I create a figure in createFigure(), and gef does some magic, so there's
no
> way of adding the figure to another figure instead of the figure I return
in
> createFigure()
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:b9dr8d$2mt$1@rogue.oti.com...
> > Actually, that is what I understood. The label is getting pushed down
to
> > the bottom in refreshChildren because it is a sibling of the children
> > editparts' figures. Your container edipart must consist of 3 separate
> > figures, one for the editpart, one for the label, and one to contain the
> > children editparts.
> >
> > +Figure in ToolbarLayout
> > |-Label
> > |-+ Figure in ToolbarLayout
> > | - figure from first child editpart
> > | - figure from second child editpart
> >
> >
> > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > news:b9dd63$m3f$1@rogue.oti.com...
> > > Hi, I think you misunderstand me.
> > > I have two EditParts (the container and the children)
> > > They both have figures. (they are editparts because I want to be able
to
> > > select a child and remove / rename it etc)
> > > So I don't really have a LayoutManager for the editparts..
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:b9b9ic$agq$1@rogue.oti.com...
> > > > The children cannot have other sibling figures like the label you
> > > describe.
> > > > You need to create a "contents pane" figure for containing the
> children:
> > > >
> > > > +------------+
> > > > | Label |
> > > > | +---------+|
> > > > | | child| |
> > > > | | child| |
> > > > | +---------+|
> > > > +-----------+
> > > >
> > > > For the outer-most figure, use a ToolbarLayout
> > > > For the contents pane, use a ToolbarLayout, with
> > > > setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
> > > >
> > > > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > > > news:b9aiod$na9$1@rogue.oti.com...
> > > > > Hello
> > > > >
> > > > > I've create an editpart that has a number of child editparts.
> > > > > The parent editpart creates a figure that extends from a
> > rectanglefigure
> > > > and
> > > > > adds a label in top of the rectangle.
> > > > > The child figures should be inside the parent, and aligned right,
> > right
> > > > > under the parentlabel:
> > > > >
> > > > > +-------------+
> > > > > | Label |
> > > > > | |
> > > > > | child |
> > > > > | child |
> > > > > | child |
> > > > > +-------------+
> > > > >
> > > > > My problem is that I can't get the positioning / alignment done
> > > properly.
> > > > I
> > > > > get something that looks like:
> > > > > +-------------+
> > > > > | child |
> > > > > | child |
> > > > > | child |
> > > > > | Label |
> > > > > +-------------+
> > > > >
> > > > > If somone could tell me where I should specify the layout, I'd
> > > appreciate
> > > > > it.
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Layout of figures in an editpart [message #79000 is a reply to message #78769] Mon, 12 May 2003 09:11 Go to previous message
Eclipse UserFriend
Originally posted by: j.verschoor.nefli.nl

Ah thanks for explaining. I also found the same code in the logic example.


"Randy Hudson" <none@us.ibm.com> wrote in message
news:b9dvkt$6rc$1@rogue.oti.com...
> create a field in your graphicaleditpart subclass called contentsPane. in
> createFigure, hold onto the contentsPane. override getContentsPane to
return
> the contentsPane field.
>
>
> "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> news:b9ds1c$3je$1@rogue.oti.com...
> > Ok I understand that, but what I don't understand is where and how I can
> > add() a child to the figure with toolbar layout
> > I create a figure in createFigure(), and gef does some magic, so there's
> no
> > way of adding the figure to another figure instead of the figure I
return
> in
> > createFigure()
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:b9dr8d$2mt$1@rogue.oti.com...
> > > Actually, that is what I understood. The label is getting pushed down
> to
> > > the bottom in refreshChildren because it is a sibling of the children
> > > editparts' figures. Your container edipart must consist of 3 separate
> > > figures, one for the editpart, one for the label, and one to contain
the
> > > children editparts.
> > >
> > > +Figure in ToolbarLayout
> > > |-Label
> > > |-+ Figure in ToolbarLayout
> > > | - figure from first child editpart
> > > | - figure from second child editpart
> > >
> > >
> > > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > > news:b9dd63$m3f$1@rogue.oti.com...
> > > > Hi, I think you misunderstand me.
> > > > I have two EditParts (the container and the children)
> > > > They both have figures. (they are editparts because I want to be
able
> to
> > > > select a child and remove / rename it etc)
> > > > So I don't really have a LayoutManager for the editparts..
> > > >
> > > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > > news:b9b9ic$agq$1@rogue.oti.com...
> > > > > The children cannot have other sibling figures like the label you
> > > > describe.
> > > > > You need to create a "contents pane" figure for containing the
> > children:
> > > > >
> > > > > +------------+
> > > > > | Label |
> > > > > | +---------+|
> > > > > | | child| |
> > > > > | | child| |
> > > > > | +---------+|
> > > > > +-----------+
> > > > >
> > > > > For the outer-most figure, use a ToolbarLayout
> > > > > For the contents pane, use a ToolbarLayout, with
> > > > > setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT)
> > > > >
> > > > > "Joris Verschoor" <j.verschoor@nefli.nl> wrote in message
> > > > > news:b9aiod$na9$1@rogue.oti.com...
> > > > > > Hello
> > > > > >
> > > > > > I've create an editpart that has a number of child editparts.
> > > > > > The parent editpart creates a figure that extends from a
> > > rectanglefigure
> > > > > and
> > > > > > adds a label in top of the rectangle.
> > > > > > The child figures should be inside the parent, and aligned
right,
> > > right
> > > > > > under the parentlabel:
> > > > > >
> > > > > > +-------------+
> > > > > > | Label |
> > > > > > | |
> > > > > > | child |
> > > > > > | child |
> > > > > > | child |
> > > > > > +-------------+
> > > > > >
> > > > > > My problem is that I can't get the positioning / alignment done
> > > > properly.
> > > > > I
> > > > > > get something that looks like:
> > > > > > +-------------+
> > > > > > | child |
> > > > > > | child |
> > > > > > | child |
> > > > > > | Label |
> > > > > > +-------------+
> > > > > >
> > > > > > If somone could tell me where I should specify the layout, I'd
> > > > appreciate
> > > > > > it.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:debugging into Eclipse Src
Next Topic:Handling Request of Type open
Goto Forum:
  


Current Time: Sun Sep 01 04:20:33 GMT 2024

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

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

Back to the top