*/
@EventBusListenerMethod
public void onDoneWithTaxonnameEditor(DoneWithPopupEvent event) {
+
+ if(!isFromOwnView(event)){
+ return;
+ }
+
if(event.getPopup() instanceof TaxonNamePopupEditor){
Registration registration = null;
if(newNameForRegistrationPopupEditor != null && event.getPopup().equals(newNameForRegistrationPopupEditor)){
*/
@EventBusListenerMethod
public void onDoneWithTypeDesignationEditor(DoneWithPopupEvent event) {
+
+ if(!isFromOwnView(event)){
+ return;
+ }
+
if(event.getPopup() instanceof SpecimenTypeDesignationWorkingsetPopupEditor){
if(event.getReason().equals(Reason.SAVE)){
// NOTE: adding the SpecimenTypeDesignations to the registration is done in the
@EventBusListenerMethod
public void onEntityChangeEvent(EntityChangeEvent event){
+ if(!isFromOwnView(event)){
+ return;
+ }
+
if(workingset == null){
return;
}
}
}
- public boolean isAtContextRoot(PopupView popupView) {
- AbstractPopupEditor popupEditor = ((AbstractPopupEditor)popupView);
- if(popupEditor.getEditorActionContext().size() > 1){
- EditorActionContext topContext = (EditorActionContext) popupEditor.getEditorActionContext().get(popupEditor.getEditorActionContext().size() - 2);
- return getView().equals(topContext.getParentView());
- } else {
- logger.error("Invalid EditorActionContext size. A popupeditor should at leaset have the workingset as root");
- return false;
- }
- }
- public EditorActionContext editorActionContextRoot(PopupView popupView) {
- Stack<EditorActionContext>context = ((AbstractPopupEditor)popupView).getEditorActionContext();
- return context.get(0);
- }
public Registration findRegistrationInContext(PopupView popupView) {
Stack<EditorActionContext>context = ((AbstractPopupEditor)popupView).getEditorActionContext();
return findRegistrationInContext(context);
}
+
/**
* Finds the Registration in the EditorContext stack
*
package eu.etaxonomy.vaadin.mvp;
import java.io.Serializable;
+import java.util.Stack;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.DisposableBean;
import eu.etaxonomy.cdm.api.application.CdmRepository;
import eu.etaxonomy.cdm.vaadin.event.AbstractEditorAction;
+import eu.etaxonomy.cdm.vaadin.event.EditorActionContext;
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
import eu.etaxonomy.vaadin.ui.navigation.NavigationManager;
+import eu.etaxonomy.vaadin.ui.view.DoneWithPopupEvent;
import eu.etaxonomy.vaadin.ui.view.PopupView;
/**
return event.getSourceView() != null && event.getSourceView().equals(getView());
}
+ public EditorActionContext editorActionContextRoot(PopupView popupView) {
+ Stack<EditorActionContext>context = ((AbstractPopupEditor)popupView).getEditorActionContext();
+ return context.get(0);
+ }
+
+ public boolean isAtContextRoot(PopupView popupView) {
+ AbstractPopupEditor popupEditor = ((AbstractPopupEditor)popupView);
+ if(popupEditor.getEditorActionContext().size() > 1){
+ EditorActionContext topContext = (EditorActionContext) popupEditor.getEditorActionContext().get(popupEditor.getEditorActionContext().size() - 2);
+ return getView().equals(topContext.getParentView());
+ } else {
+ logger.error("Invalid EditorActionContext size. A popupeditor should at leaset have the workingset as root");
+ return false;
+ }
+ }
+
+ /**
+ * @param event
+ */
+ public boolean isFromOwnView(DoneWithPopupEvent event) {
+ EditorActionContext contextRoot = editorActionContextRoot(event.getPopup());
+ return getView().equals(contextRoot.getParentView());
+ }
+
+
@Override
public void destroy() throws Exception {
unsubscribeFromEventBuses();