Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » laying out views (RCP)
laying out views (RCP) [message #433047] Thu, 01 April 2004 08:02 Go to next message
Eclipse UserFriend
Hi All,

Can anyone let me know whether it is possible to configure views using a
layout manager? I basically have a need a grid of views but when the
main window is resized (or a single view removed) I would like the
surrounding views to position themselves, not resize themselfs - Like if
they were arranged in a RowLayout. Is this possible?

e.g. So for perspective which has nine views arranged

xxx
xxx
xxx

I would like to be able to remove _any_ one of these views and the
resultant configuration is always

xxx
xxx
xx

And I would like to be able to resize the frame and the views stack
appropriatly (again, not resize)

e.g. if the view was horizontally stretched

xxxx
xxxx
x

or if the view was vertically stretched and horizonally compressed

xx
xx
xx
xx
x

Any thoughts?

Many Thanks
Re: laying out views (RCP) [message #433112 is a reply to message #433047] Thu, 01 April 2004 17:46 Go to previous messageGo to next message
Eclipse UserFriend
You got a couple of options here. First off, you could write your own
layout manager to handle this for you. Not exactly a hard task, and
definitely the most elegant solution. Another option is to use two
RowLayout managers one SWT.VERTICAL, the other SWT.HORIZONTAL. Using
these, you could control the spacing of your views. You'd have to
remove and reconstruct every time a view is removed or moved though.
Not cool. Finally, you could use GridLayout and accomplish the same
thing. However, you'd still need to manually reorder everything. Of
course, your final option is probably the no brainer as far as
simplicity. Use RowLayout#wrap to set your instance of RowLayout
controlling the whole Composite to wrap the views to the next line if
you don't have enough space. The obvious downside to this is being
unable to constrain the individual views to a certain size. Hope this
helped.

Daniel

Vadalus wrote:

> Hi All,
>
> Can anyone let me know whether it is possible to configure views using
> a layout manager? I basically have a need a grid of views but when the
> main window is resized (or a single view removed) I would like the
> surrounding views to position themselves, not resize themselfs - Like
> if they were arranged in a RowLayout. Is this possible?
>
> e.g. So for perspective which has nine views arranged
>
> xxx
> xxx
> xxx
>
> I would like to be able to remove _any_ one of these views and the
> resultant configuration is always
>
> xxx
> xxx
> xx
>
> And I would like to be able to resize the frame and the views stack
> appropriatly (again, not resize)
>
> e.g. if the view was horizontally stretched
>
> xxxx
> xxxx
> x
>
> or if the view was vertically stretched and horizonally compressed
>
> xx
> xx
> xx
> xx
> x
>
> Any thoughts?
>
> Many Thanks
Re: laying out views (RCP) [message #433113 is a reply to message #433112] Thu, 01 April 2004 21:15 Go to previous messageGo to next message
Eclipse UserFriend
Hi Daniel,

I guess the central thing I am confused about is that I do not seem to
have much control over how I add views to my perspective. It does not
look to me like I have such luxuries as layout managers at my disposal.
Am I missing something? Do you have a code snipper which shows how to
add a view to a perspective using a layout? That would be very very helpful!

Thanks for your time,



Daniel Spiewak wrote:
> You got a couple of options here. First off, you could write your own
> layout manager to handle this for you. Not exactly a hard task, and
> definitely the most elegant solution. Another option is to use two
> RowLayout managers one SWT.VERTICAL, the other SWT.HORIZONTAL. Using
> these, you could control the spacing of your views. You'd have to
> remove and reconstruct every time a view is removed or moved though.
> Not cool. Finally, you could use GridLayout and accomplish the same
> thing. However, you'd still need to manually reorder everything. Of
> course, your final option is probably the no brainer as far as
> simplicity. Use RowLayout#wrap to set your instance of RowLayout
> controlling the whole Composite to wrap the views to the next line if
> you don't have enough space. The obvious downside to this is being
> unable to constrain the individual views to a certain size. Hope this
> helped.
>
> Daniel
>
> Vadalus wrote:
>
>> Hi All,
>>
>> Can anyone let me know whether it is possible to configure views using
>> a layout manager? I basically have a need a grid of views but when the
>> main window is resized (or a single view removed) I would like the
>> surrounding views to position themselves, not resize themselfs - Like
>> if they were arranged in a RowLayout. Is this possible?
>>
>> e.g. So for perspective which has nine views arranged
>>
>> xxx
>> xxx
>> xxx
>>
>> I would like to be able to remove _any_ one of these views and the
>> resultant configuration is always
>>
>> xxx
>> xxx
>> xx
>>
>> And I would like to be able to resize the frame and the views stack
>> appropriatly (again, not resize)
>>
>> e.g. if the view was horizontally stretched
>>
>> xxxx
>> xxxx
>> x
>>
>> or if the view was vertically stretched and horizonally compressed
>>
>> xx
>> xx
>> xx
>> xx
>> x
>>
>> Any thoughts?
>>
>> Many Thanks
Re: laying out views (RCP) [message #434483 is a reply to message #433047] Sat, 17 April 2004 11:38 Go to previous message
Eclipse UserFriend
Nope. Layout managers are only for use for controls *within* views.

When you add a few to the workbench page, whether you're doing it in XML or
in code, you specify another view that you want it above, below, to the
side, or on top of. If it's not on top of another view you can specify a
ratio to use for the initial size. See IPageLayout.addView() for doing this
in code, and the perspectiveExtensions extension point for doing it in XML.

Unfortunately (or fortunately depending on your point of view) page layouts
are not as flexible as the control layout managers so there's no way to set
up the flow or wrap you're describing here. Maybe instead of multiple view
parts you could make it one big view with child Composites, which *could* be
managed by a Layout manager.

--
Ed Burnette, co-author, Eclipse in Action
www.eclipsepowered.org

"Vadalus" <news@vadalus.com> wrote in message
news:c4h3ko$qmi$1@eclipse.org...
> Hi All,
>
> Can anyone let me know whether it is possible to configure views using a
> layout manager? I basically have a need a grid of views but when the
> main window is resized (or a single view removed) I would like the
> surrounding views to position themselves, not resize themselfs - Like if
> they were arranged in a RowLayout. Is this possible?
>
> e.g. So for perspective which has nine views arranged
>
> xxx
> xxx
> xxx
>
> I would like to be able to remove _any_ one of these views and the
> resultant configuration is always
>
> xxx
> xxx
> xx
>
> And I would like to be able to resize the frame and the views stack
> appropriatly (again, not resize)
>
> e.g. if the view was horizontally stretched
>
> xxxx
> xxxx
> x
>
> or if the view was vertically stretched and horizonally compressed
>
> xx
> xx
> xx
> xx
> x
>
> Any thoughts?
>
> Many Thanks
Previous Topic:binding exception
Next Topic:HELP! I need to download SWT
Goto Forum:
  


Current Time: Mon Sep 22 23:54:47 EDT 2025

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

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

Back to the top