Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Content pane will grow but won't shrink
Content pane will grow but won't shrink [message #194726] Mon, 05 September 2005 12:34 Go to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
Greetings,

I have a container edit part whose content pane's size should be always
as specified in the size properties of its model. Therefore, whenever
the edit part's model's size properties change, I'm setting the edit
part's content figure size using setMinimumSize(), setPreferredSize()
and setMaximumSize() (just setting the preferred size isn't enough, but
that's another story). This works fine whenever the model's size grows,
but doesn't work when it shrinks.

The edit part's figure looks as follows:

+-------------+
| title |
+-------------+
| |
| layeredPane |
| |
+-------------+

The title and layered pane are laid out using a ToolbarLayout. The
layeredPane contains three layers, one of which is the content pane. The
contentPane is the only figure with children, and it's using an XYLayout.

Why won't the edit part's figure shrink? How do I fix this?

Thank you very much in advance,

Martijn.
Re: Content pane will grow but won't shrink [message #194831 is a reply to message #194726] Tue, 06 September 2005 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Perhaps the other layers in the layered pane are returning preferred sizes
bigger than the content pane because they were previously sized to be that
big when the content pane reported that size.

"Martijn van Steenbergen" <mvsteenbergen@eljakim.nl> wrote in message
news:dfhe1k$je3$1@news.eclipse.org...
> Greetings,
>
> I have a container edit part whose content pane's size should be always
> as specified in the size properties of its model. Therefore, whenever
> the edit part's model's size properties change, I'm setting the edit
> part's content figure size using setMinimumSize(), setPreferredSize()
> and setMaximumSize() (just setting the preferred size isn't enough, but
> that's another story). This works fine whenever the model's size grows,
> but doesn't work when it shrinks.
>
> The edit part's figure looks as follows:
>
> +-------------+
> | title |
> +-------------+
> | |
> | layeredPane |
> | |
> +-------------+
>
> The title and layered pane are laid out using a ToolbarLayout. The
> layeredPane contains three layers, one of which is the content pane. The
> contentPane is the only figure with children, and it's using an XYLayout.
>
> Why won't the edit part's figure shrink? How do I fix this?
>
> Thank you very much in advance,
>
> Martijn.
Re: Content pane will grow but won't shrink [message #194868 is a reply to message #194831] Tue, 06 September 2005 14:43 Go to previous messageGo to next message
Martijn van Steenbergen is currently offline Martijn van SteenbergenFriend
Messages: 16
Registered: July 2009
Junior Member
You are right. I solved it by calling setPreferredSize(0, 0) on the
layer at creation, and now it's working fine. Thank you so much. :)

Martijn.

Pratik Shah wrote:
> Perhaps the other layers in the layered pane are returning preferred sizes
> bigger than the content pane because they were previously sized to be that
> big when the content pane reported that size.
Re: Content pane will grow but won't shrink [message #194904 is a reply to message #194868] Tue, 06 September 2005 15:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Was this a bug in my code or in GEF's code?

It seems to be related to the fact that the layer doesn't have a layout
manager. In that case Figure.getPreferredSize() returns getSize(). Why
doesn't it return a (0, 0) dimension?

Regards,

Martijn.

Martijn van Steenbergen wrote:
> You are right. I solved it by calling setPreferredSize(0, 0) on the
> layer at creation, and now it's working fine. Thank you so much. :)
Re: Content pane will grow but won't shrink [message #195225 is a reply to message #194904] Thu, 08 September 2005 17:13 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

"Martijn van Steenbergen" <mvsteenbergen@eljakim.scratch-this.nl> wrote in
message news:dfkdi9$d1p$1@news.eclipse.org...
> Was this a bug in my code or in GEF's code?

In your code.

>
> It seems to be related to the fact that the layer doesn't have a layout
> manager. In that case Figure.getPreferredSize() returns getSize(). Why
> doesn't it return a (0, 0) dimension?

Since a figure's intial size is 0,0, it would have returned that; however,
since it had been resized it's returning that size as its preferred one
(which is a useful default). If you were to set the size of a
RectangleFigure to be 100x100, you'd want it to maintain that size. The
proper thing is to set the layer's preferred size or give it the capability
to calculate its actual preferred size (by setting a layout manager).

>
> Regards,
>
> Martijn.
>
> Martijn van Steenbergen wrote:
> > You are right. I solved it by calling setPreferredSize(0, 0) on the
> > layer at creation, and now it's working fine. Thank you so much. :)
Previous Topic:Drag and Drop - one more time
Next Topic:How to add color gradient to a figure ( can't call getGC from Figure ?)
Goto Forum:
  


Current Time: Sun Jan 19 19:31:26 GMT 2025

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

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

Back to the top