Revision aec76ebb
Added by Andreas Kohlbecker about 5 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
441 | 441 |
getCache().load(event.getEntity()); |
442 | 442 |
if(getView().getGenusOrUninomialField() instanceof WeaklyRelatedEntityCombobox){ |
443 | 443 |
WeaklyRelatedEntityCombobox<TaxonName> weaklyRelatedEntityCombobox = (WeaklyRelatedEntityCombobox<TaxonName>)getView().getGenusOrUninomialField(); |
444 |
if(event.isCreatedType()){ |
|
445 |
weaklyRelatedEntityCombobox.setValue(((TaxonName)event.getEntity()).getGenusOrUninomial()); |
|
446 |
weaklyRelatedEntityCombobox.reload(); |
|
447 |
} else { |
|
448 |
weaklyRelatedEntityCombobox.reload(); |
|
449 |
} |
|
444 |
weaklyRelatedEntityCombobox.setValue(((TaxonName)event.getEntity()).getGenusOrUninomial()); |
|
450 | 445 |
// NOTE: in contrast to the ToOneRelatedEntityCombobox the .discard() does not |
451 | 446 |
// work here since no datasource is bound to the field, see weaklyRelatedEntityCombobox.reload() |
452 | 447 |
weaklyRelatedEntityCombobox.updateButtons(); |
src/main/java/eu/etaxonomy/vaadin/component/ReloadableLazyComboBox.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import com.vaadin.ui.AbstractField; |
17 | 17 |
import com.vaadin.ui.AbstractSelect; |
18 |
import com.vaadin.ui.ComboBox; |
|
19 | 18 |
|
20 | 19 |
public class ReloadableLazyComboBox<T> extends LazyComboBox<T> implements ReloadableSelect, EntitySupport<T> { |
21 | 20 |
|
... | ... | |
51 | 50 |
*/ |
52 | 51 |
@Override |
53 | 52 |
public void reload() { |
54 |
// in the LazyComboBox.initList() scrollToSelectedItem is set to false for better performance |
|
55 |
// but this breaks the refresh, so we need to set it now so that it can |
|
56 |
// affect the next component repaint which is triggered in refresh() |
|
57 |
ComboBox comboBox = (ComboBox)getSelect(); |
|
58 |
comboBox.setScrollToSelectedItem(true); |
|
59 | 53 |
refresh(); // reload from persistence |
60 | 54 |
discard(); // reload from property data source |
61 | 55 |
} |
src/main/java/eu/etaxonomy/vaadin/component/WeaklyRelatedEntityCombobox.java | ||
---|---|---|
198 | 198 |
@Override |
199 | 199 |
public void setValue(String newFieldValue) throws com.vaadin.data.Property.ReadOnlyException, ConversionException { |
200 | 200 |
if(!Objects.equals(newFieldValue, lazySelect.getValue())){ |
201 |
lazySelect.refresh(); |
|
202 | 201 |
if(contains(newFieldValue)){ |
203 | 202 |
lazySelect.setValue(newFieldValue); |
203 |
lazySelect.markAsDirty(); |
|
204 | 204 |
} |
205 |
lazySelect.markAsDirty(); |
|
206 | 205 |
} |
207 | 206 |
} |
208 | 207 |
|
Also available in: Unified diff
ref #8176 removing workaround with bad performance which was need for broken TaxonNameStringFilterablePagingProvider.idFor()