Project

General

Profile

« Previous | Next » 

Revision e5e64d18

Added by Andreas Kohlbecker about 6 years ago

ref #7344 updating presenter entity caches with beans modified in popup editors and refreshing teamOrPerson Fields (2)

  • adding entity as field to EntityChangeEvent
  • replacing all onDoneWithEditor listener methods by according onEntityChangeEvent methods

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java
42 42
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationDTO;
43 43
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
44 44
import eu.etaxonomy.vaadin.mvp.AbstractView;
45
import eu.etaxonomy.vaadin.ui.view.DoneWithPopupEvent;
46
import eu.etaxonomy.vaadin.ui.view.DoneWithPopupEvent.Reason;
47 45

  
48 46
/**
49 47
 * @author a.kohlbecker
......
184 182
        // deleteTypedesignation(uuid, uuid) needs to be called so the name is loaded in the transaction of the method and is saved.
185 183
        DeleteResult deletResult = getRepo().getNameService().deleteTypeDesignation(typifiedNameInContext.getUuid(), bean.getUuid());
186 184
        if(deletResult.isOk()){
187
            EntityChangeEvent changeEvent = new EntityChangeEvent(bean.getClass(), bean.getId(), Type.REMOVED, (AbstractView) getView());
185
            EntityChangeEvent changeEvent = new EntityChangeEvent(bean, Type.REMOVED, (AbstractView) getView());
188 186
            viewEventBus.publish(this, changeEvent);
189 187
        } else {
190 188
            CdmStore.handleDeleteresultInError(deletResult);
......
258 256
    }
259 257

  
260 258
    @EventBusListenerMethod
261
    public void onDoneWithPopupEvent(DoneWithPopupEvent event){
259
    public void onEntityChangeEvent(EntityChangeEvent<?>event){
262 260

  
263
        if(event.getPopup() == typeNamePopup){
264
            if(event.getReason() == Reason.SAVE){
265
                getCache().load(typeNamePopup.getBean());
261
        if(event.getSourceView() == typeNamePopup){
262
            if(event.isCreateOrModifiedType()){
263
                getCache().load(event.getEntity());
266 264
                getView().getTypeNameField().reload();
267 265
            }
268
            if(event.getReason() == Reason.DELETE){
266
            if(event.isRemovedType()){
269 267
                getView().getTypeNameField().selectNewItem(null);
270 268
            }
271 269
            typeNamePopup = null;

Also available in: Unified diff