Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » help with LayoutManagers
help with LayoutManagers [message #178204] Tue, 19 April 2005 00:54 Go to next message
Eric Wasserman is currently offline Eric WassermanFriend
Messages: 10
Registered: July 2009
Junior Member
I'm new to draw2D and I'm trying to follow the advice of the FAQ not to
implement my own LayoutManager if I can help it.

I need to impelement a two column table whose columns are fixed width
but whose rows grow to accomodate their contents.

I tried using a ToolbarLayout for each row but I can't seem to keep the
first column from shrinking to fit the label I put in there.

IFigure.setMinimumSize(new Dimension(100, -1)) doesn't seem to do anything.

Thanks in advance.

Eric


------------------------------------------------------------
| Label | This is some Figure. |
------------------------------------------------------------
| | Some |
| Very Long Label | Other |
| | IFigure |
------------------------------------------------------------
| | A |
| | Tall |
| Long Label | IFigure |
| | Goes |
| | Here |
------------------------------------------------------------

^ I want to fix this width and this ^ width
Re: help with LayoutManagers [message #178363 is a reply to message #178204] Tue, 19 April 2005 21:48 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Use vertical toolbar layout (for the columns, instead of rows).

I don't know why people on this newsgroup use text-based figures to show
their problem when a screenshot would convey the problem much more clearly.

"Eric Wasserman" <ewasserman@voxify.com> wrote in message
news:BE89A4D8.A9DD%ewasserman@voxify.com...
> I'm new to draw2D and I'm trying to follow the advice of the FAQ not to
> implement my own LayoutManager if I can help it.
>
> I need to impelement a two column table whose columns are fixed width
> but whose rows grow to accomodate their contents.
>
> I tried using a ToolbarLayout for each row but I can't seem to keep the
> first column from shrinking to fit the label I put in there.
>
> IFigure.setMinimumSize(new Dimension(100, -1)) doesn't seem to do
anything.
>
> Thanks in advance.
>
> Eric
>
>
> ------------------------------------------------------------
> | Label | This is some Figure. |
> ------------------------------------------------------------
> | | Some |
> | Very Long Label | Other |
> | | IFigure |
> ------------------------------------------------------------
> | | A |
> | | Tall |
> | Long Label | IFigure |
> | | Goes |
> | | Here |
> ------------------------------------------------------------
>
> ^ I want to fix this width and this ^ width
>
Re: help with LayoutManagers [message #178432 is a reply to message #178363] Wed, 20 April 2005 14:44 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah wrote:

> Use vertical toolbar layout (for the columns, instead of rows).

But now he has to do some work to keep the height of the left cell as high
as on the right cell, i think.
It would be nice, if the toolbar-layout would consider the minimumSize, if
the minimumSize is larger than the preferredSize, instead of using the
default bounds (0,0,64,36).

There was an diskussion in the newsgroup on the 13.10.2003 and a
"solution" from Brian Fernandes, but it wasnŽt commented.
Strange that this is not listed as a bug.

> I don't know why people on this newsgroup use text-based figures to show
> their problem when a screenshot would convey the problem much more clearly.

How to make a screenshot, if you canŽt visualize it? :)
Or you could just paint it with MS Paint() :)

Andreas
Re: help with LayoutManagers [message #178449 is a reply to message #178432] Wed, 20 April 2005 15:27 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:4b8493d49da1dd042656b719cecb075f$1@www.eclipse.org...
> Pratik Shah wrote:
>
> > Use vertical toolbar layout (for the columns, instead of rows).
>
> But now he has to do some work to keep the height of the left cell as high
> as on the right cell, i think.
> It would be nice, if the toolbar-layout would consider the minimumSize, if
> the minimumSize is larger than the preferredSize, instead of using the
> default bounds (0,0,64,36).

Yeah, you're right about the height. The ToolbarLayout does take the
minimumSize into account, but it is upto the child figure (or its layout
manager) to ensure that the preferred size is at least as large as the
minimum size.

Scrap my original suggestion. We're trying to use ToolbarLayout in a way
that it wasn't meant to be used. What you really need is something like the
GridLayout. Perhaps it's best to create your own layout manager for this
case.

>
> There was an diskussion in the newsgroup on the 13.10.2003 and a
> "solution" from Brian Fernandes, but it wasn
Re: help with LayoutManagers [message #178809 is a reply to message #178449] Fri, 22 April 2005 17:15 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah wrote:

> Perhaps it's best to create your own layout manager for this
> case.

Why?
You could create a Figure, that represent one row (use a horizontal
ToolbarLayout) and add the rows to the main figure, which has a vertical
Toolbar Layout.
Each row-Figure has two Figures, one for the Label and one for the Figure.
You only have to ensure, that the Label-Figure has always the same width.

> Yeah, you're right about the height. The ToolbarLayout does take the
> minimumSize into account, but it is upto the child figure (or its layout
> manager) to ensure that the preferred size is at least as large as the
> minimum size.

As mentioned before, if you set the prefSize manually, the figure will not
be streched, as needed.
Re: help with LayoutManagers [message #179020 is a reply to message #178809] Mon, 25 April 2005 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> Why?
> You could create a Figure, that represent one row (use a horizontal
> ToolbarLayout) and add the rows to the main figure, which has a vertical
> Toolbar Layout.
> Each row-Figure has two Figures, one for the Label and one for the Figure.
> You only have to ensure, that the Label-Figure has always the same width.

Hard-coding the size of the label figures is a bit of a workaround. You
need a layout which handles both horiz. and vert. axes. In other words,
calculate column widths the right way by getting label pref sizes, then
figure out how much vertical space is needed based on the column widths and
the cell's pref heights for those widths. We eventually want to provide a
table layout which conforms to:

http://www.w3.org/TR/REC-CSS2/tables.html#width-layout
Re: help with LayoutManagers [message #179571 is a reply to message #179020] Thu, 28 April 2005 17:56 Go to previous message
Eric Wasserman is currently offline Eric WassermanFriend
Messages: 10
Registered: July 2009
Junior Member
I tried the figure per row and had trouble getting the preferred size to
stick. Each Label kept reverting to its internally computed preferred size.

I wound up solving this as Randy Hudson suggests below with a custom layout
that works as he describes. I'd share it but I doubt it's general purpose
enough to be of value to anyone else.

Thanks, everyone, for the help.


On 4/25/05 6:53 AM, in article d4isuf$c6j$1@news.eclipse.org, "Randy Hudson"
<none@us.ibm.com> wrote:

>> Why?
>> You could create a Figure, that represent one row (use a horizontal
>> ToolbarLayout) and add the rows to the main figure, which has a vertical
>> Toolbar Layout.
>> Each row-Figure has two Figures, one for the Label and one for the Figure.
>> You only have to ensure, that the Label-Figure has always the same width.
>
> Hard-coding the size of the label figures is a bit of a workaround. You
> need a layout which handles both horiz. and vert. axes. In other words,
> calculate column widths the right way by getting label pref sizes, then
> figure out how much vertical space is needed based on the column widths and
> the cell's pref heights for those widths. We eventually want to provide a
> table layout which conforms to:
>
> http://www.w3.org/TR/REC-CSS2/tables.html#width-layout
>
>
Previous Topic:Bendpoint problem while updating project to Eclipse 3.0.2
Next Topic:Connection Position Changes on Scrolling
Goto Forum:
  


Current Time: Wed Feb 08 08:28:45 GMT 2023

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

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

Back to the top