Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TableViewer programmatic selection binding problem
TableViewer programmatic selection binding problem [message #1225715] Mon, 30 December 2013 15:24 Go to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
I am developing an eclipse 4 RCP application using SWT/JFace. One of the UI screens presents a table and an associated view that displays information from the selected row. I have successfuly set up data binding to display the information for the selected row in the display area. The method used is shown below.

    IObservableValue selection = ViewersObservables.observeSingleSelection(tableView);
    IObservableValue detailObservable = BeansObservables.observeDetailValue(selection, "myField", MyClass.class);
    IObservableValue widgetValue = SWTObservables.observeText(messagePane.getMyFieldControl());
    DataBindingUtil.getContext().bindValue(widgetValue, detailObservable);


messagePane is a Composite class extension that will be re-used in various ways in the application. The class provides getter methods for each control that I need to bind data to. DataBindingUtil is a helper class to make some of the tedious data binding tasks easier.

The UI screen described also has some navigation buttons that allow the user to move to the front/end of the current list of messages, as well as moving to the prior/next message. The logic attached to these buttons changes the table selection, but the data binding does not follow suit. I need to physically click on the desired row for the message display fields to update.

As an example:

    Button toStartBtn = new Button(comp, SWT.NONE);
    toStartBtn.setText("First");
    toStartBtn.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        if (!model.getMessageList().isEmpty()) {
          tableView.getTable().setSelection(0);
        }
      }
    });


Why does the data binding not work in this case? Is there a subtle correction I need to make in how the data binding is done or how the table selection is changed? Something else?
Re: TableViewer programmatic selection binding problem [message #1225717 is a reply to message #1225715] Mon, 30 December 2013 15:26 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
I just realized I probably should have posted this under the JFace topic. Is there any easy way to "move" a posting to a different topic?
Re: TableViewer programmatic selection binding problem [message #1226329 is a reply to message #1225717] Wed, 01 January 2014 11:57 Go to previous message
Eclipse UserFriend
I'll move it for you.
Previous Topic:JFACE/SWT - Cell Editor Alignment issue according to Character Space
Next Topic:TableViewer programmatic selection binding problem
Goto Forum:
  


Current Time: Sat Apr 20 02:48:24 GMT 2024

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

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

Back to the top