@Test public void testSetValue() { presenter.setValue("entry2"); verify(liveSearchDropDown).setSelectedItem("entry2", "Entry 2"); assertEquals(presenter.getValue(), "entry2"); presenter.setSelectHint("- select - "); presenter.setValue(null); verify(liveSearchDropDown).setSelectedItem("- select - ", "- select - "); assertNull(presenter.getValue()); reset(liveSearchDropDown); presenter.clear(); presenter.setValue("entry2"); presenter.setEntries(entries); verify(liveSearchDropDown).setSelectedItem("entry2", "Entry 2"); reset(liveSearchDropDown); presenter.clear(); presenter.setEntries(entries); verify(liveSearchDropDown, never()).setSelectedItem(anyString(), anyString()); }
@Override public void setValue(final String value) { this.value = value; Entry entry = getEntryByValue(value); if (entry != null) { this.dropDown.setSelectedItem(value, entry.getHint()); } else { this.dropDown.setSelectedItem(selectorHint, selectorHint); } }
DropDownEditor implements IsWidget, LeafAttributeEditor<String> { @Override public void setValue(final String value) { this.value = value; Entry entry = getEntryByValue(value); if (entry != null) { this.dropDown.setSelectedItem(value, entry.getHint()); } else { this.dropDown.setSelectedItem(selectorHint, selectorHint); } } }
DropDownEditor implements IsWidget, LeafAttributeEditor<String> { @Override public void setValue(final String value) { this.value = value; Entry entry = getEntryByValue(value); if (entry != null) { this.dropDown.setSelectedItem(value, entry.getHint()); } else { this.dropDown.setSelectedItem(selectorHint, selectorHint); } } @Inject  DropDownEditor(final View view,
                          final LiveSearchDropDown dropDown,
                          final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent); }
DropDownEditor implements IsWidget, LeafAttributeEditor<String> { @Override public void setValue(final String value) { this.value = value; Entry entry = getEntryByValue(value); if (entry != null) { this.dropDown.setSelectedItem(value, entry.getHint()); } else { this.dropDown.setSelectedItem(selectorHint, selectorHint); } } @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); }
DropDownEditor implements IsWidget, LeafAttributeEditor<String> { @Override public void setValue(final String value) { this.value = value; Entry entry = getEntryByValue(value); if (entry != null) { this.dropDown.setSelectedItem(value, entry.getHint()); } else { this.dropDown.setSelectedItem(selectorHint, selectorHint); } } @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; }