gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 373 forks source link

SingleSelectionModel.getSelectedSet() does not call resolveChanges() #8304

Closed dankurka closed 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 8316

Found in GWT Release (e.g. 2.4.0, 2.5.1, trunk):

GWT 2.5.1

Encountered on OS / Browser (e.g. WinXP, IE9, FF10):
n/a

Detailed description (please be as specific as possible):

SingleSelectionModel.getSelectedSet() does not call resolveChanges() whereas getSelectedObject()
does. This means if you call getSelectedSet() followed by getSelectedItem() you will
get different results.

Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):

Workaround if you have one:

Call a method that does call resolveChanges() (e.g. getSelectedObject()) before calling
getSelectedSet(). This can be wrapped up into a class

    class SingleSelectionModelEx<T> extends SingleSelectionModel<T> {

        @Override
        public Set<T> getSelectedSet() {
            /* Workaround issue where getSelectedSet() does not call resolveChnages()
by first calling getSelectedObject() which does */ 
            getSelectedObject();
            return super.getSelectedSet();
        }
    }

Links to relevant GWT Developer Forum posts:

Link to patch posted at http://gwt-review.googlesource.com

Reported by pillingworthz on 2013-08-21 12:21:21

dankurka commented 9 years ago
It's actually been fixed already: https://gwt-review.googlesource.com/3680

Reported by t.broyer on 2013-08-22 08:59:04

dankurka commented 9 years ago
Changing status because 2.6 is released.

Reported by skybrian@google.com on 2014-02-05 22:25:26