Width of palette when using PaletteGroup and PalleteDrawer [message #122213] |
Sun, 14 March 2004 16:48  |
Eclipse User |
|
|
|
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 #122689 is a reply to message #122678] |
Tue, 16 March 2004 14:30   |
Eclipse User |
|
|
|
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 15:22  |
Eclipse User |
|
|
|
"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?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08795 seconds