Can you also add a test case.  At the least, select a few values before
calling getSelectedList() and make sure that the values are returned in
the correct order.


http://gwt-code-reviews.appspot.com/1674803/diff/1/user/src/com/google/gwt/view/client/MultiSelectionModel.java
File user/src/com/google/gwt/view/client/MultiSelectionModel.java
(right):

http://gwt-code-reviews.appspot.com/1674803/diff/1/user/src/com/google/gwt/view/client/MultiSelectionModel.java#newcode36
user/src/com/google/gwt/view/client/MultiSelectionModel.java:36: private
final Map<Object, T> selectedSet = new LinkedHashMap<Object, T>();
This will include GWT's emulated LinkedHashMap code into the compiled
app, which is a significant amount of code.  We generally stick to the
basic HashMap, Hashset, ArrayList collections throughout GWT to avoid
including code associated with the different types of collections.

Can we create an OrderedMultiSelectionModel subclass instead?  That way,
only users who need the functionality will pay the cost.

http://gwt-code-reviews.appspot.com/1674803/diff/1/user/src/com/google/gwt/view/client/MultiSelectionModel.java#newcode38
user/src/com/google/gwt/view/client/MultiSelectionModel.java:38: private
final Map<T, Boolean> selectionChanges = new HashMap<T, Boolean>();
selectionChanges has to be a LinkedHashMap as well, or multiple pending
changes will be applied in an undefined order when resolveChanges() is
called.

http://gwt-code-reviews.appspot.com/1674803/diff/1/user/src/com/google/gwt/view/client/MultiSelectionModel.java#newcode81
user/src/com/google/gwt/view/client/MultiSelectionModel.java:81: public
List<T> getSelectedList() {
I think this would make more sense in an OrderMultiSelectionModel
subclass.  Imposing an API restriction that MultiSelectionModel will
retain the order of items would make it tough for a user to subclass and
change the implementation.

http://gwt-code-reviews.appspot.com/1674803/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to