Project

General

Profile

« Previous | Next » 

Revision cca5f235

Added by Andreas Kohlbecker almost 5 years ago

ref #8220 editing exististing names for new regitration: citation detail enabled, section only restriction disabled

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
336 336
        return getRepo().getNameService();
337 337
    }
338 338

  
339
    /**
340
     * @param referenceEditorPopup
341
     */
342
    private void configureReferencePopupEditor(ReferencePopupEditor referenceEditorPopup, UUID referenceUUID) {
343
        boolean nomRefSectionEditingOnly = getView().isModeEnabled(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY);
344
        if(nomRefSectionEditingOnly){
345
            referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
346
        }
347

  
348
        // TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
349
        referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(nomRefSectionEditingOnly && newReferenceInstantiator != null));
350

  
351
        referenceEditorPopup.loadInEditor(referenceUUID);
352
        if(!nomRefSectionEditingOnly){
353
            referenceEditorPopup.getTypeSelect().setValue(ReferenceType.Article);
354
        }
355
    }
356

  
339 357
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
340 358
    public void onReferenceEditorActionAdd(ReferenceEditorAction event) {
341 359

  
......
347 365

  
348 366
        referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
349 367
        referenceEditorPopup.withDeleteButton(true);
350
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
351
        // TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
352
        referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(newReferenceInstantiator != null));
353
        referenceEditorPopup.loadInEditor(null);
354
//        if(newReferenceInstantiator != null){
355
//            // this is a bit clumsy, we actually need to inject something like a view configurer
356
//            // which can enable, disable fields
357
//            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
358
//            referenceEditorPopup.getTypeSelect().setEnabled(false);
359
//        }
368
        configureReferencePopupEditor(referenceEditorPopup, null);
360 369
    }
361 370

  
371

  
362 372
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
363 373
    public void onReferenceEditorActionEdit(ReferenceEditorAction event) {
364 374

  
......
369 379
        ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
370 380

  
371 381
        referenceEditorPopup.withDeleteButton(true);
372
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
373
        // TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
374
        referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(newReferenceInstantiator != null));
375
        referenceEditorPopup.loadInEditor(event.getEntityUuid());
376
//        if(newReferenceInstantiator != null){
377
//            // this is a bit clumsy, we actually need to inject something like a view configurator
378
//            // which can enable, disable fields
379
//            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
380
//            referenceEditorPopup.getInReferenceCombobox().setEditButtonEnabled(false); // <-------
381
//            referenceEditorPopup.getTypeSelect().setEnabled(false);
382
//        }
382
        configureReferencePopupEditor(referenceEditorPopup, event.getEntityUuid());
383 383
    }
384 384

  
385 385
    @EventBusListenerMethod

Also available in: Unified diff