Revision a043ae5b
Added by Andreas Kohlbecker over 5 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
14 | 14 |
import java.util.HashSet; |
15 | 15 |
import java.util.Map; |
16 | 16 |
import java.util.Set; |
17 |
import java.util.Stack; |
|
17 | 18 |
|
18 | 19 |
import org.springframework.beans.factory.DisposableBean; |
19 | 20 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
47 | 48 |
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit; |
48 | 49 |
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory; |
49 | 50 |
import eu.etaxonomy.cdm.vaadin.component.CollectionRowItemCollection; |
51 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionContext; |
|
50 | 52 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent; |
51 | 53 |
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEventFilter; |
52 | 54 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater; |
... | ... | |
61 | 63 |
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor; |
62 | 64 |
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox; |
63 | 65 |
import eu.etaxonomy.vaadin.mvp.AbstractEditorPresenter; |
66 |
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor; |
|
67 |
import eu.etaxonomy.vaadin.mvp.AbstractView; |
|
64 | 68 |
/** |
65 | 69 |
* SpecimenTypeDesignationWorkingsetPopupEditorView implementation must override the showInEditor() method, |
66 | 70 |
* see {@link #prepareAsFieldGroupDataSource()} for details. |
... | ... | |
349 | 353 |
@EventBusListenerMethod(filter = EntityChangeEventFilter.OccurrenceCollectionFilter.class) |
350 | 354 |
public void onCollectionEvent(EntityChangeEvent event){ |
351 | 355 |
|
352 |
if(!isFromOwnView(event)){ |
|
353 |
return; |
|
354 |
} |
|
355 |
|
|
356 |
Collection newCollection = getRepo().getCollectionService().load( |
|
357 |
event.getEntityUuid(), Arrays.asList(new String[]{"$.institute"}) |
|
358 |
); |
|
359 |
cache.load(newCollection); |
|
356 |
if(event.getSourceView() instanceof AbstractPopupEditor) { |
|
357 |
|
|
358 |
Stack<EditorActionContext> context = ((AbstractPopupEditor) event.getSourceView()).getEditorActionContext(); |
|
359 |
if(context.size() > 1){ |
|
360 |
AbstractView<?> parentView = context.get(context.size() - 2).getParentView(); |
|
361 |
if(getView().equals(parentView)){ |
|
362 |
Collection newCollection = getRepo().getCollectionService().load( |
|
363 |
event.getEntityUuid(), Arrays.asList(new String[]{"$.institute"}) |
|
364 |
); |
|
365 |
cache.load(newCollection); |
|
366 |
|
|
367 |
if(event.isCreatedType()){ |
|
368 |
SpecimenTypeDesignationDTORow row = collectionPopupEditorsRowMap.get(event.getSourceView()); |
|
369 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
370 |
combobox.setValue((Collection) event.getEntity()); |
|
371 |
} |
|
372 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
|
373 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
374 |
combobox.reload(); |
|
375 |
} |
|
376 |
} |
|
377 |
} |
|
360 | 378 |
|
361 |
if(event.isCreatedType()){ |
|
362 |
SpecimenTypeDesignationDTORow row = collectionPopupEditorsRowMap.get(event.getSourceView()); |
|
363 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
364 |
combobox.setValue((Collection) event.getEntity()); |
|
365 |
} |
|
366 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
|
367 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
368 |
combobox.reload(); |
|
369 | 379 |
} |
370 | 380 |
} |
371 | 381 |
|
Also available in: Unified diff
#7878 adapting SpecimenTypeDesignationWorkingsetEditorPresenter to using the editorActionContext information