Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Width of palette when using PaletteGroup and PalleteDrawer
Width of palette when using PaletteGroup and PalleteDrawer [message #122213] Sun, 14 March 2004 21:48 Go to next message
Eclipse UserFriend
Originally posted by: cwhite.ic.net

I have a palette that contains PaletteGroups and and a PaletteDrawer. When
the palette is displayed the palette width is insufficient to display the
entire label for the PaletteDrawer. Everything looks good if I use all
PalletteDrawers.

Is there some property I can set that will cause the palette to display with
its width sized to contain the longest label?
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122331 is a reply to message #122213] Mon, 15 March 2004 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cwhite.ic.net

It turns out the the width of the palette is fine if the intial state of the
drawer is OPEN and the drawer contains some items with labels that are at
least as long as the drawer label.

It must be that the palette doesn't pay the the drawer label win making its
sizing decisions.

Should I report this as a bug?

"Chris White" <cwhite@ic.net> wrote in message
news:c32jnh$s3m$1@eclipse.org...
> I have a palette that contains PaletteGroups and and a PaletteDrawer. When
> the palette is displayed the palette width is insufficient to display the
> entire label for the PaletteDrawer. Everything looks good if I use all
> PalletteDrawers.
>
> Is there some property I can set that will cause the palette to display
with
> its width sized to contain the longest label?
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122396 is a reply to message #122331] Mon, 15 March 2004 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

What is your basis for asking hte palette its width?
Are you calling getPreferredSize or computeBounds?

"Chris White" <cwhite@ic.net> wrote in message
news:c34eg7$pbi$1@eclipse.org...
> It turns out the the width of the palette is fine if the intial state of
the
> drawer is OPEN and the drawer contains some items with labels that are at
> least as long as the drawer label.
>
> It must be that the palette doesn't pay the the drawer label win making
its
> sizing decisions.
>
> Should I report this as a bug?
>
> "Chris White" <cwhite@ic.net> wrote in message
> news:c32jnh$s3m$1@eclipse.org...
> > I have a palette that contains PaletteGroups and and a PaletteDrawer.
When
> > the palette is displayed the palette width is insufficient to display
the
> > entire label for the PaletteDrawer. Everything looks good if I use all
> > PalletteDrawers.
> >
> > Is there some property I can set that will cause the palette to display
> with
> > its width sized to contain the longest label?
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122504 is a reply to message #122331] Mon, 15 March 2004 15:46 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Look at GraphicalEditorWithPalette.getInitialPaletteSize()

"Chris White" <cwhite@ic.net> wrote in message
news:c34eg7$pbi$1@eclipse.org...
> It turns out the the width of the palette is fine if the intial state of
the
> drawer is OPEN and the drawer contains some items with labels that are at
> least as long as the drawer label.
>
> It must be that the palette doesn't pay the the drawer label win making
its
> sizing decisions.
>
> Should I report this as a bug?
>
> "Chris White" <cwhite@ic.net> wrote in message
> news:c32jnh$s3m$1@eclipse.org...
> > I have a palette that contains PaletteGroups and and a PaletteDrawer.
When
> > the palette is displayed the palette width is insufficient to display
the
> > entire label for the PaletteDrawer. Everything looks good if I use all
> > PalletteDrawers.
> >
> > Is there some property I can set that will cause the palette to display
> with
> > its width sized to contain the longest label?
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122658 is a reply to message #122396] Tue, 16 March 2004 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cwhite.ic.net

I am not asking the palette for its size. I am letting the palette size
itsself inside a composite that uses a grid layout (my own - I am not using
GraphicalEditorWithPalette). As I mentioned below the palette sizes properly
as long as the drawers is initially OPEN and it has a label that at least as
long as the drawer label.


"Randy Hudson" <none@us.ibm.com> wrote in message
news:c34g7u$ru3$1@eclipse.org...
> What is your basis for asking hte palette its width?
> Are you calling getPreferredSize or computeBounds?
>
> "Chris White" <cwhite@ic.net> wrote in message
> news:c34eg7$pbi$1@eclipse.org...
> > It turns out the the width of the palette is fine if the intial state of
> the
> > drawer is OPEN and the drawer contains some items with labels that are
at
> > least as long as the drawer label.
> >
> > It must be that the palette doesn't pay the the drawer label win making
> its
> > sizing decisions.
> >
> > Should I report this as a bug?
> >
> > "Chris White" <cwhite@ic.net> wrote in message
> > news:c32jnh$s3m$1@eclipse.org...
> > > I have a palette that contains PaletteGroups and and a PaletteDrawer.
> When
> > > the palette is displayed the palette width is insufficient to display
> the
> > > entire label for the PaletteDrawer. Everything looks good if I use all
> > > PalletteDrawers.
> > >
> > > Is there some property I can set that will cause the palette to
display
> > with
> > > its width sized to contain the longest label?
> > >
> > >
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122669 is a reply to message #122658] Tue, 16 March 2004 18:23 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
So, what you are saying is that the GridLayout is probably invoking
computeBounds on the palette's FigureCanvas, which in turn is invoking
getPreferredSize() on the palette. The problem here is that DrawerFigure
(in its getPreferredSize(int, int) method) returns its minimum size --
effectively, the preferred size of its header -- when not expanded, and
doesn't bother asking its children for their preferred size. I don't think
this quite qualifies as a bug, because that is what would be expected of it.

I am guessing you're seeing an ellipsis when you expand the drawer with the
entry that has the long label. Is that not acceptable?

Do you support internationalization? What happens when a palette's label
turns out to be really long in another language?

I'd suggest that you set an appropriate width hint for the palette.

"Chris White" <cwhite@ic.net> wrote in message
news:c37arp$7q9$1@eclipse.org...
> I am not asking the palette for its size. I am letting the palette size
> itsself inside a composite that uses a grid layout (my own - I am not
using
> GraphicalEditorWithPalette). As I mentioned below the palette sizes
properly
> as long as the drawers is initially OPEN and it has a label that at least
as
> long as the drawer label.
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:c34g7u$ru3$1@eclipse.org...
> > What is your basis for asking hte palette its width?
> > Are you calling getPreferredSize or computeBounds?
> >
> > "Chris White" <cwhite@ic.net> wrote in message
> > news:c34eg7$pbi$1@eclipse.org...
> > > It turns out the the width of the palette is fine if the intial state
of
> > the
> > > drawer is OPEN and the drawer contains some items with labels that are
> at
> > > least as long as the drawer label.
> > >
> > > It must be that the palette doesn't pay the the drawer label win
making
> > its
> > > sizing decisions.
> > >
> > > Should I report this as a bug?
> > >
> > > "Chris White" <cwhite@ic.net> wrote in message
> > > news:c32jnh$s3m$1@eclipse.org...
> > > > I have a palette that contains PaletteGroups and and a
PaletteDrawer.
> > When
> > > > the palette is displayed the palette width is insufficient to
display
> > the
> > > > entire label for the PaletteDrawer. Everything looks good if I use
all
> > > > PalletteDrawers.
> > > >
> > > > Is there some property I can set that will cause the palette to
> display
> > > with
> > > > its width sized to contain the longest label?
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122678 is a reply to message #122669] Tue, 16 March 2004 19:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cwhite.ic.net

Thank you for the response.

It doesn't make sense to me that the collapsed (or expanded) drawer would
not be wide enough to display its own label. In my opinion this is a bug
(albiet a very tiny bug!).

I could write the code to calculate the preferred palette width but I would
attempt to cycle through the pallete looking for the longest label. It looks
like the pallete code is already something like this but as you point out
the preferred size for a collapse drawer doesn't take the length of its
label into account.

I am going to show my ignorance here. How would I set the pallete width
hint?

Having said all that, I have a better idea how this works and I appreciate
the info.

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:c37gfa$fck$1@eclipse.org...
> So, what you are saying is that the GridLayout is probably invoking
> computeBounds on the palette's FigureCanvas, which in turn is invoking
> getPreferredSize() on the palette. The problem here is that DrawerFigure
> (in its getPreferredSize(int, int) method) returns its minimum size --
> effectively, the preferred size of its header -- when not expanded, and
> doesn't bother asking its children for their preferred size. I don't
think
> this quite qualifies as a bug, because that is what would be expected of
it.
>
> I am guessing you're seeing an ellipsis when you expand the drawer with
the
> entry that has the long label. Is that not acceptable?
>
> Do you support internationalization? What happens when a palette's label
> turns out to be really long in another language?
>
> I'd suggest that you set an appropriate width hint for the palette.
>
> "Chris White" <cwhite@ic.net> wrote in message
> news:c37arp$7q9$1@eclipse.org...
> > I am not asking the palette for its size. I am letting the palette size
> > itsself inside a composite that uses a grid layout (my own - I am not
> using
> > GraphicalEditorWithPalette). As I mentioned below the palette sizes
> properly
> > as long as the drawers is initially OPEN and it has a label that at
least
> as
> > long as the drawer label.
> >
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:c34g7u$ru3$1@eclipse.org...
> > > What is your basis for asking hte palette its width?
> > > Are you calling getPreferredSize or computeBounds?
> > >
> > > "Chris White" <cwhite@ic.net> wrote in message
> > > news:c34eg7$pbi$1@eclipse.org...
> > > > It turns out the the width of the palette is fine if the intial
state
> of
> > > the
> > > > drawer is OPEN and the drawer contains some items with labels that
are
> > at
> > > > least as long as the drawer label.
> > > >
> > > > It must be that the palette doesn't pay the the drawer label win
> making
> > > its
> > > > sizing decisions.
> > > >
> > > > Should I report this as a bug?
> > > >
> > > > "Chris White" <cwhite@ic.net> wrote in message
> > > > news:c32jnh$s3m$1@eclipse.org...
> > > > > I have a palette that contains PaletteGroups and and a
> PaletteDrawer.
> > > When
> > > > > the palette is displayed the palette width is insufficient to
> display
> > > the
> > > > > entire label for the PaletteDrawer. Everything looks good if I use
> all
> > > > > PalletteDrawers.
> > > > >
> > > > > Is there some property I can set that will cause the palette to
> > display
> > > > with
> > > > > its width sized to contain the longest label?
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122689 is a reply to message #122678] Tue, 16 March 2004 19:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> Thank you for the response.
>
> It doesn't make sense to me that the collapsed (or expanded) drawer would
> not be wide enough to display its own label. In my opinion this is a bug
> (albiet a very tiny bug!).

I think I agree. If our layout managers respected figure visibility, then
drawerfigure wouldn't need to override getPreferredSize() at all. Open a
bugzilla. We can fix this for 3.0. If you need a fix for 2.1, the
workaround is to specify a widthHint to the GridData constraint object.

>
> I could write the code to calculate the preferred palette width but I
would
> attempt to cycle through the pallete looking for the longest label. It
looks
> like the pallete code is already something like this but as you point out
> the preferred size for a collapse drawer doesn't take the length of its
> label into account.
>
> I am going to show my ignorance here. How would I set the pallete width
> hint?
>
> Having said all that, I have a better idea how this works and I appreciate
> the info.
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:c37gfa$fck$1@eclipse.org...
> > So, what you are saying is that the GridLayout is probably invoking
> > computeBounds on the palette's FigureCanvas, which in turn is invoking
> > getPreferredSize() on the palette. The problem here is that
DrawerFigure
> > (in its getPreferredSize(int, int) method) returns its minimum size --
> > effectively, the preferred size of its header -- when not expanded, and
> > doesn't bother asking its children for their preferred size. I don't
> think
> > this quite qualifies as a bug, because that is what would be expected of
> it.
> >
> > I am guessing you're seeing an ellipsis when you expand the drawer with
> the
> > entry that has the long label. Is that not acceptable?
> >
> > Do you support internationalization? What happens when a palette's
label
> > turns out to be really long in another language?
> >
> > I'd suggest that you set an appropriate width hint for the palette.
> >
> > "Chris White" <cwhite@ic.net> wrote in message
> > news:c37arp$7q9$1@eclipse.org...
> > > I am not asking the palette for its size. I am letting the palette
size
> > > itsself inside a composite that uses a grid layout (my own - I am not
> > using
> > > GraphicalEditorWithPalette). As I mentioned below the palette sizes
> > properly
> > > as long as the drawers is initially OPEN and it has a label that at
> least
> > as
> > > long as the drawer label.
> > >
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:c34g7u$ru3$1@eclipse.org...
> > > > What is your basis for asking hte palette its width?
> > > > Are you calling getPreferredSize or computeBounds?
> > > >
> > > > "Chris White" <cwhite@ic.net> wrote in message
> > > > news:c34eg7$pbi$1@eclipse.org...
> > > > > It turns out the the width of the palette is fine if the intial
> state
> > of
> > > > the
> > > > > drawer is OPEN and the drawer contains some items with labels that
> are
> > > at
> > > > > least as long as the drawer label.
> > > > >
> > > > > It must be that the palette doesn't pay the the drawer label win
> > making
> > > > its
> > > > > sizing decisions.
> > > > >
> > > > > Should I report this as a bug?
> > > > >
> > > > > "Chris White" <cwhite@ic.net> wrote in message
> > > > > news:c32jnh$s3m$1@eclipse.org...
> > > > > > I have a palette that contains PaletteGroups and and a
> > PaletteDrawer.
> > > > When
> > > > > > the palette is displayed the palette width is insufficient to
> > display
> > > > the
> > > > > > entire label for the PaletteDrawer. Everything looks good if I
use
> > all
> > > > > > PalletteDrawers.
> > > > > >
> > > > > > Is there some property I can set that will cause the palette to
> > > display
> > > > > with
> > > > > > its width sized to contain the longest label?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Width of palette when using PaletteGroup and PalleteDrawer [message #122693 is a reply to message #122678] Tue, 16 March 2004 20:22 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Chris White" <cwhite@ic.net> wrote in message
news:c37jsb$jr6$1@eclipse.org...
> Thank you for the response.
>
> It doesn't make sense to me that the collapsed (or expanded) drawer would
> not be wide enough to display its own label. In my opinion this is a bug
> (albiet a very tiny bug!).

Aah. I misunderstood. I thought you meant that the drawer, in its
collapsed state, wasn't wide enough to completely fit the label of one of
its children (i.e., one of the palette entries inside the drawer). Right,
so the problem is still in getPreferredSize(int, int) in DrawerFigure. I
misspoke earlier when I said that,
when in collapsed state, the drawer's getMinimumSize() effectively returns
the preferred size of the header. A little more digging, and I realized
that it actually returns the minimum size of the header, which isn't wide
enough for the label.

> I am going to show my ignorance here. How would I set the pallete width
> hint?

GridData data = new GridData();
data.widthHint = 200;
widget.setData(data);

>
> Having said all that, I have a better idea how this works and I appreciate
> the info.
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:c37gfa$fck$1@eclipse.org...
> > So, what you are saying is that the GridLayout is probably invoking
> > computeBounds on the palette's FigureCanvas, which in turn is invoking
> > getPreferredSize() on the palette. The problem here is that
DrawerFigure
> > (in its getPreferredSize(int, int) method) returns its minimum size --
> > effectively, the preferred size of its header -- when not expanded, and
> > doesn't bother asking its children for their preferred size. I don't
> think
> > this quite qualifies as a bug, because that is what would be expected of
> it.
> >
> > I am guessing you're seeing an ellipsis when you expand the drawer with
> the
> > entry that has the long label. Is that not acceptable?
> >
> > Do you support internationalization? What happens when a palette's
label
> > turns out to be really long in another language?
> >
> > I'd suggest that you set an appropriate width hint for the palette.
> >
> > "Chris White" <cwhite@ic.net> wrote in message
> > news:c37arp$7q9$1@eclipse.org...
> > > I am not asking the palette for its size. I am letting the palette
size
> > > itsself inside a composite that uses a grid layout (my own - I am not
> > using
> > > GraphicalEditorWithPalette). As I mentioned below the palette sizes
> > properly
> > > as long as the drawers is initially OPEN and it has a label that at
> least
> > as
> > > long as the drawer label.
> > >
> > >
> > > "Randy Hudson" <none@us.ibm.com> wrote in message
> > > news:c34g7u$ru3$1@eclipse.org...
> > > > What is your basis for asking hte palette its width?
> > > > Are you calling getPreferredSize or computeBounds?
> > > >
> > > > "Chris White" <cwhite@ic.net> wrote in message
> > > > news:c34eg7$pbi$1@eclipse.org...
> > > > > It turns out the the width of the palette is fine if the intial
> state
> > of
> > > > the
> > > > > drawer is OPEN and the drawer contains some items with labels that
> are
> > > at
> > > > > least as long as the drawer label.
> > > > >
> > > > > It must be that the palette doesn't pay the the drawer label win
> > making
> > > > its
> > > > > sizing decisions.
> > > > >
> > > > > Should I report this as a bug?
> > > > >
> > > > > "Chris White" <cwhite@ic.net> wrote in message
> > > > > news:c32jnh$s3m$1@eclipse.org...
> > > > > > I have a palette that contains PaletteGroups and and a
> > PaletteDrawer.
> > > > When
> > > > > > the palette is displayed the palette width is insufficient to
> > display
> > > > the
> > > > > > entire label for the PaletteDrawer. Everything looks good if I
use
> > all
> > > > > > PalletteDrawers.
> > > > > >
> > > > > > Is there some property I can set that will cause the palette to
> > > display
> > > > > with
> > > > > > its width sized to contain the longest label?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:Handles wont move
Next Topic:Forcing Figure Redraw
Goto Forum:
  


Current Time: Tue Jul 16 05:00:45 GMT 2024

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

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

Back to the top