DropDownEditor implements IsWidget, LeafAttributeEditor<String> { public void getDropDownEntries(String pattern, int maxResults, LiveSearchCallback callback) { final LiveSearchResults results = new LiveSearchResults(); entries.stream() .filter(e -> e.getHint().contains(pattern)) .forEach(e -> results.add(e.getValue(), e.getHint())); callback.afterSearch(results); } @Inject  DropDownEditor(final View view,
                          final LiveSearchDropDown dropDown,
                          final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent); @PostConstruct void init(); @Override Widget asWidget(); void getDropDownEntries(String pattern, int maxResults, LiveSearchCallback callback); void onEntrySelected(); String getSelectedValue(); void setSelectHint(String hint); Entry newEntry(final String value, String hint); void setEntries(final Collection<Entry> entries); void addHelpContent(final String title, final String content, final Placement placement); void clear(); @Override void showErrors(final List<EditorError> errors); @Override String getValue(); @Override void setValue(final String value); public View view; }
@Test public void testEntries() { presenter.getDropDownEntries("", -1, itemList -> { assertEquals(itemList.size(), 2); assertEquals(itemList.get(0).getKey(), "entry1"); assertEquals(itemList.get(1).getKey(), "entry2"); }); }