Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Correct Layout Procedure?
Correct Layout Procedure? [message #219414] Wed, 12 July 2006 17:10 Go to next message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

Hi there,

I have a situation where I have a container (A) that has children (B),
each of which has children of its own (C). The container (A) resides in a
document which has an XYLayout, so when A is asked to refresh visuals, I
call setLayoutConstraint on the parent with the preferred size. However,
does this preferred size need to be calculated manually from the children
(B)? Likewise, when each of the children (B) is in refreshVisuals, do they
need to set a preferred dimension calculated manually using the sizes of
their children (C)?
What's the correct way to do this? I'm wondering if GEF handles this
for me, because right now I'm doing a bunch of calculations with insets and
children's edit parts' figures' sizes and whatnot. Basically I want A to be
large enough to accomodate all of the figures of B, which are each in turn
large enough to accomodate all of the figures of C, which are each sized on
the basis of a model constraint. Thanks in advance.

- Daniel
Re: Correct Layout Procedure? [message #219422 is a reply to message #219414] Thu, 13 July 2006 01:51 Go to previous messageGo to next message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
The way I understand this is: If you use a layout manager provided in
GEF, you don't have to calculate the preferred size because it is
provided to you. Take a look at the source code of one of the layout
manager and look for getPreferredSize() for more information. When you
create your own layout manager, however, you will have to calculate the
minimum size and the preferred size by yourself.


Daniel Rozeboom wrote:
> Hi there,
>
> I have a situation where I have a container (A) that has children (B),
> each of which has children of its own (C). The container (A) resides in a
> document which has an XYLayout, so when A is asked to refresh visuals, I
> call setLayoutConstraint on the parent with the preferred size. However,
> does this preferred size need to be calculated manually from the children
> (B)? Likewise, when each of the children (B) is in refreshVisuals, do they
> need to set a preferred dimension calculated manually using the sizes of
> their children (C)?
> What's the correct way to do this? I'm wondering if GEF handles this
> for me, because right now I'm doing a bunch of calculations with insets and
> children's edit parts' figures' sizes and whatnot. Basically I want A to be
> large enough to accomodate all of the figures of B, which are each in turn
> large enough to accomodate all of the figures of C, which are each sized on
> the basis of a model constraint. Thanks in advance.
>
> - Daniel
>
>
Re: Correct Layout Procedure? [message #219454 is a reply to message #219422] Thu, 13 July 2006 16:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

The way I have it running right now, it seems to be working correctly.
What I do here is I don't specify a height and width for the container (A);
I just specify its location and -1, -1 for width and height using
setLayoutConstraint(), and its parent has an XYLayout. Then A and B have
toolbar layouts, so they seem to resize themselves automatically - I never
specify sizes for them. The only place where I specify a size is in C,
where I say setPreferredSize() with information from the model. Is this the
correct way to do this, or am I calling some methods I shouldn't be? Also,
are setLayoutConstraint() and setPreferredSize() basically equivalent
operations for the XYLayout and ToolbarLayout, respectively? Thanks in
advance.

- Daniel

"Nhu Le" <nle.misc@gmail.com> wrote in message
news:e948vv$d3l$1@utils.eclipse.org...
> The way I understand this is: If you use a layout manager provided in
> GEF, you don't have to calculate the preferred size because it is provided
> to you. Take a look at the source code of one of the layout manager and
> look for getPreferredSize() for more information. When you create your
> own layout manager, however, you will have to calculate the minimum size
> and the preferred size by yourself.
>
>
> Daniel Rozeboom wrote:
>> Hi there,
>>
>> I have a situation where I have a container (A) that has children
>> (B), each of which has children of its own (C). The container (A)
>> resides in a document which has an XYLayout, so when A is asked to
>> refresh visuals, I call setLayoutConstraint on the parent with the
>> preferred size. However, does this preferred size need to be calculated
>> manually from the children (B)? Likewise, when each of the children (B)
>> is in refreshVisuals, do they need to set a preferred dimension
>> calculated manually using the sizes of their children (C)?
>> What's the correct way to do this? I'm wondering if GEF handles this
>> for me, because right now I'm doing a bunch of calculations with insets
>> and children's edit parts' figures' sizes and whatnot. Basically I want
>> A to be large enough to accomodate all of the figures of B, which are
>> each in turn large enough to accomodate all of the figures of C, which
>> are each sized on the basis of a model constraint. Thanks in advance.
>>
>> - Daniel
Re: Correct Layout Procedure? [message #219519 is a reply to message #219454] Mon, 17 July 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

preferredSize concept in draw2d is very similar to preferredSize in Swing,
and computeSize in SWT. It is only used if the parent or parent's layout
asks. In the case of XYLayout, the parent will ask if -1,-1 is the
width,height.


"Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
news:e95ro9$61e$1@utils.eclipse.org...
> The way I have it running right now, it seems to be working correctly.
> What I do here is I don't specify a height and width for the container
> (A); I just specify its location and -1, -1 for width and height using
> setLayoutConstraint(), and its parent has an XYLayout. Then A and B have
> toolbar layouts, so they seem to resize themselves automatically - I never
> specify sizes for them. The only place where I specify a size is in C,
> where I say setPreferredSize() with information from the model. Is this
> the correct way to do this, or am I calling some methods I shouldn't be?
> Also, are setLayoutConstraint() and setPreferredSize() basically
> equivalent operations for the XYLayout and ToolbarLayout, respectively?
> Thanks in advance.
>
> - Daniel
>
> "Nhu Le" <nle.misc@gmail.com> wrote in message
> news:e948vv$d3l$1@utils.eclipse.org...
>> The way I understand this is: If you use a layout manager provided in
>> GEF, you don't have to calculate the preferred size because it is
>> provided to you. Take a look at the source code of one of the layout
>> manager and look for getPreferredSize() for more information. When you
>> create your own layout manager, however, you will have to calculate the
>> minimum size and the preferred size by yourself.
>>
>>
>> Daniel Rozeboom wrote:
>>> Hi there,
>>>
>>> I have a situation where I have a container (A) that has children
>>> (B), each of which has children of its own (C). The container (A)
>>> resides in a document which has an XYLayout, so when A is asked to
>>> refresh visuals, I call setLayoutConstraint on the parent with the
>>> preferred size. However, does this preferred size need to be calculated
>>> manually from the children (B)? Likewise, when each of the children (B)
>>> is in refreshVisuals, do they need to set a preferred dimension
>>> calculated manually using the sizes of their children (C)?
>>> What's the correct way to do this? I'm wondering if GEF handles
>>> this for me, because right now I'm doing a bunch of calculations with
>>> insets and children's edit parts' figures' sizes and whatnot. Basically
>>> I want A to be large enough to accomodate all of the figures of B, which
>>> are each in turn large enough to accomodate all of the figures of C,
>>> which are each sized on the basis of a model constraint. Thanks in
>>> advance.
>>>
>>> - Daniel
>
>
Re: Correct Layout Procedure? [message #219571 is a reply to message #219519] Tue, 18 July 2006 17:07 Go to previous message
Eclipse UserFriend
Originally posted by: Daniel.Rozeboom.cda.canon.com

OK, I'm not totally sure if I understand everything that's happening behind
the scenes, but my layouts are working well. :) Thanks.

- Daniel

"Randy Hudson" <none@us.ibm.com> wrote in message
news:e9g1na$9su$1@utils.eclipse.org...
> preferredSize concept in draw2d is very similar to preferredSize in Swing,
> and computeSize in SWT. It is only used if the parent or parent's layout
> asks. In the case of XYLayout, the parent will ask if -1,-1 is the
> width,height.
>
>
> "Daniel Rozeboom" <Daniel.Rozeboom@cda.canon.com> wrote in message
> news:e95ro9$61e$1@utils.eclipse.org...
>> The way I have it running right now, it seems to be working correctly.
>> What I do here is I don't specify a height and width for the container
>> (A); I just specify its location and -1, -1 for width and height using
>> setLayoutConstraint(), and its parent has an XYLayout. Then A and B have
>> toolbar layouts, so they seem to resize themselves automatically - I
>> never specify sizes for them. The only place where I specify a size is
>> in C, where I say setPreferredSize() with information from the model. Is
>> this the correct way to do this, or am I calling some methods I shouldn't
>> be? Also, are setLayoutConstraint() and setPreferredSize() basically
>> equivalent operations for the XYLayout and ToolbarLayout, respectively?
>> Thanks in advance.
>>
>> - Daniel
>>
>> "Nhu Le" <nle.misc@gmail.com> wrote in message
>> news:e948vv$d3l$1@utils.eclipse.org...
>>> The way I understand this is: If you use a layout manager provided in
>>> GEF, you don't have to calculate the preferred size because it is
>>> provided to you. Take a look at the source code of one of the layout
>>> manager and look for getPreferredSize() for more information. When you
>>> create your own layout manager, however, you will have to calculate the
>>> minimum size and the preferred size by yourself.
>>>
>>>
>>> Daniel Rozeboom wrote:
>>>> Hi there,
>>>>
>>>> I have a situation where I have a container (A) that has children
>>>> (B), each of which has children of its own (C). The container (A)
>>>> resides in a document which has an XYLayout, so when A is asked to
>>>> refresh visuals, I call setLayoutConstraint on the parent with the
>>>> preferred size. However, does this preferred size need to be
>>>> calculated manually from the children (B)? Likewise, when each of the
>>>> children (B) is in refreshVisuals, do they need to set a preferred
>>>> dimension calculated manually using the sizes of their children (C)?
>>>> What's the correct way to do this? I'm wondering if GEF handles
>>>> this for me, because right now I'm doing a bunch of calculations with
>>>> insets and children's edit parts' figures' sizes and whatnot.
>>>> Basically I want A to be large enough to accomodate all of the figures
>>>> of B, which are each in turn large enough to accomodate all of the
>>>> figures of C, which are each sized on the basis of a model constraint.
>>>> Thanks in advance.
>>>>
>>>> - Daniel
>>
>>
>
>
Previous Topic:Snap To Grid
Next Topic:EditorPart setPartName
Goto Forum:
  


Current Time: Thu Dec 08 17:30:31 GMT 2022

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

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

Back to the top