Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Develop reusable Custom Widgets In XWT
Develop reusable Custom Widgets In XWT [message #503761] Tue, 15 December 2009 11:10 Go to next message
Jinshan  is currently offline Jinshan Friend
Messages: 24
Registered: December 2009
Junior Member
Thanks for the answers from Yves YANG in e4 developer mailing list.

For example:
In your example, DecoratedText have property ,text, then the widgets will be used as following:

<Composite xmlns:c="clr-namespace:ext.custom">
<c:DecoratedText text="newWidgets" />
</Composite>

and :
DecoratedText.java
------------------
package ext.custom;

public class DecoratedText {
private String text;

....

...

// event handling methods
...
}

DecoratedText.xwt
------------------
<Composite x:Class="ext.custom.DecoratedText">
<Label text={xxxxxx??}/> <!-How to do? Label.text="newWidgets"->
<Text/>
</Composite>

How to get the property text in DecoratedText.xwt and set it into a Label or others.

Thanks

[Updated on: Tue, 15 December 2009 11:13]

Report message to a moderator

Re: Develop reusable Custom Widgets In XWT [message #503823 is a reply to message #503761] Tue, 15 December 2009 17:04 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
> How to get the property text in DecoratedText.xwt and set it into a Label
> or others.
By now, you need to give them a name. and then call
XWT.findElementByName(context, "<name>");

<Composite x:Class="ext.custom.DecoratedText">
<Label name="myText" text={xxxxxx??}/>
<Text/>
</Composite>

protected void eventHandle(Object sender, Event event) {
Text text = (Text) XWT.findElementByName(event.widget, "myText");
}

We are considering to provide automatic solution to initialize the class
Field to avoid the manuel research call

Best regards
Yves YANG
"Jinshan" <jinshanl@gmail.com> wrote in message
news:hg8ce9$hmb$1@build.eclipse.org...
> Thanks for the answers from Yves YANG in e4 developer mailing list.
>
> For example:
> In your example, DecoratedText have property ,text, then the widgets will
> be used as following:
>
> <Composite xmlns:c="clr-namespace:ext.custom">
> <c:DecoratedText text="newWidgets" />
> </Composite>
>
> and :
> DecoratedText.java
> ------------------
> package ext.custom;
>
> public class DecoratedText {
> private String text;
>
> ....
> ...
>
> // event handling methods
> ...
> }
>
> DecoratedText.xwt
> ------------------
> <Composite x:Class="ext.custom.DecoratedText">
> <Label text={xxxxxx??}/>
> <Text/>
> </Composite>
>
> How to get the property text in DecoratedText.xwt and set it into a Label
> or others.
>
> Thanks
Re: Develop reusable Custom Widgets In XWT [message #503836 is a reply to message #503823] Tue, 15 December 2009 23:00 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Here is the bug for this feature:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hg90to$fq7$1@build.eclipse.org...
>> How to get the property text in DecoratedText.xwt and set it into a Label
>> or others.
> By now, you need to give them a name. and then call
> XWT.findElementByName(context, "<name>");
>
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText" text={xxxxxx??}/>
> <Text/>
> </Composite>
>
> protected void eventHandle(Object sender, Event event) {
> Text text = (Text) XWT.findElementByName(event.widget, "myText");
> }
>
> We are considering to provide automatic solution to initialize the class
> Field to avoid the manuel research call
>
> Best regards
> Yves YANG
> "Jinshan" <jinshanl@gmail.com> wrote in message
> news:hg8ce9$hmb$1@build.eclipse.org...
>> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>
>> For example:
>> In your example, DecoratedText have property ,text, then the widgets will
>> be used as following:
>>
>> <Composite xmlns:c="clr-namespace:ext.custom">
>> <c:DecoratedText text="newWidgets" />
>> </Composite>
>>
>> and :
>> DecoratedText.java
>> ------------------
>> package ext.custom;
>>
>> public class DecoratedText {
>> private String text;
>>
>> ....
>> ...
>>
>> // event handling methods
>> ...
>> }
>>
>> DecoratedText.xwt
>> ------------------
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label text={xxxxxx??}/>
>> <Text/>
>> </Composite>
>>
>> How to get the property text in DecoratedText.xwt and set it into a Label
>> or others.
>>
>> Thanks
>
>
Re: Develop reusable Custom Widgets In XWT [message #503851 is a reply to message #503836] Wed, 16 December 2009 02:43 Go to previous messageGo to next message
Jinshan  is currently offline Jinshan Friend
Messages: 24
Registered: December 2009
Junior Member
Thanks.

Are there some way to bind DecoratedText.java's properties to DecoratedText.xwt.?

For example:
<c:DecoratedText text="newWidgets" />

then
<Composite x:Class="ext.custom.DecoratedText">
<Label name="myText"/>
<Text/>
</Composite>

"myText" Label is changed automatic and I need not handle "text" changed event. I know the SilverLight is OK.





Yves YANG wrote on Tue, 15 December 2009 18:00
Here is the bug for this feature:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hg90to$fq7$1@build.eclipse.org...
>> How to get the property text in DecoratedText.xwt and set it into a Label
>> or others.
> By now, you need to give them a name. and then call
> XWT.findElementByName(context, "<name>");
>
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText" text={xxxxxx??}/>
> <Text/>
> </Composite>
>
> protected void eventHandle(Object sender, Event event) {
> Text text = (Text) XWT.findElementByName(event.widget, "myText");
> }
>
> We are considering to provide automatic solution to initialize the class
> Field to avoid the manuel research call
>
> Best regards
> Yves YANG
> "Jinshan" <jinshanl@gmail.com> wrote in message
> news:hg8ce9$hmb$1@build.eclipse.org...
>> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>
>> For example:
>> In your example, DecoratedText have property ,text, then the widgets will
>> be used as following:
>>
>> <Composite xmlns:c="clr-namespace:ext.custom">
>> <c:DecoratedText text="newWidgets" />
>> </Composite>
>>
>> and :
>> DecoratedText.java
>> ------------------
>> package ext.custom;
>>
>> public class DecoratedText {
>> private String text;
>>
>> ....
>> ...
>>
>> // event handling methods
>> ...
>> }
>>
>> DecoratedText.xwt
>> ------------------
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label text={xxxxxx??}/>
>> <Text/>
>> </Composite>
>>
>> How to get the property text in DecoratedText.xwt and set it into a Label
>> or others.
>>
>> Thanks
>
>

Re: Develop reusable Custom Widgets In XWT [message #504071 is a reply to message #503851] Wed, 16 December 2009 15:03 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The simple solution is you create a "String text" property in DecoratedText.
In the setter, you can update the content in your widget text or label.

It should be possible to express in XAML. But we need to add a keyword in
binding expression "self". It is not yet supported in XWT.

The code should be:
<Composite x:Class="ext.custom.DecoratedText">
<Label name="myText"/>
<Text text="{Binding source=self,path=text}" />
</Composite>

Best regards
yves
"Jinshan" <jinshanl@gmail.com> wrote in message
news:hg9hge$rl5$1@build.eclipse.org...
> Thanks.
>
> Are there some way to bind DecoratedText.java's properties to
> DecoratedText.xwt.?
>
> For example:
> <c:DecoratedText text="newWidgets" />
>
> then
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText"/>
> <Text/>
> </Composite>
>
> "myText" Label is changed automatic and I need not handle "text" changed
> event. I know the SilverLight is OK.
>
>
>
>
>
> Yves YANG wrote on Tue, 15 December 2009 18:00
>> Here is the bug for this feature:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>
>> yves
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:hg90to$fq7$1@build.eclipse.org...
>> >> How to get the property text in DecoratedText.xwt and set it into a
>> >> Label or others.
>> > By now, you need to give them a name. and then call
>> > XWT.findElementByName(context, "<name>");
>> >
>> > <Composite x:Class="ext.custom.DecoratedText">
>> > <Label name="myText" text={xxxxxx??}/>
>> > <Text/>
>> > </Composite>
>> >
>> > protected void eventHandle(Object sender, Event event) {
>> > Text text = (Text) XWT.findElementByName(event.widget,
>> > "myText");
>> > }
>> >
>> > We are considering to provide automatic solution to initialize the
>> > class Field to avoid the manuel research call
>> >
>> > Best regards
>> > Yves YANG
>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>> > news:hg8ce9$hmb$1@build.eclipse.org...
>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>> >>
>> >> For example:
>> >> In your example, DecoratedText have property ,text, then the widgets
>> >> will be used as following:
>> >>
>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>> >> <c:DecoratedText text="newWidgets" />
>> >> </Composite>
>> >>
>> >> and :
>> >> DecoratedText.java
>> >> ------------------
>> >> package ext.custom;
>> >>
>> >> public class DecoratedText {
>> >> private String text;
>> >>
>> >> ....
>> >> ...
>> >>
>> >> // event handling methods
>> >> ...
>> >> }
>> >>
>> >> DecoratedText.xwt
>> >> ------------------
>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >> <Label text={xxxxxx??}/>
>> >> <Text/>
>> >> </Composite>
>> >>
>> >> How to get the property text in DecoratedText.xwt and set it into a
>> >> Label or others.
>> >>
>> >> Thanks
>> >
>> >
>
>
Re: Develop reusable Custom Widgets In XWT [message #504072 is a reply to message #503836] Wed, 16 December 2009 15:04 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hg94ej$hlc$1@build.eclipse.org...
> Here is the bug for this feature:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>
The implemntation is committed. It will be supported in next build.
Re: Develop reusable Custom Widgets In XWT [message #504262 is a reply to message #504071] Thu, 17 December 2009 22:14 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
This should work.
<Composite x:Class="ext.custom.DecoratedText"
name="root">
<Label name="myText"/>
<Text text="{Binding elementName=root,path=text}" />
</Composite>

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hgc6jo$s73$1@build.eclipse.org...
> The simple solution is you create a "String text" property in
> DecoratedText. In the setter, you can update the content in your widget
> text or label.
>
> It should be possible to express in XAML. But we need to add a keyword in
> binding expression "self". It is not yet supported in XWT.
>
> The code should be:
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText"/>
> <Text text="{Binding source=self,path=text}" />
> </Composite>
>
> Best regards
> yves
> "Jinshan" <jinshanl@gmail.com> wrote in message
> news:hg9hge$rl5$1@build.eclipse.org...
>> Thanks.
>>
>> Are there some way to bind DecoratedText.java's properties to
>> DecoratedText.xwt.?
>>
>> For example:
>> <c:DecoratedText text="newWidgets" />
>>
>> then
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label name="myText"/>
>> <Text/>
>> </Composite>
>>
>> "myText" Label is changed automatic and I need not handle "text" changed
>> event. I know the SilverLight is OK.
>>
>>
>>
>>
>>
>> Yves YANG wrote on Tue, 15 December 2009 18:00
>>> Here is the bug for this feature:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>>
>>> yves
>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>> news:hg90to$fq7$1@build.eclipse.org...
>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>> >> Label or others.
>>> > By now, you need to give them a name. and then call
>>> > XWT.findElementByName(context, "<name>");
>>> >
>>> > <Composite x:Class="ext.custom.DecoratedText">
>>> > <Label name="myText" text={xxxxxx??}/>
>>> > <Text/>
>>> > </Composite>
>>> >
>>> > protected void eventHandle(Object sender, Event event) {
>>> > Text text = (Text) XWT.findElementByName(event.widget,
>>> > "myText");
>>> > }
>>> >
>>> > We are considering to provide automatic solution to initialize the
>>> > class Field to avoid the manuel research call
>>> >
>>> > Best regards
>>> > Yves YANG
>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>> >>
>>> >> For example:
>>> >> In your example, DecoratedText have property ,text, then the widgets
>>> >> will be used as following:
>>> >>
>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>>> >> <c:DecoratedText text="newWidgets" />
>>> >> </Composite>
>>> >>
>>> >> and :
>>> >> DecoratedText.java
>>> >> ------------------
>>> >> package ext.custom;
>>> >>
>>> >> public class DecoratedText {
>>> >> private String text;
>>> >>
>>> >> ....
>>> >> ...
>>> >>
>>> >> // event handling methods
>>> >> ...
>>> >> }
>>> >>
>>> >> DecoratedText.xwt
>>> >> ------------------
>>> >> <Composite x:Class="ext.custom.DecoratedText">
>>> >> <Label text={xxxxxx??}/>
>>> >> <Text/>
>>> >> </Composite>
>>> >>
>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>> >> Label or others.
>>> >>
>>> >> Thanks
>>> >
>>> >
>>
>>
>
>
Re: Develop reusable Custom Widgets In XWT [message #504272 is a reply to message #504262] Fri, 18 December 2009 01:28 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
<Composite x:Class="ext.custom.DecoratedText"
name="root">
<Label name="myText"/>
<Text text="{Binding elementName=root,path=text}" />
</Composite>

I have checked. This solution works.

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hgeah2$sfm$1@build.eclipse.org...
> This should work.
> <Composite x:Class="ext.custom.DecoratedText"
> name="root">
> <Label name="myText"/>
> <Text text="{Binding elementName=root,path=text}" />
> </Composite>
>
> yves
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:hgc6jo$s73$1@build.eclipse.org...
>> The simple solution is you create a "String text" property in
>> DecoratedText. In the setter, you can update the content in your widget
>> text or label.
>>
>> It should be possible to express in XAML. But we need to add a keyword in
>> binding expression "self". It is not yet supported in XWT.
>>
>> The code should be:
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label name="myText"/>
>> <Text text="{Binding source=self,path=text}" />
>> </Composite>
>>
>> Best regards
>> yves
>> "Jinshan" <jinshanl@gmail.com> wrote in message
>> news:hg9hge$rl5$1@build.eclipse.org...
>>> Thanks.
>>>
>>> Are there some way to bind DecoratedText.java's properties to
>>> DecoratedText.xwt.?
>>>
>>> For example:
>>> <c:DecoratedText text="newWidgets" />
>>>
>>> then
>>> <Composite x:Class="ext.custom.DecoratedText">
>>> <Label name="myText"/>
>>> <Text/>
>>> </Composite>
>>>
>>> "myText" Label is changed automatic and I need not handle "text" changed
>>> event. I know the SilverLight is OK.
>>>
>>>
>>>
>>>
>>>
>>> Yves YANG wrote on Tue, 15 December 2009 18:00
>>>> Here is the bug for this feature:
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>>>
>>>> yves
>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>> news:hg90to$fq7$1@build.eclipse.org...
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> > By now, you need to give them a name. and then call
>>>> > XWT.findElementByName(context, "<name>");
>>>> >
>>>> > <Composite x:Class="ext.custom.DecoratedText">
>>>> > <Label name="myText" text={xxxxxx??}/>
>>>> > <Text/>
>>>> > </Composite>
>>>> >
>>>> > protected void eventHandle(Object sender, Event event) {
>>>> > Text text = (Text) XWT.findElementByName(event.widget,
>>>> > "myText");
>>>> > }
>>>> >
>>>> > We are considering to provide automatic solution to initialize the
>>>> > class Field to avoid the manuel research call
>>>> >
>>>> > Best regards
>>>> > Yves YANG
>>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>>> >>
>>>> >> For example:
>>>> >> In your example, DecoratedText have property ,text, then the widgets
>>>> >> will be used as following:
>>>> >>
>>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>>>> >> <c:DecoratedText text="newWidgets" />
>>>> >> </Composite>
>>>> >>
>>>> >> and :
>>>> >> DecoratedText.java
>>>> >> ------------------
>>>> >> package ext.custom;
>>>> >>
>>>> >> public class DecoratedText {
>>>> >> private String text;
>>>> >>
>>>> >> ....
>>>> >> ...
>>>> >>
>>>> >> // event handling methods
>>>> >> ...
>>>> >> }
>>>> >>
>>>> >> DecoratedText.xwt
>>>> >> ------------------
>>>> >> <Composite x:Class="ext.custom.DecoratedText">
>>>> >> <Label text={xxxxxx??}/>
>>>> >> <Text/>
>>>> >> </Composite>
>>>> >>
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> >>
>>>> >> Thanks
>>>> >
>>>> >
>>>
>>>
>>
>>
>
>
Re: Develop reusable Custom Widgets In XWT [message #504304 is a reply to message #504272] Fri, 18 December 2009 09:00 Go to previous messageGo to next message
Jinshan  is currently offline Jinshan Friend
Messages: 24
Registered: December 2009
Junior Member
My e4 version is eclipse-e4-SDK-incubation-I20091022-2100-win32. but the fellowing does not work:
Widget:
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt" xmlns:c="clr-namespace:allegro.ui.widgets"
xmlns:j="clr-namespace:java.lang" x:Class="allegro.ui.widgets.Image" name="root">

<Composite.layout>
<FillLayout />
</Composite.layout>
<Label name="imageLabel" image="{Binding elementName=root,path=source}" />
</Composite>

Using:
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt"
xmlns:c="clr-namespace:allegro.image"
xmlns:j="clr-namespace:java.lang"
xmlns:a="clr-namespace:allegro.ui.widgets"
x:Class="allegro.image.ImageTest">
<Composite.layout>
<GridLayout numColumns="4" />
</Composite.layout>
<a:Image source="logo.gif"/>

</Composite>


Yves YANG wrote on Thu, 17 December 2009 20:28
<Composite x:Class="ext.custom.DecoratedText"
name="root">
<Label name="myText"/>
<Text text="{Binding elementName=root,path=text}" />
</Composite>

I have checked. This solution works.

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hgeah2$sfm$1@build.eclipse.org...
> This should work.
> <Composite x:Class="ext.custom.DecoratedText"
> name="root">
> <Label name="myText"/>
> <Text text="{Binding elementName=root,path=text}" />
> </Composite>
>
> yves
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:hgc6jo$s73$1@build.eclipse.org...
>> The simple solution is you create a "String text" property in
>> DecoratedText. In the setter, you can update the content in your widget
>> text or label.
>>
>> It should be possible to express in XAML. But we need to add a keyword in
>> binding expression "self". It is not yet supported in XWT.
>>
>> The code should be:
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label name="myText"/>
>> <Text text="{Binding source=self,path=text}" />
>> </Composite>
>>
>> Best regards
>> yves
>> "Jinshan" <jinshanl@gmail.com> wrote in message
>> news:hg9hge$rl5$1@build.eclipse.org...
>>> Thanks.
>>>
>>> Are there some way to bind DecoratedText.java's properties to
>>> DecoratedText.xwt.?
>>>
>>> For example:
>>> <c:DecoratedText text="newWidgets" />
>>>
>>> then
>>> <Composite x:Class="ext.custom.DecoratedText">
>>> <Label name="myText"/>
>>> <Text/>
>>> </Composite>
>>>
>>> "myText" Label is changed automatic and I need not handle "text" changed
>>> event. I know the SilverLight is OK.
>>>
>>>
>>>
>>>
>>>
>>> Yves YANG wrote on Tue, 15 December 2009 18:00
>>>> Here is the bug for this feature:
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>>>
>>>> yves
>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>> news:hg90to$fq7$1@build.eclipse.org...
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> > By now, you need to give them a name. and then call
>>>> > XWT.findElementByName(context, "<name>");
>>>> >
>>>> > <Composite x:Class="ext.custom.DecoratedText">
>>>> > <Label name="myText" text={xxxxxx??}/>
>>>> > <Text/>
>>>> > </Composite>
>>>> >
>>>> > protected void eventHandle(Object sender, Event event) {
>>>> > Text text = (Text) XWT.findElementByName(event.widget,
>>>> > "myText");
>>>> > }
>>>> >
>>>> > We are considering to provide automatic solution to initialize the
>>>> > class Field to avoid the manuel research call
>>>> >
>>>> > Best regards
>>>> > Yves YANG
>>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>>> >>
>>>> >> For example:
>>>> >> In your example, DecoratedText have property ,text, then the widgets
>>>> >> will be used as following:
>>>> >>
>>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>>>> >> <c:DecoratedText text="newWidgets" />
>>>> >> </Composite>
>>>> >>
>>>> >> and :
>>>> >> DecoratedText.java
>>>> >> ------------------
>>>> >> package ext.custom;
>>>> >>
>>>> >> public class DecoratedText {
>>>> >> private String text;
>>>> >>
>>>> >> ....
>>>> >> ...
>>>> >>
>>>> >> // event handling methods
>>>> >> ...
>>>> >> }
>>>> >>
>>>> >> DecoratedText.xwt
>>>> >> ------------------
>>>> >> <Composite x:Class="ext.custom.DecoratedText">
>>>> >> <Label text={xxxxxx??}/>
>>>> >> <Text/>
>>>> >> </Composite>
>>>> >>
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> >>
>>>> >> Thanks
>>>> >
>>>> >
>>>
>>>
>>
>>
>
>

Re: Develop reusable Custom Widgets In XWT [message #504398 is a reply to message #504304] Fri, 18 December 2009 16:58 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The code seems correct. It should work. Please test it with the last build?

Best regards
Yves YANG
"Jinshan" <jinshanl@gmail.com> wrote in message
news:hgfgbu$sjd$1@build.eclipse.org...
> My e4 version is eclipse-e4-SDK-incubation-I20091022-2100-win32. but the
> fellowing does not work:
> Widget:
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:x="http://www.eclipse.org/xwt"
> xmlns:c="clr-namespace:allegro.ui.widgets"
> xmlns:j="clr-namespace:java.lang" x:Class="allegro.ui.widgets.Image"
> name="root">
>
> <Composite.layout>
> <FillLayout />
> </Composite.layout>
> <Label name="imageLabel" image="{Binding elementName=root,path=source}"
> />
> </Composite>
>
> Using:
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:x="http://www.eclipse.org/xwt"
> xmlns:c="clr-namespace:allegro.image"
> xmlns:j="clr-namespace:java.lang"
> xmlns:a="clr-namespace:allegro.ui.widgets"
> x:Class="allegro.image.ImageTest">
> <Composite.layout>
> <GridLayout numColumns="4" />
> </Composite.layout>
> <a:Image source="logo.gif"/>
>
> </Composite>
>
>
> Yves YANG wrote on Thu, 17 December 2009 20:28
>> <Composite x:Class="ext.custom.DecoratedText"
>> name="root">
>> <Label name="myText"/>
>> <Text text="{Binding elementName=root,path=text}" />
>> </Composite>
>>
>> I have checked. This solution works.
>>
>> yves
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:hgeah2$sfm$1@build.eclipse.org...
>> > This should work.
>> > <Composite x:Class="ext.custom.DecoratedText"
>> > name="root">
>> > <Label name="myText"/>
>> > <Text text="{Binding elementName=root,path=text}" />
>> > </Composite>
>> >
>> > yves
>> > "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> > news:hgc6jo$s73$1@build.eclipse.org...
>> >> The simple solution is you create a "String text" property in
>> >> DecoratedText. In the setter, you can update the content in your
>> >> widget text or label.
>> >>
>> >> It should be possible to express in XAML. But we need to add a keyword
>> >> in binding expression "self". It is not yet supported in XWT.
>> >>
>> >> The code should be:
>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >> <Label name="myText"/>
>> >> <Text text="{Binding source=self,path=text}" />
>> >> </Composite>
>> >>
>> >> Best regards
>> >> yves
>> >> "Jinshan" <jinshanl@gmail.com> wrote in message
>> >> news:hg9hge$rl5$1@build.eclipse.org...
>> >>> Thanks.
>> >>>
>> >>> Are there some way to bind DecoratedText.java's properties to
>> >>> DecoratedText.xwt.?
>> >>>
>> >>> For example:
>> >>> <c:DecoratedText text="newWidgets" />
>> >>>
>> >>> then
>> >>> <Composite x:Class="ext.custom.DecoratedText">
>> >>> <Label name="myText"/>
>> >>> <Text/>
>> >>> </Composite>
>> >>>
>> >>> "myText" Label is changed automatic and I need not handle "text"
>> >>> changed event. I know the SilverLight is OK.
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> Yves YANG wrote on Tue, 15 December 2009 18:00
>> >>>> Here is the bug for this feature:
>> >>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>> >>>>
>> >>>> yves
>> >>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> >>>> news:hg90to$fq7$1@build.eclipse.org...
>> >>>> >> How to get the property text in DecoratedText.xwt and set it into
>> >>>> >> a Label or others.
>> >>>> > By now, you need to give them a name. and then call
>> >>>> > XWT.findElementByName(context, "<name>");
>> >>>> >
>> >>>> > <Composite x:Class="ext.custom.DecoratedText">
>> >>>> > <Label name="myText" text={xxxxxx??}/>
>> >>>> > <Text/>
>> >>>> > </Composite>
>> >>>> >
>> >>>> > protected void eventHandle(Object sender, Event event) {
>> >>>> > Text text = (Text) XWT.findElementByName(event.widget,
>> >>>> > "myText");
>> >>>> > }
>> >>>> >
>> >>>> > We are considering to provide automatic solution to initialize
>> >>>> > the class Field to avoid the manuel research call
>> >>>> >
>> >>>> > Best regards
>> >>>> > Yves YANG
>> >>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>> >>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>> >>>> >> Thanks for the answers from Yves YANG in e4 developer mailing
>> >>>> >> list.
>> >>>> >>
>> >>>> >> For example:
>> >>>> >> In your example, DecoratedText have property ,text, then the
>> >>>> >> widgets will be used as following:
>> >>>> >>
>> >>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>> >>>> >> <c:DecoratedText text="newWidgets" />
>> >>>> >> </Composite>
>> >>>> >>
>> >>>> >> and :
>> >>>> >> DecoratedText.java
>> >>>> >> ------------------
>> >>>> >> package ext.custom;
>> >>>> >>
>> >>>> >> public class DecoratedText {
>> >>>> >> private String text;
>> >>>> >>
>> >>>> >> ....
>> >>>> >> ...
>> >>>> >>
>> >>>> >> // event handling methods
>> >>>> >> ...
>> >>>> >> }
>> >>>> >>
>> >>>> >> DecoratedText.xwt
>> >>>> >> ------------------
>> >>>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >>>> >> <Label text={xxxxxx??}/>
>> >>>> >> <Text/>
>> >>>> >> </Composite>
>> >>>> >>
>> >>>> >> How to get the property text in DecoratedText.xwt and set it into
>> >>>> >> a Label or others.
>> >>>> >>
>> >>>> >> Thanks
>> >>>> >
>> >>>> >
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>
>
Re: Develop reusable Custom Widgets In XWT [message #566128 is a reply to message #503836] Wed, 16 December 2009 02:43 Go to previous message
Jinshan  is currently offline Jinshan Friend
Messages: 24
Registered: December 2009
Junior Member
Thanks.

Are there some way to bind DecoratedText.java's properties to DecoratedText.xwt.?

For example:
<c:DecoratedText text="newWidgets" />

then
<Composite x:Class="ext.custom.DecoratedText">
<Label name="myText"/>
<Text/>
</Composite>

"myText" Label is changed automatic and I need not handle "text" changed event. I know the SilverLight is OK.





Yves YANG wrote on Tue, 15 December 2009 18:00
> Here is the bug for this feature:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>
> yves
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:hg90to$fq7$1@build.eclipse.org...
> >> How to get the property text in DecoratedText.xwt and set it into a Label
> >> or others.
> > By now, you need to give them a name. and then call
> > XWT.findElementByName(context, "<name>");
> >
> > <Composite x:Class="ext.custom.DecoratedText">
> > <Label name="myText" text={xxxxxx??}/>
> > <Text/>
> > </Composite>
> >
> > protected void eventHandle(Object sender, Event event) {
> > Text text = (Text) XWT.findElementByName(event.widget, "myText");
> > }
> >
> > We are considering to provide automatic solution to initialize the class
> > Field to avoid the manuel research call
> >
> > Best regards
> > Yves YANG
> > "Jinshan" <jinshanl@gmail.com> wrote in message
> > news:hg8ce9$hmb$1@build.eclipse.org...
> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
> >>
> >> For example:
> >> In your example, DecoratedText have property ,text, then the widgets will
> >> be used as following:
> >>
> >> <Composite xmlns:c="clr-namespace:ext.custom">
> >> <c:DecoratedText text="newWidgets" />
> >> </Composite>
> >>
> >> and :
> >> DecoratedText.java
> >> ------------------
> >> package ext.custom;
> >>
> >> public class DecoratedText {
> >> private String text;
> >>
> >> ....
> >> ...
> >>
> >> // event handling methods
> >> ...
> >> }
> >>
> >> DecoratedText.xwt
> >> ------------------
> >> <Composite x:Class="ext.custom.DecoratedText">
> >> <Label text={xxxxxx??}/>
> >> <Text/>
> >> </Composite>
> >>
> >> How to get the property text in DecoratedText.xwt and set it into a Label
> >> or others.
> >>
> >> Thanks
> >
> >
Re: Develop reusable Custom Widgets In XWT [message #566190 is a reply to message #566128] Wed, 16 December 2009 15:03 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The simple solution is you create a "String text" property in DecoratedText.
In the setter, you can update the content in your widget text or label.

It should be possible to express in XAML. But we need to add a keyword in
binding expression "self". It is not yet supported in XWT.

The code should be:
<Composite x:Class="ext.custom.DecoratedText">
<Label name="myText"/>
<Text text="{Binding source=self,path=text}" />
</Composite>

Best regards
yves
"Jinshan" <jinshanl@gmail.com> wrote in message
news:hg9hge$rl5$1@build.eclipse.org...
> Thanks.
>
> Are there some way to bind DecoratedText.java's properties to
> DecoratedText.xwt.?
>
> For example:
> <c:DecoratedText text="newWidgets" />
>
> then
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText"/>
> <Text/>
> </Composite>
>
> "myText" Label is changed automatic and I need not handle "text" changed
> event. I know the SilverLight is OK.
>
>
>
>
>
> Yves YANG wrote on Tue, 15 December 2009 18:00
>> Here is the bug for this feature:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>
>> yves
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:hg90to$fq7$1@build.eclipse.org...
>> >> How to get the property text in DecoratedText.xwt and set it into a
>> >> Label or others.
>> > By now, you need to give them a name. and then call
>> > XWT.findElementByName(context, "<name>");
>> >
>> > <Composite x:Class="ext.custom.DecoratedText">
>> > <Label name="myText" text={xxxxxx??}/>
>> > <Text/>
>> > </Composite>
>> >
>> > protected void eventHandle(Object sender, Event event) {
>> > Text text = (Text) XWT.findElementByName(event.widget,
>> > "myText");
>> > }
>> >
>> > We are considering to provide automatic solution to initialize the
>> > class Field to avoid the manuel research call
>> >
>> > Best regards
>> > Yves YANG
>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>> > news:hg8ce9$hmb$1@build.eclipse.org...
>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>> >>
>> >> For example:
>> >> In your example, DecoratedText have property ,text, then the widgets
>> >> will be used as following:
>> >>
>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>> >> <c:DecoratedText text="newWidgets" />
>> >> </Composite>
>> >>
>> >> and :
>> >> DecoratedText.java
>> >> ------------------
>> >> package ext.custom;
>> >>
>> >> public class DecoratedText {
>> >> private String text;
>> >>
>> >> ....
>> >> ...
>> >>
>> >> // event handling methods
>> >> ...
>> >> }
>> >>
>> >> DecoratedText.xwt
>> >> ------------------
>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >> <Label text={xxxxxx??}/>
>> >> <Text/>
>> >> </Composite>
>> >>
>> >> How to get the property text in DecoratedText.xwt and set it into a
>> >> Label or others.
>> >>
>> >> Thanks
>> >
>> >
>
>
Re: Develop reusable Custom Widgets In XWT [message #566209 is a reply to message #503836] Wed, 16 December 2009 15:04 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hg94ej$hlc$1@build.eclipse.org...
> Here is the bug for this feature:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>
The implemntation is committed. It will be supported in next build.
Re: Develop reusable Custom Widgets In XWT [message #566259 is a reply to message #504071] Thu, 17 December 2009 22:14 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
This should work.
<Composite x:Class="ext.custom.DecoratedText"
name="root">
<Label name="myText"/>
<Text text="{Binding elementName=root,path=text}" />
</Composite>

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hgc6jo$s73$1@build.eclipse.org...
> The simple solution is you create a "String text" property in
> DecoratedText. In the setter, you can update the content in your widget
> text or label.
>
> It should be possible to express in XAML. But we need to add a keyword in
> binding expression "self". It is not yet supported in XWT.
>
> The code should be:
> <Composite x:Class="ext.custom.DecoratedText">
> <Label name="myText"/>
> <Text text="{Binding source=self,path=text}" />
> </Composite>
>
> Best regards
> yves
> "Jinshan" <jinshanl@gmail.com> wrote in message
> news:hg9hge$rl5$1@build.eclipse.org...
>> Thanks.
>>
>> Are there some way to bind DecoratedText.java's properties to
>> DecoratedText.xwt.?
>>
>> For example:
>> <c:DecoratedText text="newWidgets" />
>>
>> then
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label name="myText"/>
>> <Text/>
>> </Composite>
>>
>> "myText" Label is changed automatic and I need not handle "text" changed
>> event. I know the SilverLight is OK.
>>
>>
>>
>>
>>
>> Yves YANG wrote on Tue, 15 December 2009 18:00
>>> Here is the bug for this feature:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>>
>>> yves
>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>> news:hg90to$fq7$1@build.eclipse.org...
>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>> >> Label or others.
>>> > By now, you need to give them a name. and then call
>>> > XWT.findElementByName(context, "<name>");
>>> >
>>> > <Composite x:Class="ext.custom.DecoratedText">
>>> > <Label name="myText" text={xxxxxx??}/>
>>> > <Text/>
>>> > </Composite>
>>> >
>>> > protected void eventHandle(Object sender, Event event) {
>>> > Text text = (Text) XWT.findElementByName(event.widget,
>>> > "myText");
>>> > }
>>> >
>>> > We are considering to provide automatic solution to initialize the
>>> > class Field to avoid the manuel research call
>>> >
>>> > Best regards
>>> > Yves YANG
>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>> >>
>>> >> For example:
>>> >> In your example, DecoratedText have property ,text, then the widgets
>>> >> will be used as following:
>>> >>
>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>>> >> <c:DecoratedText text="newWidgets" />
>>> >> </Composite>
>>> >>
>>> >> and :
>>> >> DecoratedText.java
>>> >> ------------------
>>> >> package ext.custom;
>>> >>
>>> >> public class DecoratedText {
>>> >> private String text;
>>> >>
>>> >> ....
>>> >> ...
>>> >>
>>> >> // event handling methods
>>> >> ...
>>> >> }
>>> >>
>>> >> DecoratedText.xwt
>>> >> ------------------
>>> >> <Composite x:Class="ext.custom.DecoratedText">
>>> >> <Label text={xxxxxx??}/>
>>> >> <Text/>
>>> >> </Composite>
>>> >>
>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>> >> Label or others.
>>> >>
>>> >> Thanks
>>> >
>>> >
>>
>>
>
>
Re: Develop reusable Custom Widgets In XWT [message #566271 is a reply to message #504262] Fri, 18 December 2009 01:28 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
<Composite x:Class="ext.custom.DecoratedText"
name="root">
<Label name="myText"/>
<Text text="{Binding elementName=root,path=text}" />
</Composite>

I have checked. This solution works.

yves
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hgeah2$sfm$1@build.eclipse.org...
> This should work.
> <Composite x:Class="ext.custom.DecoratedText"
> name="root">
> <Label name="myText"/>
> <Text text="{Binding elementName=root,path=text}" />
> </Composite>
>
> yves
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:hgc6jo$s73$1@build.eclipse.org...
>> The simple solution is you create a "String text" property in
>> DecoratedText. In the setter, you can update the content in your widget
>> text or label.
>>
>> It should be possible to express in XAML. But we need to add a keyword in
>> binding expression "self". It is not yet supported in XWT.
>>
>> The code should be:
>> <Composite x:Class="ext.custom.DecoratedText">
>> <Label name="myText"/>
>> <Text text="{Binding source=self,path=text}" />
>> </Composite>
>>
>> Best regards
>> yves
>> "Jinshan" <jinshanl@gmail.com> wrote in message
>> news:hg9hge$rl5$1@build.eclipse.org...
>>> Thanks.
>>>
>>> Are there some way to bind DecoratedText.java's properties to
>>> DecoratedText.xwt.?
>>>
>>> For example:
>>> <c:DecoratedText text="newWidgets" />
>>>
>>> then
>>> <Composite x:Class="ext.custom.DecoratedText">
>>> <Label name="myText"/>
>>> <Text/>
>>> </Composite>
>>>
>>> "myText" Label is changed automatic and I need not handle "text" changed
>>> event. I know the SilverLight is OK.
>>>
>>>
>>>
>>>
>>>
>>> Yves YANG wrote on Tue, 15 December 2009 18:00
>>>> Here is the bug for this feature:
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>>>>
>>>> yves
>>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>>>> news:hg90to$fq7$1@build.eclipse.org...
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> > By now, you need to give them a name. and then call
>>>> > XWT.findElementByName(context, "<name>");
>>>> >
>>>> > <Composite x:Class="ext.custom.DecoratedText">
>>>> > <Label name="myText" text={xxxxxx??}/>
>>>> > <Text/>
>>>> > </Composite>
>>>> >
>>>> > protected void eventHandle(Object sender, Event event) {
>>>> > Text text = (Text) XWT.findElementByName(event.widget,
>>>> > "myText");
>>>> > }
>>>> >
>>>> > We are considering to provide automatic solution to initialize the
>>>> > class Field to avoid the manuel research call
>>>> >
>>>> > Best regards
>>>> > Yves YANG
>>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
>>>> >>
>>>> >> For example:
>>>> >> In your example, DecoratedText have property ,text, then the widgets
>>>> >> will be used as following:
>>>> >>
>>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>>>> >> <c:DecoratedText text="newWidgets" />
>>>> >> </Composite>
>>>> >>
>>>> >> and :
>>>> >> DecoratedText.java
>>>> >> ------------------
>>>> >> package ext.custom;
>>>> >>
>>>> >> public class DecoratedText {
>>>> >> private String text;
>>>> >>
>>>> >> ....
>>>> >> ...
>>>> >>
>>>> >> // event handling methods
>>>> >> ...
>>>> >> }
>>>> >>
>>>> >> DecoratedText.xwt
>>>> >> ------------------
>>>> >> <Composite x:Class="ext.custom.DecoratedText">
>>>> >> <Label text={xxxxxx??}/>
>>>> >> <Text/>
>>>> >> </Composite>
>>>> >>
>>>> >> How to get the property text in DecoratedText.xwt and set it into a
>>>> >> Label or others.
>>>> >>
>>>> >> Thanks
>>>> >
>>>> >
>>>
>>>
>>
>>
>
>
Re: Develop reusable Custom Widgets In XWT [message #566299 is a reply to message #504272] Fri, 18 December 2009 09:00 Go to previous message
Jinshan  is currently offline Jinshan Friend
Messages: 24
Registered: December 2009
Junior Member
My e4 version is eclipse-e4-SDK-incubation-I20091022-2100-win32. but the fellowing does not work:
Widget:
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt" xmlns:c="clr-namespace:allegro.ui.widgets"
xmlns:j="clr-namespace:java.lang" x:Class="allegro.ui.widgets.Image" name="root">

<Composite.layout>
<FillLayout />
</Composite.layout>
<Label name="imageLabel" image="{Binding elementName=root,path=source}" />
</Composite>

Using:
<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt"
xmlns:c="clr-namespace:allegro.image"
xmlns:j="clr-namespace:java.lang"
xmlns:a="clr-namespace:allegro.ui.widgets"
x:Class="allegro.image.ImageTest">
<Composite.layout>
<GridLayout numColumns="4" />
</Composite.layout>
<a:Image source="logo.gif"/>

</Composite>


Yves YANG wrote on Thu, 17 December 2009 20:28
> <Composite x:Class="ext.custom.DecoratedText"
> name="root">
> <Label name="myText"/>
> <Text text="{Binding elementName=root,path=text}" />
> </Composite>
>
> I have checked. This solution works.
>
> yves
> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> news:hgeah2$sfm$1@build.eclipse.org...
> > This should work.
> > <Composite x:Class="ext.custom.DecoratedText"
> > name="root">
> > <Label name="myText"/>
> > <Text text="{Binding elementName=root,path=text}" />
> > </Composite>
> >
> > yves
> > "Yves YANG" <yves.yang@soyatec.com> wrote in message
> > news:hgc6jo$s73$1@build.eclipse.org...
> >> The simple solution is you create a "String text" property in
> >> DecoratedText. In the setter, you can update the content in your widget
> >> text or label.
> >>
> >> It should be possible to express in XAML. But we need to add a keyword in
> >> binding expression "self". It is not yet supported in XWT.
> >>
> >> The code should be:
> >> <Composite x:Class="ext.custom.DecoratedText">
> >> <Label name="myText"/>
> >> <Text text="{Binding source=self,path=text}" />
> >> </Composite>
> >>
> >> Best regards
> >> yves
> >> "Jinshan" <jinshanl@gmail.com> wrote in message
> >> news:hg9hge$rl5$1@build.eclipse.org...
> >>> Thanks.
> >>>
> >>> Are there some way to bind DecoratedText.java's properties to
> >>> DecoratedText.xwt.?
> >>>
> >>> For example:
> >>> <c:DecoratedText text="newWidgets" />
> >>>
> >>> then
> >>> <Composite x:Class="ext.custom.DecoratedText">
> >>> <Label name="myText"/>
> >>> <Text/>
> >>> </Composite>
> >>>
> >>> "myText" Label is changed automatic and I need not handle "text" changed
> >>> event. I know the SilverLight is OK.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Yves YANG wrote on Tue, 15 December 2009 18:00
> >>>> Here is the bug for this feature:
> >>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
> >>>>
> >>>> yves
> >>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
> >>>> news:hg90to$fq7$1@build.eclipse.org...
> >>>> >> How to get the property text in DecoratedText.xwt and set it into a
> >>>> >> Label or others.
> >>>> > By now, you need to give them a name. and then call
> >>>> > XWT.findElementByName(context, "<name>");
> >>>> >
> >>>> > <Composite x:Class="ext.custom.DecoratedText">
> >>>> > <Label name="myText" text={xxxxxx??}/>
> >>>> > <Text/>
> >>>> > </Composite>
> >>>> >
> >>>> > protected void eventHandle(Object sender, Event event) {
> >>>> > Text text = (Text) XWT.findElementByName(event.widget,
> >>>> > "myText");
> >>>> > }
> >>>> >
> >>>> > We are considering to provide automatic solution to initialize the
> >>>> > class Field to avoid the manuel research call
> >>>> >
> >>>> > Best regards
> >>>> > Yves YANG
> >>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
> >>>> > news:hg8ce9$hmb$1@build.eclipse.org...
> >>>> >> Thanks for the answers from Yves YANG in e4 developer mailing list.
> >>>> >>
> >>>> >> For example:
> >>>> >> In your example, DecoratedText have property ,text, then the widgets
> >>>> >> will be used as following:
> >>>> >>
> >>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
> >>>> >> <c:DecoratedText text="newWidgets" />
> >>>> >> </Composite>
> >>>> >>
> >>>> >> and :
> >>>> >> DecoratedText.java
> >>>> >> ------------------
> >>>> >> package ext.custom;
> >>>> >>
> >>>> >> public class DecoratedText {
> >>>> >> private String text;
> >>>> >>
> >>>> >> ....
> >>>> >> ...
> >>>> >>
> >>>> >> // event handling methods
> >>>> >> ...
> >>>> >> }
> >>>> >>
> >>>> >> DecoratedText.xwt
> >>>> >> ------------------
> >>>> >> <Composite x:Class="ext.custom.DecoratedText">
> >>>> >> <Label text={xxxxxx??}/>
> >>>> >> <Text/>
> >>>> >> </Composite>
> >>>> >>
> >>>> >> How to get the property text in DecoratedText.xwt and set it into a
> >>>> >> Label or others.
> >>>> >>
> >>>> >> Thanks
> >>>> >
> >>>> >
> >>>
> >>>
> >>
> >>
> >
> >
Re: Develop reusable Custom Widgets In XWT [message #566352 is a reply to message #566299] Fri, 18 December 2009 16:58 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
The code seems correct. It should work. Please test it with the last build?

Best regards
Yves YANG
"Jinshan" <jinshanl@gmail.com> wrote in message
news:hgfgbu$sjd$1@build.eclipse.org...
> My e4 version is eclipse-e4-SDK-incubation-I20091022-2100-win32. but the
> fellowing does not work:
> Widget:
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:x="http://www.eclipse.org/xwt"
> xmlns:c="clr-namespace:allegro.ui.widgets"
> xmlns:j="clr-namespace:java.lang" x:Class="allegro.ui.widgets.Image"
> name="root">
>
> <Composite.layout>
> <FillLayout />
> </Composite.layout>
> <Label name="imageLabel" image="{Binding elementName=root,path=source}"
> />
> </Composite>
>
> Using:
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:x="http://www.eclipse.org/xwt"
> xmlns:c="clr-namespace:allegro.image"
> xmlns:j="clr-namespace:java.lang"
> xmlns:a="clr-namespace:allegro.ui.widgets"
> x:Class="allegro.image.ImageTest">
> <Composite.layout>
> <GridLayout numColumns="4" />
> </Composite.layout>
> <a:Image source="logo.gif"/>
>
> </Composite>
>
>
> Yves YANG wrote on Thu, 17 December 2009 20:28
>> <Composite x:Class="ext.custom.DecoratedText"
>> name="root">
>> <Label name="myText"/>
>> <Text text="{Binding elementName=root,path=text}" />
>> </Composite>
>>
>> I have checked. This solution works.
>>
>> yves
>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> news:hgeah2$sfm$1@build.eclipse.org...
>> > This should work.
>> > <Composite x:Class="ext.custom.DecoratedText"
>> > name="root">
>> > <Label name="myText"/>
>> > <Text text="{Binding elementName=root,path=text}" />
>> > </Composite>
>> >
>> > yves
>> > "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> > news:hgc6jo$s73$1@build.eclipse.org...
>> >> The simple solution is you create a "String text" property in
>> >> DecoratedText. In the setter, you can update the content in your
>> >> widget text or label.
>> >>
>> >> It should be possible to express in XAML. But we need to add a keyword
>> >> in binding expression "self". It is not yet supported in XWT.
>> >>
>> >> The code should be:
>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >> <Label name="myText"/>
>> >> <Text text="{Binding source=self,path=text}" />
>> >> </Composite>
>> >>
>> >> Best regards
>> >> yves
>> >> "Jinshan" <jinshanl@gmail.com> wrote in message
>> >> news:hg9hge$rl5$1@build.eclipse.org...
>> >>> Thanks.
>> >>>
>> >>> Are there some way to bind DecoratedText.java's properties to
>> >>> DecoratedText.xwt.?
>> >>>
>> >>> For example:
>> >>> <c:DecoratedText text="newWidgets" />
>> >>>
>> >>> then
>> >>> <Composite x:Class="ext.custom.DecoratedText">
>> >>> <Label name="myText"/>
>> >>> <Text/>
>> >>> </Composite>
>> >>>
>> >>> "myText" Label is changed automatic and I need not handle "text"
>> >>> changed event. I know the SilverLight is OK.
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> Yves YANG wrote on Tue, 15 December 2009 18:00
>> >>>> Here is the bug for this feature:
>> >>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=297586
>> >>>>
>> >>>> yves
>> >>>> "Yves YANG" <yves.yang@soyatec.com> wrote in message
>> >>>> news:hg90to$fq7$1@build.eclipse.org...
>> >>>> >> How to get the property text in DecoratedText.xwt and set it into
>> >>>> >> a Label or others.
>> >>>> > By now, you need to give them a name. and then call
>> >>>> > XWT.findElementByName(context, "<name>");
>> >>>> >
>> >>>> > <Composite x:Class="ext.custom.DecoratedText">
>> >>>> > <Label name="myText" text={xxxxxx??}/>
>> >>>> > <Text/>
>> >>>> > </Composite>
>> >>>> >
>> >>>> > protected void eventHandle(Object sender, Event event) {
>> >>>> > Text text = (Text) XWT.findElementByName(event.widget,
>> >>>> > "myText");
>> >>>> > }
>> >>>> >
>> >>>> > We are considering to provide automatic solution to initialize
>> >>>> > the class Field to avoid the manuel research call
>> >>>> >
>> >>>> > Best regards
>> >>>> > Yves YANG
>> >>>> > "Jinshan" <jinshanl@gmail.com> wrote in message
>> >>>> > news:hg8ce9$hmb$1@build.eclipse.org...
>> >>>> >> Thanks for the answers from Yves YANG in e4 developer mailing
>> >>>> >> list.
>> >>>> >>
>> >>>> >> For example:
>> >>>> >> In your example, DecoratedText have property ,text, then the
>> >>>> >> widgets will be used as following:
>> >>>> >>
>> >>>> >> <Composite xmlns:c="clr-namespace:ext.custom">
>> >>>> >> <c:DecoratedText text="newWidgets" />
>> >>>> >> </Composite>
>> >>>> >>
>> >>>> >> and :
>> >>>> >> DecoratedText.java
>> >>>> >> ------------------
>> >>>> >> package ext.custom;
>> >>>> >>
>> >>>> >> public class DecoratedText {
>> >>>> >> private String text;
>> >>>> >>
>> >>>> >> ....
>> >>>> >> ...
>> >>>> >>
>> >>>> >> // event handling methods
>> >>>> >> ...
>> >>>> >> }
>> >>>> >>
>> >>>> >> DecoratedText.xwt
>> >>>> >> ------------------
>> >>>> >> <Composite x:Class="ext.custom.DecoratedText">
>> >>>> >> <Label text={xxxxxx??}/>
>> >>>> >> <Text/>
>> >>>> >> </Composite>
>> >>>> >>
>> >>>> >> How to get the property text in DecoratedText.xwt and set it into
>> >>>> >> a Label or others.
>> >>>> >>
>> >>>> >> Thanks
>> >>>> >
>> >>>> >
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>
>
Previous Topic:Application.xmi + Intro / Welcome Page
Next Topic:How to get a part reference with the service registry?
Goto Forum:
  


Current Time: Wed Sep 23 11:15:23 GMT 2020

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

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

Back to the top