Skip to main content



      Home
Home » Eclipse Projects » GEF » [Draw2d] Max dimension, layout & BlocFlow
[Draw2d] Max dimension, layout & BlocFlow [message #136592] Mon, 07 June 2004 06:10 Go to next message
Eclipse UserFriend
Originally posted by: christophe.labouisse.mycom-int.com

I have to make a tooltip including a description. Since this description
can be of arbitrary length, though of using the flow capability of draw2d.
I did the following:

- Create a MyTooltip class extending Figure (I also try Panel),
- Add a Layout manager,
- Add a FlowPage to MyTooltip,
- Add some BlockFlow to this page.

So far everything works fine except that I cannot find a
contraints/layout/set(Min|Max|Prefered)Size combination allowing to
tooltip not to exceed a max width by "flowing" the description on several
lines if needed (It'll also be nice to "..." the text if the tooltip reach
a max height but I'll live without it).

Currently I only manage to have either a tooltip with a "right" size for
the description text but displaying the text on one loooong line instead
of breaking it, having a obscenely big size even when holding only a
couple of words and having a tooltip "clipped" to a maximum width but
keeping only a one line height.

Any hint?

PS: Using Eclipse 3.0RC1 Draw2d 20040603 (?)
Re: [Draw2d] Max dimension, layout & BlocFlow [message #136655 is a reply to message #136592] Mon, 07 June 2004 10:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rlemaigr.ulb.ac.be

Hello christoffe,

I never used the text package nor tooltips (or almost never) so this is =
=

not really an "answer" you will have to wait for the specialists...

Looking at the method which shows the tooltip, it seems (I'm not 100% =

sure) that the method is giving the tooltip its preferred size.
Are you sure the preferred size which is returned by the getPreferredSiz=
e =

method of the tooltip is the one you specified ?
Maybe you could try to override the method getPreferredSize(int hinta, i=
nt =

hintb) in your tooltip class like,
public Dimension getPreferredSize(int a, int b)
{
return new Dimension(100,100);//for example...
}
just to be absolutly sure that the returned preferred size is what you =

want, just to see what happens then...That costs nothing to try...

There is also the fact that the text layout manager when he computes the=
=

preferred size of the text should know about the how many lines or how =

many rows (or how many pixels...don't know...) are available, I think. S=
o =

the problem may come from the "hints" given to the getPreferredSize meth=
od =

of the Figure where the text is written...

These are just ideas...nothing sure...

r=E9gis



On Mon, 07 Jun 2004 12:10:14 +0200, Christophe Labouisse =

<christophe.labouisse@mycom-int.com> wrote:

> I have to make a tooltip including a description. Since this descripti=
on
> can be of arbitrary length, though of using the flow capability of =

> draw2d.
> I did the following:
>
> - Create a MyTooltip class extending Figure (I also try Panel),
> - Add a Layout manager,
> - Add a FlowPage to MyTooltip,
> - Add some BlockFlow to this page.
>
> So far everything works fine except that I cannot find a
> contraints/layout/set(Min|Max|Prefered)Size combination allowing to
> tooltip not to exceed a max width by "flowing" the description on seve=
ral
> lines if needed (It'll also be nice to "..." the text if the tooltip =

> reach
> a max height but I'll live without it).
>
> Currently I only manage to have either a tooltip with a "right" size f=
or
> the description text but displaying the text on one loooong line inste=
ad
> of breaking it, having a obscenely big size even when holding only a
> couple of words and having a tooltip "clipped" to a maximum width but
> keeping only a one line height.
>
> Any hint?
>
> PS: Using Eclipse 3.0RC1 Draw2d 20040603 (?)



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: [Draw2d] Max dimension, layout & BlocFlow [message #136667 is a reply to message #136592] Mon, 07 June 2004 10:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You probably don't need the block inside the page. A page is a block. To
set the width, use FlowPage#setRecommendedWidth(). The page's preferred
size may exceed that width only if you have a huge word without spaces.

"Christophe Labouisse" <christophe.labouisse@mycom-int.com> wrote in message
news:pan.2004.06.07.10.10.11.760024@mycom-int.com...
> I have to make a tooltip including a description. Since this description
> can be of arbitrary length, though of using the flow capability of draw2d.
> I did the following:
>
> - Create a MyTooltip class extending Figure (I also try Panel),
> - Add a Layout manager,
> - Add a FlowPage to MyTooltip,
> - Add some BlockFlow to this page.
>
> So far everything works fine except that I cannot find a
> contraints/layout/set(Min|Max|Prefered)Size combination allowing to
> tooltip not to exceed a max width by "flowing" the description on several
> lines if needed (It'll also be nice to "..." the text if the tooltip reach
> a max height but I'll live without it).
>
> Currently I only manage to have either a tooltip with a "right" size for
> the description text but displaying the text on one loooong line instead
> of breaking it, having a obscenely big size even when holding only a
> couple of words and having a tooltip "clipped" to a maximum width but
> keeping only a one line height.
>
> Any hint?
>
> PS: Using Eclipse 3.0RC1 Draw2d 20040603 (?)
Re: [Draw2d] Max dimension, layout & BlocFlow [message #136725 is a reply to message #136667] Mon, 07 June 2004 11:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christophe.labouisse.mycom-int.com

Le Mon, 07 Jun 2004 10:35:32 -0400, Randy Hudson a écrit :

> You probably don't need the block inside the page. A page is a block.

Ok thanks for the advice.

> To
> set the width, use FlowPage#setRecommendedWidth(). The page's preferred
> size may exceed that width only if you have a huge word without spaces.

Sounds nice however this method is private (well at least in the version I
use) so I cannot call it except by resorting ugly things. I notice that
setBounds call super.setBounds I'm afraid that this won't solve my problem
since I'll probably end up with page not having the excepted behavior. Am
I wrong ?
Re: [Draw2d] Max dimension, layout & BlocFlow [message #136761 is a reply to message #136725] Mon, 07 June 2004 11:19 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

OK, so open a bug so we can make this easier.
The workaround is to create an anonymous subclass which overrides
getPreferredSize(int, int), and calls super with the desired width.

"Christophe Labouisse" <christophe.labouisse@mycom-int.com> wrote in message
news:pan.2004.06.07.15.10.16.800772@mycom-int.com...
> Le Mon, 07 Jun 2004 10:35:32 -0400, Randy Hudson a
Previous Topic:Strange behaviour of a Label with a Border ?
Next Topic:GEF clipboard
Goto Forum:
  


Current Time: Sat Jul 19 11:27:06 EDT 2025

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

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

Back to the top