Revision 9607cc97
Added by Andreas Kohlbecker almost 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
19 | 19 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
20 | 20 |
import org.vaadin.viritin.fields.LazyComboBox; |
21 | 21 |
|
22 |
import com.vaadin.data.Property; |
|
22 | 23 |
import com.vaadin.spring.annotation.SpringComponent; |
23 | 24 |
|
24 | 25 |
import eu.etaxonomy.cdm.api.service.INameService; |
... | ... | |
90 | 91 |
|
91 | 92 |
private TaxonNameStringFilterablePagingProvider specificEpithetPartPagingProvider; |
92 | 93 |
|
94 |
private Property.ValueChangeListener refreshSpecificEpithetComboBoxListener; |
|
95 |
|
|
93 | 96 |
/** |
94 | 97 |
* {@inheritDoc} |
95 | 98 |
*/ |
... | ... | |
337 | 340 |
getView().getGenusOrUninomialField(), |
338 | 341 |
null, null, null); |
339 | 342 |
specificEpithetPartPagingProvider.updateFromFields(); |
340 |
((LazyComboBox)event.getNewField()).loadFrom(specificEpithetPartPagingProvider, specificEpithetPartPagingProvider, specificEpithetPartPagingProvider.getPageSize()); |
|
343 |
LazyComboBox<String> specificEpithetField = (LazyComboBox<String>)event.getNewField(); |
|
344 |
refreshSpecificEpithetComboBoxListener = e -> { specificEpithetField.refresh(); specificEpithetField.setValue(null);}; |
|
345 |
getView().getGenusOrUninomialField().addValueChangeListener(refreshSpecificEpithetComboBoxListener); |
|
346 |
specificEpithetField.loadFrom(specificEpithetPartPagingProvider, specificEpithetPartPagingProvider, specificEpithetPartPagingProvider.getPageSize()); |
|
341 | 347 |
} else { |
342 | 348 |
if(specificEpithetPartPagingProvider != null){ |
343 | 349 |
specificEpithetPartPagingProvider.unlistenAllFields(); |
344 | 350 |
} |
351 |
if(refreshSpecificEpithetComboBoxListener != null){ |
|
352 |
getView().getGenusOrUninomialField().removeValueChangeListener(refreshSpecificEpithetComboBoxListener); |
|
353 |
refreshSpecificEpithetComboBoxListener = null; |
|
354 |
} |
|
345 | 355 |
} |
346 |
|
|
347 | 356 |
} |
348 | 357 |
|
349 | 358 |
} |
Also available in: Unified diff
ref #7338 mode VALIDATE_AGAINST_HIGHER_NAME_PART implemented for specificEpithet - fixing field refresh problems on genus change