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 #1226018] Tue, 31 December 2013 12:40
Joseph Gagnon is currently offline Joseph Gagnon
Messages: 58
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?
Previous Topic:JFACE/SWT - Cell Editor Alignment issue according to Character Space
Next Topic:TableViewer programmatic selection binding problem
Goto Forum:
  


Current Time: Thu Oct 30 17:37:49 GMT 2014

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

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