Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT + DataBinding + TableViewer Issue
XWT + DataBinding + TableViewer Issue [message #499376] Sat, 21 November 2009 15:32 Go to next message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
Hi,

When using Databinding in XWT using an object ( Transaction.java ) I am
able to show the value of "price"
<Label text="Price:" />
<Label text="{Binding path=price}"/>

However, if I need to show the price in tableviewer
<TableViewer>
<TableViewer.columns>
<TableViewerColumn width="150" text="Price"
displayMemberPath="price" />
</TableViewer.columns>
<TableViewer.control.layoutData>
<GridData horizontalAlignment="FILL" verticalAlignment="FILL"
grabExcessVerticalSpace="true"
grabExcessHorizontalSpace="true" />
</TableViewer.control.layoutData>
</TableViewer>

The Data ( price ) is not rendered in the Table. Even the columns are not
shown.

I tried the following
1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
correctly in Label but not in Table
2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label ( correct
behaviour ? ) and does not show in Table
3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is a
List => similar behaviour as in 2).

I had tried even with
<TableViewer input="{Binding Path=transaction}">

Any help is much appreciated.

Thanks,
Best Regards,
Walter G. Prahakar.
Re: XWT + DataBinding + TableViewer Issue [message #499727 is a reply to message #499376] Mon, 23 November 2009 20:41 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Hi Walter,

It is about the "data context".

> <Label text="Price:" />
> <Label text="{Binding path=price}"/>
It expects the data context as an object (not a collection) with an
attribute "price".

As for TableViewer, it expects to have a collection to bind in ti "input".
In your code, the "input" specification is missing. If the data context is a
collection, you just need to indicate the input to use the data context like
this:
input="{Binding}"

If the data context of TableViewer is not a collection, you need to indicate
the collection viw path
input="{Binding path=orders}"

Regarding the table header, you need to add
<TableViewer.table headerVisible="true">
</TableViewer.table>

By defualt, it is false.

In general, I support you have a collection of Transaction. You want to
display the price when a transaction gets selected. It is the pure
Master/Detail presentation pattern. I suggest you llok at this example:
org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
The code is attached here. You can more examples in e4 CVS.

Regards
Yves YANG
"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:he916r$np$1@build.eclipse.org...
> Hi,
>
> When using Databinding in XWT using an object ( Transaction.java ) I am
> able to show the value of "price"
> <Label text="Price:" />
> <Label text="{Binding path=price}"/>
>
> However, if I need to show the price in tableviewer
> <TableViewer>
> <TableViewer.columns>
> <TableViewerColumn width="150" text="Price"
> displayMemberPath="price" />
> </TableViewer.columns>
> <TableViewer.control.layoutData>
> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
> grabExcessVerticalSpace="true"
> grabExcessHorizontalSpace="true" />
> </TableViewer.control.layoutData>
> </TableViewer>
>
> The Data ( price ) is not rendered in the Table. Even the columns are
> not
> shown.
>
> I tried the following
> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
> correctly in Label but not in Table
> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label ( correct
> behaviour ? ) and does not show in Table
> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
> a
> List => similar behaviour as in 2).
>
> I had tried even with
> <TableViewer input="{Binding Path=transaction}">
>
> Any help is much appreciated.
>
> Thanks,
> Best Regards,
> Walter G. Prahakar.
>


Re: XWT + DataBinding + TableViewer Issue [message #499728 is a reply to message #499727] Mon, 23 November 2009 20:44 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Sorry, somme correction of typo in my previous email
---
In general, I suppose you have a collection of Transaction. You want to
display the price when a transaction gets selected. It is a pure
Master/Detail presentation pattern. I suggest you look at this example:
org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
The code is attached here. You can find more examples in e4 CVS.
---
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hees2r$r1j$1@build.eclipse.org...
> Hi Walter,
>
> It is about the "data context".
>
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
> It expects the data context as an object (not a collection) with an
> attribute "price".
>
> As for TableViewer, it expects to have a collection to bind in ti "input".
> In your code, the "input" specification is missing. If the data context is
> a collection, you just need to indicate the input to use the data context
> like this:
> input="{Binding}"
>
> If the data context of TableViewer is not a collection, you need to
> indicate the collection viw path
> input="{Binding path=orders}"
>
> Regarding the table header, you need to add
> <TableViewer.table headerVisible="true">
> </TableViewer.table>
>
> By defualt, it is false.
>
> In general, I support you have a collection of Transaction. You want to
> display the price when a transaction gets selected. It is the pure
> Master/Detail presentation pattern. I suggest you llok at this example:
> org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
> The code is attached here. You can more examples in e4 CVS.
>
> Regards
> Yves YANG
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:he916r$np$1@build.eclipse.org...
>> Hi,
>>
>> When using Databinding in XWT using an object ( Transaction.java ) I am
>> able to show the value of "price"
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
>>
>> However, if I need to show the price in tableviewer
>> <TableViewer>
>> <TableViewer.columns>
>> <TableViewerColumn width="150" text="Price"
>> displayMemberPath="price" />
>> </TableViewer.columns>
>> <TableViewer.control.layoutData>
>> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
>> grabExcessVerticalSpace="true"
>> grabExcessHorizontalSpace="true" />
>> </TableViewer.control.layoutData>
>> </TableViewer>
>>
>> The Data ( price ) is not rendered in the Table. Even the columns are
>> not
>> shown.
>>
>> I tried the following
>> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
>> correctly in Label but not in Table
>> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label (
>> correct
>> behaviour ? ) and does not show in Table
>> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
>> a
>> List => similar behaviour as in 2).
>>
>> I had tried even with
>> <TableViewer input="{Binding Path=transaction}">
>>
>> Any help is much appreciated.
>>
>> Thanks,
>> Best Regards,
>> Walter G. Prahakar.
>>
>
>
>
Re: XWT + DataBinding + TableViewer Issue [message #499868 is a reply to message #499727] Tue, 24 November 2009 12:44 Go to previous messageGo to next message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
Thanks Yves Yang. It works.

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hees2r$r1j$1@build.eclipse.org...
> Hi Walter,
>
> It is about the "data context".
>
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
> It expects the data context as an object (not a collection) with an
> attribute "price".
>
> As for TableViewer, it expects to have a collection to bind in ti "input".
> In your code, the "input" specification is missing. If the data context is
> a collection, you just need to indicate the input to use the data context
> like this:
> input="{Binding}"
>
> If the data context of TableViewer is not a collection, you need to
> indicate the collection viw path
> input="{Binding path=orders}"
>
> Regarding the table header, you need to add
> <TableViewer.table headerVisible="true">
> </TableViewer.table>
>
> By defualt, it is false.
>
> In general, I support you have a collection of Transaction. You want to
> display the price when a transaction gets selected. It is the pure
> Master/Detail presentation pattern. I suggest you llok at this example:
> org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
> The code is attached here. You can more examples in e4 CVS.
>
> Regards
> Yves YANG
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:he916r$np$1@build.eclipse.org...
>> Hi,
>>
>> When using Databinding in XWT using an object ( Transaction.java ) I am
>> able to show the value of "price"
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
>>
>> However, if I need to show the price in tableviewer
>> <TableViewer>
>> <TableViewer.columns>
>> <TableViewerColumn width="150" text="Price"
>> displayMemberPath="price" />
>> </TableViewer.columns>
>> <TableViewer.control.layoutData>
>> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
>> grabExcessVerticalSpace="true"
>> grabExcessHorizontalSpace="true" />
>> </TableViewer.control.layoutData>
>> </TableViewer>
>>
>> The Data ( price ) is not rendered in the Table. Even the columns are
>> not
>> shown.
>>
>> I tried the following
>> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
>> correctly in Label but not in Table
>> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label (
>> correct
>> behaviour ? ) and does not show in Table
>> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
>> a
>> List => similar behaviour as in 2).
>>
>> I had tried even with
>> <TableViewer input="{Binding Path=transaction}">
>>
>> Any help is much appreciated.
>>
>> Thanks,
>> Best Regards,
>> Walter G. Prahakar.
>>
>
>
>
Re: XWT + DataBinding + TableViewer Issue [message #533703 is a reply to message #499868] Sat, 15 May 2010 19:23 Go to previous message
Parvez Ahmad Ahmad is currently offline Parvez Ahmad AhmadFriend
Messages: 31
Registered: May 2010
Member
I have below code
label = (Label) XWT.load(parent, XWTLoader.class
.getResource("org/cord/client/dms/mainapp/ui/detailsViewer/ " + labelName ));


Now what happens, the getResource works fine in development environment, but when i try to export the project as product, getResource returns null

Can some body offer help
I too tired modifying build properties

Parvez Ahmad Hakim
Srinagar
Re: XWT + DataBinding + TableViewer Issue [message #565036 is a reply to message #499376] Mon, 23 November 2009 20:41 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Hi Walter,

It is about the "data context".

> <Label text="Price:" />
> <Label text="{Binding path=price}"/>
It expects the data context as an object (not a collection) with an
attribute "price".

As for TableViewer, it expects to have a collection to bind in ti "input".
In your code, the "input" specification is missing. If the data context is a
collection, you just need to indicate the input to use the data context like
this:
input="{Binding}"

If the data context of TableViewer is not a collection, you need to indicate
the collection viw path
input="{Binding path=orders}"

Regarding the table header, you need to add
<TableViewer.table headerVisible="true">
</TableViewer.table>

By defualt, it is false.

In general, I support you have a collection of Transaction. You want to
display the price when a transaction gets selected. It is the pure
Master/Detail presentation pattern. I suggest you llok at this example:
org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
The code is attached here. You can more examples in e4 CVS.

Regards
Yves YANG
"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:he916r$np$1@build.eclipse.org...
> Hi,
>
> When using Databinding in XWT using an object ( Transaction.java ) I am
> able to show the value of "price"
> <Label text="Price:" />
> <Label text="{Binding path=price}"/>
>
> However, if I need to show the price in tableviewer
> <TableViewer>
> <TableViewer.columns>
> <TableViewerColumn width="150" text="Price"
> displayMemberPath="price" />
> </TableViewer.columns>
> <TableViewer.control.layoutData>
> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
> grabExcessVerticalSpace="true"
> grabExcessHorizontalSpace="true" />
> </TableViewer.control.layoutData>
> </TableViewer>
>
> The Data ( price ) is not rendered in the Table. Even the columns are
> not
> shown.
>
> I tried the following
> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
> correctly in Label but not in Table
> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label ( correct
> behaviour ? ) and does not show in Table
> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
> a
> List => similar behaviour as in 2).
>
> I had tried even with
> <TableViewer input="{Binding Path=transaction}">
>
> Any help is much appreciated.
>
> Thanks,
> Best Regards,
> Walter G. Prahakar.
>


Re: XWT + DataBinding + TableViewer Issue [message #565063 is a reply to message #499727] Mon, 23 November 2009 20:44 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Sorry, somme correction of typo in my previous email
---
In general, I suppose you have a collection of Transaction. You want to
display the price when a transaction gets selected. It is a pure
Master/Detail presentation pattern. I suggest you look at this example:
org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
The code is attached here. You can find more examples in e4 CVS.
---
"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hees2r$r1j$1@build.eclipse.org...
> Hi Walter,
>
> It is about the "data context".
>
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
> It expects the data context as an object (not a collection) with an
> attribute "price".
>
> As for TableViewer, it expects to have a collection to bind in ti "input".
> In your code, the "input" specification is missing. If the data context is
> a collection, you just need to indicate the input to use the data context
> like this:
> input="{Binding}"
>
> If the data context of TableViewer is not a collection, you need to
> indicate the collection viw path
> input="{Binding path=orders}"
>
> Regarding the table header, you need to add
> <TableViewer.table headerVisible="true">
> </TableViewer.table>
>
> By defualt, it is false.
>
> In general, I support you have a collection of Transaction. You want to
> display the price when a transaction gets selected. It is the pure
> Master/Detail presentation pattern. I suggest you llok at this example:
> org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
> The code is attached here. You can more examples in e4 CVS.
>
> Regards
> Yves YANG
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:he916r$np$1@build.eclipse.org...
>> Hi,
>>
>> When using Databinding in XWT using an object ( Transaction.java ) I am
>> able to show the value of "price"
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
>>
>> However, if I need to show the price in tableviewer
>> <TableViewer>
>> <TableViewer.columns>
>> <TableViewerColumn width="150" text="Price"
>> displayMemberPath="price" />
>> </TableViewer.columns>
>> <TableViewer.control.layoutData>
>> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
>> grabExcessVerticalSpace="true"
>> grabExcessHorizontalSpace="true" />
>> </TableViewer.control.layoutData>
>> </TableViewer>
>>
>> The Data ( price ) is not rendered in the Table. Even the columns are
>> not
>> shown.
>>
>> I tried the following
>> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
>> correctly in Label but not in Table
>> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label (
>> correct
>> behaviour ? ) and does not show in Table
>> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
>> a
>> List => similar behaviour as in 2).
>>
>> I had tried even with
>> <TableViewer input="{Binding Path=transaction}">
>>
>> Any help is much appreciated.
>>
>> Thanks,
>> Best Regards,
>> Walter G. Prahakar.
>>
>
>
>
Re: XWT + DataBinding + TableViewer Issue [message #565117 is a reply to message #499727] Tue, 24 November 2009 12:44 Go to previous message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
Thanks Yves Yang. It works.

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hees2r$r1j$1@build.eclipse.org...
> Hi Walter,
>
> It is about the "data context".
>
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
> It expects the data context as an object (not a collection) with an
> attribute "price".
>
> As for TableViewer, it expects to have a collection to bind in ti "input".
> In your code, the "input" specification is missing. If the data context is
> a collection, you just need to indicate the input to use the data context
> like this:
> input="{Binding}"
>
> If the data context of TableViewer is not a collection, you need to
> indicate the collection viw path
> input="{Binding path=orders}"
>
> Regarding the table header, you need to add
> <TableViewer.table headerVisible="true">
> </TableViewer.table>
>
> By defualt, it is false.
>
> In general, I support you have a collection of Transaction. You want to
> display the price when a transaction gets selected. It is the pure
> Master/Detail presentation pattern. I suggest you llok at this example:
> org.eclipse.e4.xwt.tests.jface.tableviewer.master.detail/Tab leViewer_MasterDetail.xwt:
> The code is attached here. You can more examples in e4 CVS.
>
> Regards
> Yves YANG
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:he916r$np$1@build.eclipse.org...
>> Hi,
>>
>> When using Databinding in XWT using an object ( Transaction.java ) I am
>> able to show the value of "price"
>> <Label text="Price:" />
>> <Label text="{Binding path=price}"/>
>>
>> However, if I need to show the price in tableviewer
>> <TableViewer>
>> <TableViewer.columns>
>> <TableViewerColumn width="150" text="Price"
>> displayMemberPath="price" />
>> </TableViewer.columns>
>> <TableViewer.control.layoutData>
>> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
>> grabExcessVerticalSpace="true"
>> grabExcessHorizontalSpace="true" />
>> </TableViewer.control.layoutData>
>> </TableViewer>
>>
>> The Data ( price ) is not rendered in the Table. Even the columns are
>> not
>> shown.
>>
>> I tried the following
>> 1) XWT.load(parent, url, ( Transaction ) ( getT [ 0 ] ) ); => Shows up
>> correctly in Label but not in Table
>> 2) XWT.load(parent, url, getT( ) ) ; => Doesnot show in Label (
>> correct
>> behaviour ? ) and does not show in Table
>> 3) XWT.load(parent, url, getTinList ( ) ) ; => Here the object passed is
>> a
>> List => similar behaviour as in 2).
>>
>> I had tried even with
>> <TableViewer input="{Binding Path=transaction}">
>>
>> Any help is much appreciated.
>>
>> Thanks,
>> Best Regards,
>> Walter G. Prahakar.
>>
>
>
>
Re: XWT + DataBinding + TableViewer Issue [message #576119 is a reply to message #499868] Sat, 15 May 2010 19:23 Go to previous message
Parvez Ahmad Ahmad is currently offline Parvez Ahmad AhmadFriend
Messages: 31
Registered: May 2010
Member
I have below code
label = (Label) XWT.load(parent, XWTLoader.class
.getResource("org/cord/client/dms/mainapp/ui/detailsViewer/ " + labelName ));


Now what happens, the getResource works fine in development environment, but when i try to export the project as product, getResource returns null

Can some body offer help
I too tired modifying build properties

Parvez Ahmad Hakim
Srinagar
Previous Topic:Dynamically extending the workbench model
Next Topic:XWT not working in exports
Goto Forum:
  


Current Time: Thu Apr 25 16:54:41 GMT 2024

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

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

Back to the top