[XWT] change input when viewer's selection changes [message #491184] |
Tue, 13 October 2009 11:04  |
Eclipse User |
|
|
|
I have two tables A, B. If user changes selection of table A, then table B should change its input.
Example:
A: input={Binding path=mybooks}
B: input={Binding path=SELECTED_BOOK/authors}
A contains books. B shows the selected book's authors.
When user selects another book, authors must be updated accordingly.
How would I express this in xwt?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [XWT] change input when viewer's selection changes [message #563923 is a reply to message #491516] |
Thu, 15 October 2009 09:07  |
Eclipse User |
|
|
|
Can this also be done completely in xwt/declaratively, i.e. without coding in java (accessing IEclipseContext)?
On your blog you mentioned the new trigger concept which could be used for this...
Could you please provide a sample to show how to change a viewer's input based on the selection of another viewer?
Yves YANG wrote on Wed, 14 October 2009 17:09
> You can find the solution in the demo e4 contact in XWT. The same concept is used. It is in fact the Master/detail presentation pattern.
>
> Precisely, your A listens the selection event and put the selected element in the variable Selection of IEclipseContext. The view part of XWT listens the property change event on IEclipseContext and takes the Selection as data context. So in your B, you can just bind the list to "authors" directly.
|
|
|
Re: [XWT] change input when viewer's selection changes [message #563973 is a reply to message #491675] |
Sun, 18 October 2009 16:03  |
Eclipse User |
|
|
|
There are two way to manage the synchronization beween views:
1. Solution of data binding on a context object
All views set a object as data context. The viwe binds with a property
object context. The synchronization is done through the the property change
notification of the object context. It is the solution used in e4 contact
demo. The object context is IEclipseContext in case of e4 integration. Of
course, you can define your object context if you are outside of e4
workbench.
2. Event handling
This is manual solution. You define a Java controller that listens the
selection event. When the event getraised, you call set input to other
views.
You can find this solution in an example under
org.eclipse.e4.xwt/examples/org.eclipse.e4.emf.demo in eclipse CVS.
..
The event trigger is mains used inside a view, not between views
Best regards
Yves YANG
"Erdal Karaca" <erdal.karaca.de@googlemail.com> wrote in message
news:hb76q9$63p$1@build.eclipse.org...
> Can this also be done completely in xwt/declaratively, i.e. without coding
> in java (accessing IEclipseContext)?
>
> On your blog you mentioned the new trigger concept which could be used for
> this...
> Could you please provide a sample to show how to change a viewer's input
> based on the selection of another viewer?
>
> Yves YANG wrote on Wed, 14 October 2009 17:09
>> You can find the solution in the demo e4 contact in XWT. The same concept
>> is used. It is in fact the Master/detail presentation pattern. Precisely,
>> your A listens the selection event and put the selected element in the
>> variable Selection of IEclipseContext. The view part of XWT listens the
>> property change event on IEclipseContext and takes the Selection as data
>> context. So in your B, you can just bind the list to "authors" directly.
>
>
|
|
|
Re: [XWT] change input when viewer's selection changes [message #564662 is a reply to message #491675] |
Wed, 11 November 2009 17:23  |
Eclipse User |
|
|
|
"Erdal Karaca" <erdal.karaca.de@googlemail.com> wrote in message
news:hb76q9$63p$1@build.eclipse.org...
> Can this also be done completely in xwt/declaratively, i.e. without coding
> in java (accessing IEclipseContext)?
>
> On your blog you mentioned the new trigger concept which could be used for
> this...
> Could you please provide a sample to show how to change a viewer's input
> based on the selection of another viewer?
>
> Yves YANG wrote on Wed, 14 October 2009 17:09
>> You can find the solution in the demo e4 contact in XWT. The same concept
>> is used. It is in fact the Master/detail presentation pattern. Precisely,
>> your A listens the selection event and put the selected element in the
>> variable Selection of IEclipseContext. The view part of XWT listens the
>> property change event on IEclipseContext and takes the Selection as data
>> context. So in your B, you can just bind the list to "authors" directly.
>
>
It will be fixed in the next release M2.
Best regards
Yves YANG
|
|
|
Re: [XWT] change input when viewer's selection changes [message #564762 is a reply to message #496969] |
Wed, 18 November 2009 14:40  |
Eclipse User |
|
|
|
In your 1.0M2 N&N you announced the rework for the master/detail pattern...
I applied it this way:
<tableViewer x:name="master" ...>...</tableViewer>
<tableViewer input="{Binding elementName=master,path=selection}">...
I thought that the second table viewer would listen for the master's selection changes and reload using its new selection as input.
However, the selection is only applied once on creation...
Do I miss something?
|
|
|
Re: [XWT] change input when viewer's selection changes [message #564779 is a reply to message #498853] |
Thu, 19 November 2009 13:47  |
Eclipse User |
|
|
|
"Erdal Karaca" <erdal.karaca.de@googlemail.com> wrote in message
news:he1iis$tt6$1@build.eclipse.org...
> In your 1.0M2 N&N you announced the rework for the master/detail
> pattern...
> I applied it this way:
>
> <tableViewer x:name="master" ...>...</tableViewer>
>
> <tableViewer input="{Binding elementName=master,path=selection}">...
>
> I thought that the second table viewer would listen for the master's
> selection changes and reload using its new selection as input.
Yes, it is.
> However, the selection is only applied once on creation...
It is matter of implementation.. In fact, in JFace data binding, we listen a
fixed collection created for the tableviewer corresponding to
singleSelection (it is the Jface Data Binding name, not selection). The
content gets changed when the selection changes.
Best regards
Yves YANG
>
> Do I miss something?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.17614 seconds