Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » [XWT] Custom Widgets & Databinding(Pure XWT vs Java)
[XWT] Custom Widgets & Databinding [message #629090] Mon, 27 September 2010 07:48 Go to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 1
Registered: September 2010
Junior Member
Hello,

I'm currently exploring the possibilities of XWT for building UIs. I'd like to create custom widgets, to avoid redundancies in such a code :

MyUI.xwt :
<Composite>
	<Composite>
		<Label text="Property 1" />
		<Text text="{Databinding path=property1}" />
	</Composite>
	<Composite>
		<Label text="Property 2" />
		<Text text="{Databinding path=property2}" />
	</Composite>
</Composite>

We can see a common structure between the different items, so I tried to factorise this code by adding a custom widget, which could look something like that :

MyUI.xwt :
<Composite>
	<MyStringWidget label="Property 1" bindingPath="property1" />
	<MyStringWidget label="Property 2" bindingPath="property2" />
</Composite>

MyStringWidget.xwt :
<Composite>
	<Label text="..." />
	<Text text="{Binding path=...}" />
</Composite>

But I don't know how to pass custom arguments to a widget written in pure XWT. It is possible in Java/SWT, but it means I would lose two things : the declarative aspect of the custom widget, and the Databinding facility. Is there any way to do that in pure XWT ?

If not, how could I use the XWT Databinding, programmatically ?


Thanks,
Camille
Re: [XWT] Custom Widgets & Databinding [message #629918 is a reply to message #629090] Wed, 29 September 2010 23:33 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Camille Letavernier" <camille.letavernier@wanadoo.fr> wrote in message
news:i7pi45$f1i$1@news.eclipse.org...
> Hello,
> I'm currently exploring the possibilities of XWT for building UIs. I'd
> like to create custom widgets, to avoid redundancies in such a code :
> MyUI.xwt :
> <Composite>
> <Composite>
> <Label text="Property 1" />
> <Text text="{Databinding path=property1}" />
> </Composite>
> <Composite>
> <Label text="Property 2" />
> <Text text="{Databinding path=property2}" />
> </Composite>
> </Composite>
> We can see a common structure between the different items, so I tried to
> factorise this code by adding a custom widget, which could look something
> like that :
>
> MyUI.xwt :
> <Composite>
> <MyStringWidget label="Property 1" bindingPath="property1" />
> <MyStringWidget label="Property 2" bindingPath="property2" />
> </Composite>
> MyStringWidget.xwt :
> <Composite>
> <Label text="..." />
> <Text text="{Binding path=...}" />
> </Composite>
> But I don't know how to pass custom arguments to a widget written in pure
> XWT. It is possible in Java/SWT, but it means I would lose two things :
> the declarative aspect of the custom widget, and the Databinding facility.
> Is there any way to do that in pure XWT ?
>
> If not, how could I use the XWT Databinding, programmatically ?
In general, custom widget is supported. But your case is different. You want
simplify the expression of data binding by bindingPath="property1". It is
not possible to use
Custom Widgets. The solution I see is to use the preprocessing: using the
option IXWTLoader.BEFORE_PARSING_CALLBACK for the XWT.load(). The value of
this option should be IBeforeParsingCallback.

best regards
Yves YANG
>
>
> Thanks,
> Camille
Previous Topic:"null argument:applicationXMI argument missing" when starting e4 RCP application
Next Topic:Window icon
Goto Forum:
  


Current Time: Thu Apr 25 22:55:27 GMT 2024

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

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

Back to the top