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 #1226018] Tue, 31 December 2013 12:40
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
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.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        if (!model.getMessageList().isEmpty()) {

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:TableViewer programmatic selection binding problem
Next Topic:ComboBoxCellEditor trims text when style is set to SWT.BORDER | SWT.READ_ONLY
Goto Forum:

Current Time: Fri Apr 16 13:46:36 GMT 2021

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

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

Back to the top