Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Convert LayoutManagers to SWT ...
Convert LayoutManagers to SWT ... [message #462893] Thu, 20 October 2005 10:15 Go to next message
Eclipse User
Originally posted by: konrad.my-rho.de

Hi,

is there a possibility to convert LayoutManagers from AWT to SWT? I
wrote my own AWT-Layoutmanager and want to use it in SWT.

In AWT I can set a property object when I add a component to a parent

Panel1.add( ButtonXYZ, new PropertyObject( ... ) );

I can use this property object in my LayoutManager later.

How can I realize this with the a new SWT LayoutManager? How can I set
such an object when I add a new component to a Composite?

Many Thanks
Konrad
Re: Convert LayoutManagers to SWT ... [message #462894 is a reply to message #462893] Thu, 20 October 2005 10:31 Go to previous messageGo to next message
Eclipse User
Originally posted by: arick.pobox.com

In the book, "The Definitive Guide to SWT an JFaces", they demonstate
porting the AWT BordeLayout class to SWT.

On Thu, 20 Oct 2005 16:15:54 +0200, Konrad Mühler wrote:

> Hi,
>
> is there a possibility to convert LayoutManagers from AWT to SWT? I
> wrote my own AWT-Layoutmanager and want to use it in SWT.
>
> In AWT I can set a property object when I add a component to a parent
>
> Panel1.add( ButtonXYZ, new PropertyObject( ... ) );
>
> I can use this property object in my LayoutManager later.
>
> How can I realize this with the a new SWT LayoutManager? How can I set
> such an object when I add a new component to a Composite?
>
> Many Thanks
> Konrad
Re: Convert LayoutManagers to SWT ... [message #462900 is a reply to message #462893] Thu, 20 October 2005 13:11 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel Spiewak
Messages: 263
Registered: July 2009
Senior Member
You can set layout parameters using the Control#setLayoutData(Object) method. As to porting layout managers between AWT and SWT, that's an art more than a science. It is possible to write custom SWT layout managers. In fact, having done both custom AWT and custom SWT layout managers extensively, I'd have to say that it's easier to do SWT layout managers once you get used to it. But there's no magic algorithm to switch between the two paradigms. And unfortunately, SWT layout manager algorithms are a world appart from AWT algorithms. I do have a class I wrote which allows you to write a somewhat generic layout manager (using only Rectangles and Point objects) which then can be used without modification as an AWT layout manager, a SwingWT layout manager, or an SWT layout manager. (I considered adding wxWidgets support as well but unfortunately, SWT and wxWidgets both use a abstract superclass rather than a superinterface for their layout managers). If you're interested, I'll post the class here.
Re: Convert LayoutManagers to SWT ... [message #462935 is a reply to message #462900] Fri, 21 October 2005 04:26 Go to previous message
Eclipse User
Originally posted by: konrad.my-rho.de

Daniel Spiewak wrote:
> You can set layout parameters using the Control#setLayoutData(Object) method. As to porting layout managers between AWT and SWT, that's an art more than a science. It is possible to write custom SWT layout managers. In fact, having done both custom AWT and custom SWT layout managers extensively, I'd have to say that it's easier to do SWT layout managers once you get used to it. But there's no magic algorithm to switch between the two paradigms. And unfortunately, SWT layout manager algorithms are a world appart from AWT algorithms. I do have a class I wrote which allows you to write a somewhat generic layout manager (using only Rectangles and Point objects) which then can be used without modification as an AWT layout manager, a SwingWT layout manager, or an SWT layout manager. (I considered adding wxWidgets support as well but unfortunately, SWT and wxWidgets both use a abstract superclass rather than a superinterface for their layout managers). If you're intereste
d, I'll post the class here.
Thank you very much!

I think the setLayoutData-Method is exactly the broken link a was
looking for :-)
Previous Topic:Swing vs SWT issues
Next Topic:TabFolder border ...
Goto Forum:
  


Current Time: Thu Jul 31 17:51:30 EDT 2014

Powered by FUDForum. Page generated in 0.01645 seconds