[XWT] Custom Widgets & Databinding [message #629090] |
Mon, 27 September 2010 07:48 |
Camille Letavernier 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 |
Yves YANG 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
|
|
|
Powered by
FUDForum. Page generated in 0.03929 seconds