Project

General

Profile

« Previous | Next » 

Revision 34d43087

Added by Andreas Kohlbecker about 5 years ago

ref #8191 intoducing the long awaited EditorFormConfigurator for fine tuning of the inReference button enabled states

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
55 55
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUIDefaults;
56 56
import eu.etaxonomy.cdm.vaadin.util.CdmTitleCacheCaptionGenerator;
57 57
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
58
import eu.etaxonomy.cdm.vaadin.view.reference.RegistrationUiReferenceEditorFormConfigurator;
58 59
import eu.etaxonomy.vaadin.component.CompositeCustomField;
59 60
import eu.etaxonomy.vaadin.component.ReloadableLazyComboBox;
60 61
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
......
340 341
        referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
341 342
        referenceEditorPopup.withDeleteButton(true);
342 343
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
344
        // TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
345
        referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(newReferenceInstantiator != null));
343 346
        referenceEditorPopup.loadInEditor(null);
344
        if(newReferenceInstantiator != null){
345
            // this is a bit clumsy, we actually need to inject something like a view configurer
346
            // which can enable, disable fields
347
            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
348
            referenceEditorPopup.getTypeSelect().setEnabled(false);
349
        }
347
//        if(newReferenceInstantiator != null){
348
//            // this is a bit clumsy, we actually need to inject something like a view configurer
349
//            // which can enable, disable fields
350
//            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
351
//            referenceEditorPopup.getTypeSelect().setEnabled(false);
352
//        }
350 353
    }
351 354

  
352 355
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
......
360 363

  
361 364
        referenceEditorPopup.withDeleteButton(true);
362 365
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
366
        // TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
367
        referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(newReferenceInstantiator != null));
363 368
        referenceEditorPopup.loadInEditor(event.getEntityUuid());
364
        if(newReferenceInstantiator != null){
365
            // this is a bit clumsy, we actually need to inject something like a view configurator
366
            // which can enable, disable fields
367
            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
368
            referenceEditorPopup.getTypeSelect().setEnabled(false);
369
        }
369
//        if(newReferenceInstantiator != null){
370
//            // this is a bit clumsy, we actually need to inject something like a view configurator
371
//            // which can enable, disable fields
372
//            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
373
//            referenceEditorPopup.getInReferenceCombobox().setEditButtonEnabled(false); // <-------
374
//            referenceEditorPopup.getTypeSelect().setEnabled(false);
375
//        }
370 376
    }
371 377

  
372 378
    @EventBusListenerMethod

Also available in: Unified diff