Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT. How to set absolute (null) layout?
XWT. How to set absolute (null) layout? [message #517398] Sat, 27 February 2010 14:27 Go to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
I have empty custom Composite that sets RowLayout in its constructor.
I want to use this Composite in XWT, but use instead absolute layout.
How can I do this? We don't have class with name "AbsoluteLayout". I've tried to use attribute layout="null", but this also does not work.

org.eclipse.e4.xwt.XWTException: Converter is missing of type: org.eclipse.swt.widgets.Layout from String



Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #518916 is a reply to message #517398] Fri, 05 March 2010 12:36 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 853
Registered: July 2009
Senior Member
If you do not want a layout to be set at all, then you would do nothing...

There are plenty of xwt snippets in the tests plugins (org.eclipse.e4.xwt.tests).
Re: XWT. How to set absolute (null) layout? [message #518926 is a reply to message #517398] Fri, 05 March 2010 13:33 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
My custom component MyComposite already has RowLayout set.
I would like to change it at some usage points to absolute layout.
I.e. I mean that not all components have absolute layout as implicit, sometimes I need to set it explicitly.


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #519038 is a reply to message #518926] Fri, 05 March 2010 19:42 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 853
Registered: July 2009
Senior Member
Then, you would go like this:

<MyComposite.layout>
<AbsoluteLayout />
</MyComposite.layout>


Though, I am not sure what this "Absolute Layout" is all about as there is no such thing in SWT. AFAIK, in swt, you always need a layout to be set to get the controls rendered...

You would need to make the AbsoluteLayout class visible to XWT:

<j:MyComposite xmlns:j="clr-namespace:com.example.mywidgets" ...

where com.example.mywidgets is the package that contains MyComposite and AbsoluteLayout.

Regarding the converter exception: You need a converter that can translate the "null" string to a null object.
I am not sure if xwt has such a converter. Then, you could do this, I guess:

<MyComposite layout="null" />

See XWT.registerConvertor().
Re: XWT. How to set absolute (null) layout? [message #519043 is a reply to message #517398] Fri, 05 March 2010 20:23 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
"Absolute layout" is default layout of Composite, i.e. "null" layout.
It is not my custom layout.

So, I wonder why I can set "normal" layout like RowLayout, but can not set such basic layout as absolute.

Would be good if there was already support for setting absolute layout in XWT, for completeness of layouts support.

Thank you for hint about converter.


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #519057 is a reply to message #519043] Fri, 05 March 2010 22:34 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 853
Registered: July 2009
Senior Member
Yes, that is a quite complex requirement that is not easy to implement Smile
Re: XWT. How to set absolute (null) layout? [message #520422 is a reply to message #518926] Fri, 12 March 2010 05:48 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
I think it is a dynamic aspect, which can be handled by Java using SWT/Jface
APIs.

yves
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hmr17f$9q5$1@build.eclipse.org...
> My custom component MyComposite already has RowLayout set.
> I would like to change it at some usage points to absolute layout.
> I.e. I mean that not all components have absolute layout as implicit,
> sometimes I need to set it explicitly.
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #520431 is a reply to message #520422] Fri, 12 March 2010 10:56 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Fri, 12 March 2010 08:48
I think it is a dynamic aspect, which can be handled by Java using SWT/Jface
APIs.


Why is this dynamic aspect?
Why is it different than setting any other layout, such as RowLayout or GridLayout?

For example NetBeans also uses XML for storing layouts, but it allows you set "Null layout".


Konstantin Scheglov,
Google, Inc.

[Updated on: Fri, 12 March 2010 10:57]

Report message to a moderator

Re: XWT. How to set absolute (null) layout? [message #520571 is a reply to message #520431] Fri, 12 March 2010 15:58 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hnd6ld$qnd$1@build.eclipse.org...
> Yves YANG wrote on Fri, 12 March 2010 08:48
>> I think it is a dynamic aspect, which can be handled by Java using
>> SWT/Jface APIs.
>
>
> Why is this dynamic aspect?

It is because the change occurs after the UI resource is loaded and in
general, it is relative to an event.

> Why is it different than setting any other layout, such as RowLayout or
> GridLayout?
>
> For example NetBeans also uses XML for storing layouts, but it allows you
> set "Null layout".

You can set any Layout, which is used when the resource gets loaded.

Regards
Yves YANG
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #520574 is a reply to message #520571] Fri, 12 March 2010 21:05 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
You don't understand me.

I don't want to change layout as result of some event, such as when user clicks on Button. I just want to set "null" layout statically, in XWT, for some Composite subclass.

You probably think that all Composites have "null" layout by default, I also was some time under such impression, but it is not. So, if we want to use "null" layout on such Composite, we have to set it. But it seems that right now XWT does not provide such feature. This is not good, because breaks symmetry in using layouts.


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #520581 is a reply to message #517398] Fri, 12 March 2010 21:38 Go to previous messageGo to next message
Frank Gualtieri is currently offline Frank GualtieriFriend
Messages: 20
Registered: February 2010
Junior Member
I know I am late in posting this since your last post was in July, but I've just started to look at XWT. I've been trying to get the FormLayout to work as it does in SWT but there seems to be some problems with it. (that is for another post).

As for using a null layout manager, you may want to use the FormLayout. It will allow you to set the x,y coordinates of your widgets in the same way (at least I think it would be in the same way as a null layout manager).

Here is an example of creating a composite that uses a FormLayout to place a single button 10 pixels down and 10 pixels to the right in the composite:

<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt"
xmlns:c="clr-namespace:sample.hello"
xmlns:j="clr-namespace:java.lang"
x:Class="sample.hello.HelloWorld"
bounds="0,0,449,171">
<Composite.layout>
<FormLayout /> <!--The composite uses a FormLayout -->
</Composite.layout>
<Button text="Some Button">
<Button.layoutData>
<!--The button is placed 0% plus 10 pixels from the composite's top
and 0% plus 10 pixels from the composite's left side
NOTE: the percent is the of either the composites height (for top)
or the composites width (for left).
SO the end result is that the top, left corner of the button
is placed 10 pixels down and 10 pixels to the right -->
<FormData top="0,10" left="0,10"/>
</Button.layoutData>
</Button>
</Composite>

[Updated on: Fri, 12 March 2010 21:39]

Report message to a moderator

Re: XWT. How to set absolute (null) layout? [message #520606 is a reply to message #520574] Sat, 13 March 2010 04:59 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You mean in case a Composite has already a default layout. In XWT, you want
to set to null. It is true by now, it is not possible. Please fill a bug in
bugzilla.

best regards
Yves YANG
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hneabl$e8t$1@build.eclipse.org...
> You don't understand me.
>
> I don't want to change layout as result of some event, such as when user
> clicks on Button. I just want to set "null" layout statically, in XWT, for
> some Composite subclass.
>
> You probably think that all Composites have "null" layout by default, I
> also was some time under such impression, but it is not. So, if we want to
> use "null" layout on such Composite, we have to set it. But it seems that
> right now XWT does not provide such feature. This is not good, because
> breaks symmetry in using layouts.
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #520610 is a reply to message #520606] Sat, 13 March 2010 08:22 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Sat, 13 March 2010 07:59
You mean in case a Composite has already a default layout. In XWT, you want
to set to null. It is true by now, it is not possible. Please fill a bug in
bugzilla.



Already did this about week ago. Smile
https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #520611 is a reply to message #520610] Sat, 13 March 2010 09:36 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Thanks
yves
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hnfi17$jda$1@build.eclipse.org...
> Yves YANG wrote on Sat, 13 March 2010 07:59
>> You mean in case a Composite has already a default layout. In XWT, you
>> want to set to null. It is true by now, it is not possible. Please fill a
>> bug in bugzilla.
>
>
> Already did this about week ago. :)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #530923 is a reply to message #520611] Sun, 02 May 2010 20:38 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The fix is committed in CVS -> 20100502.

Regards
Yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hnfmb1$33f$1@build.eclipse.org...
> Thanks
> yves
> "Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
> news:hnfi17$jda$1@build.eclipse.org...
>> Yves YANG wrote on Sat, 13 March 2010 07:59
>>> You mean in case a Composite has already a default layout. In XWT, you
>>> want to set to null. It is true by now, it is not possible. Please fill
>>> a bug in bugzilla.
>>
>>
>> Already did this about week ago. :)
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915
>>
>> --
>> Konstantin Scheglov,
>> Instantiations, Inc.
>
>
Re: XWT. How to set absolute (null) layout? [message #531200 is a reply to message #530923] Tue, 04 May 2010 07:45 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Mon, 03 May 2010 00:38
The fix is committed in CVS -> 20100502.



Thank you!
I can use it now.


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #569543 is a reply to message #519043] Fri, 05 March 2010 22:34 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 853
Registered: July 2009
Senior Member
Yes, that is a quite complex requirement that is not easy to implement :)
Re: XWT. How to set absolute (null) layout? [message #570424 is a reply to message #520574] Sat, 13 March 2010 04:59 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You mean in case a Composite has already a default layout. In XWT, you want
to set to null. It is true by now, it is not possible. Please fill a bug in
bugzilla.

best regards
Yves YANG
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hneabl$e8t$1@build.eclipse.org...
> You don't understand me.
>
> I don't want to change layout as result of some event, such as when user
> clicks on Button. I just want to set "null" layout statically, in XWT, for
> some Composite subclass.
>
> You probably think that all Composites have "null" layout by default, I
> also was some time under such impression, but it is not. So, if we want to
> use "null" layout on such Composite, we have to set it. But it seems that
> right now XWT does not provide such feature. This is not good, because
> breaks symmetry in using layouts.
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #570453 is a reply to message #520606] Sat, 13 March 2010 08:23 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Sat, 13 March 2010 07:59
> You mean in case a Composite has already a default layout. In XWT, you want
> to set to null. It is true by now, it is not possible. Please fill a bug in
> bugzilla.


Already did this about week ago. :)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915

--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Re: XWT. How to set absolute (null) layout? [message #570465 is a reply to message #570453] Sat, 13 March 2010 09:36 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Thanks
yves
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hnfi17$jda$1@build.eclipse.org...
> Yves YANG wrote on Sat, 13 March 2010 07:59
>> You mean in case a Composite has already a default layout. In XWT, you
>> want to set to null. It is true by now, it is not possible. Please fill a
>> bug in bugzilla.
>
>
> Already did this about week ago. :)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: XWT. How to set absolute (null) layout? [message #575393 is a reply to message #520611] Sun, 02 May 2010 20:38 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The fix is committed in CVS -> 20100502.

Regards
Yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hnfmb1$33f$1@build.eclipse.org...
> Thanks
> yves
> "Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
> news:hnfi17$jda$1@build.eclipse.org...
>> Yves YANG wrote on Sat, 13 March 2010 07:59
>>> You mean in case a Composite has already a default layout. In XWT, you
>>> want to set to null. It is true by now, it is not possible. Please fill
>>> a bug in bugzilla.
>>
>>
>> Already did this about week ago. :)
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=304915
>>
>> --
>> Konstantin Scheglov,
>> Instantiations, Inc.
>
>
Re: XWT. How to set absolute (null) layout? [message #575538 is a reply to message #530923] Tue, 04 May 2010 07:45 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Mon, 03 May 2010 00:38
> The fix is committed in CVS -> 20100502.


Thank you!
I can use it now.

--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Previous Topic:XWT. Form and setHeadClient().
Next Topic:Load XWT content dynamically
Goto Forum:
  


Current Time: Sat Feb 22 08:06:26 GMT 2020

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

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

Back to the top