public void toMultiple(final IsListBox source, final List<P> options, final ListBoxLambdaAdaptor<P> adaptor) { toMultiple(source, options, (ListBoxAdaptor<P, P>) adaptor); }
/** Binds our {@code p} to the selection in {@code source}, given the {@code options}. */ public void toMultiple(final IsListBox source, final List<P> options) { toMultiple(source, options, new ListBoxIdentityAdaptor<P>()); }
@Test public void toListBoxWithAdaptor() { List<String> options = Copy.list("one", "two", "three"); names.add("one"); binder.bind(names).toMultiple(box, options, o -> o.toUpperCase()); assertThat(box.getSelectedTexts(), contains("ONE")); names.add("two"); assertThat(box.getSelectedTexts(), contains("ONE", "TWO")); box.setItemSelected(2, true); assertThat(names.get(), contains("one", "two", "three")); }
@Test public void toListBox() { List<String> options = Copy.list("one", "two", "three"); names.add("one"); binder.bind(names).toMultiple(box, options); assertThat(box.getSelectedTexts(), contains("one")); names.add("two"); assertThat(box.getSelectedTexts(), contains("one", "two")); box.setItemSelected(2, true); assertThat(names.get(), contains("one", "two", "three")); }