Revision af10794f
Added by Andreas Kohlbecker almost 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/occurrence/CollectionEditorPresenter.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader; |
27 | 27 |
import eu.etaxonomy.cdm.vaadin.permission.UserHelper; |
28 | 28 |
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter; |
29 |
import eu.etaxonomy.vaadin.mvp.BoundField; |
|
30 |
import eu.etaxonomy.vaadin.ui.view.PopupView; |
|
29 | 31 |
|
30 | 32 |
/** |
31 | 33 |
* @author a.kohlbecker |
... | ... | |
37 | 39 |
public class CollectionEditorPresenter extends AbstractCdmEditorPresenter<Collection, CollectionPopupEditorView> { |
38 | 40 |
|
39 | 41 |
private static final long serialVersionUID = -1996365248431425021L; |
40 |
private CollectionPopupEditor collectionPopuEditor; |
|
41 | 42 |
|
42 | 43 |
|
43 | 44 |
/** |
... | ... | |
113 | 114 |
return; |
114 | 115 |
} |
115 | 116 |
|
116 |
collectionPopuEditor = getNavigationManager().showInPopup(CollectionPopupEditor.class, getView(), null);
|
|
117 |
CollectionPopupEditor collectionPopuEditor = openPopupEditor(CollectionPopupEditor.class, event);
|
|
117 | 118 |
|
118 | 119 |
collectionPopuEditor.grantToCurrentUser(this.crud); |
119 | 120 |
collectionPopuEditor.withDeleteButton(true); |
... | ... | |
127 | 128 |
return; |
128 | 129 |
} |
129 | 130 |
|
130 |
collectionPopuEditor = getNavigationManager().showInPopup(CollectionPopupEditor.class, getView(), null);
|
|
131 |
CollectionPopupEditor collectionPopuEditor = openPopupEditor(CollectionPopupEditor.class, event);
|
|
131 | 132 |
|
132 | 133 |
collectionPopuEditor.grantToCurrentUser(this.crud); |
133 | 134 |
collectionPopuEditor.withDeleteButton(true); |
... | ... | |
136 | 137 |
|
137 | 138 |
@EventBusListenerMethod() |
138 | 139 |
public void onEntityChangeEvent(EntityChangeEvent<?> event){ |
139 |
if(event.getSourceView() == collectionPopuEditor){ |
|
140 |
if(event.isCreateOrModifiedType()){ |
|
141 |
|
|
142 |
Collection newCollection = (Collection) event.getEntity(); |
|
143 |
getCache().load(newCollection); |
|
144 |
if(event.isCreatedType()){ |
|
145 |
getView().getSuperCollectionCombobox().setValue(newCollection); |
|
146 |
} else { |
|
147 |
getView().getSuperCollectionCombobox().reload(); |
|
140 |
|
|
141 |
BoundField boundTargetField = boundTargetField((PopupView) event.getSourceView()); |
|
142 |
|
|
143 |
if(boundTargetField != null){ |
|
144 |
if(boundTargetField.matchesPropertyIdPath("superCollection")){ |
|
145 |
if(event.isCreateOrModifiedType()){ |
|
146 |
|
|
147 |
Collection newCollection = (Collection) event.getEntity(); |
|
148 |
getCache().load(newCollection); |
|
149 |
if(event.isCreatedType()){ |
|
150 |
getView().getSuperCollectionCombobox().setValue(newCollection); |
|
151 |
} else { |
|
152 |
getView().getSuperCollectionCombobox().reload(); |
|
153 |
} |
|
148 | 154 |
} |
149 |
} |
|
150 | 155 |
|
151 |
collectionPopuEditor = null;
|
|
156 |
}
|
|
152 | 157 |
} |
153 | 158 |
} |
154 | 159 |
|
Also available in: Unified diff
consistent popup opening, using boundTargetField to identify field to be updated