Project

General

Profile

Download (23 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.view.name;
10

    
11
import java.util.Arrays;
12
import java.util.EnumSet;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import org.apache.log4j.Logger;
17
import org.hibernate.criterion.Restrictions;
18
import org.springframework.context.annotation.Scope;
19
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
20
import org.vaadin.viritin.fields.LazyComboBox;
21

    
22
import com.vaadin.data.Property;
23
import com.vaadin.spring.annotation.SpringComponent;
24

    
25
import eu.etaxonomy.cdm.api.service.INameService;
26
import eu.etaxonomy.cdm.model.agent.AgentBase;
27
import eu.etaxonomy.cdm.model.agent.Person;
28
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
29
import eu.etaxonomy.cdm.model.common.TermType;
30
import eu.etaxonomy.cdm.model.name.Rank;
31
import eu.etaxonomy.cdm.model.name.TaxonName;
32
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
33
import eu.etaxonomy.cdm.model.reference.Reference;
34
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
35
import eu.etaxonomy.cdm.model.reference.ReferenceType;
36
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
37
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
38
import eu.etaxonomy.cdm.service.TaxonNameStringFilterablePagingProvider;
39
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit;
40
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
41
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
42
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
43
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
44
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
45
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater;
46
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader;
47
import eu.etaxonomy.cdm.vaadin.model.name.TaxonNameDTO;
48
import eu.etaxonomy.cdm.vaadin.permission.UserHelper;
49
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUIDefaults;
50
import eu.etaxonomy.cdm.vaadin.util.CdmTitleCacheCaptionGenerator;
51
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
52
import eu.etaxonomy.vaadin.component.ReloadableLazyComboBox;
53
import eu.etaxonomy.vaadin.event.FieldReplaceEvent;
54
import eu.etaxonomy.vaadin.mvp.AbstractCdmDTOEditorPresenter;
55
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
56
import eu.etaxonomy.vaadin.mvp.BeanInstantiator;
57
import eu.etaxonomy.vaadin.mvp.BoundField;
58
import eu.etaxonomy.vaadin.ui.view.PopupView;
59
import eu.etaxonomy.vaadin.util.PropertyIdPath;
60

    
61
/**
62
 * @author a.kohlbecker
63
 * @since May 22, 2017
64
 *
65
 */
66
@SpringComponent
67
@Scope("prototype")
68
public class TaxonNameEditorPresenter extends AbstractCdmDTOEditorPresenter<TaxonNameDTO, TaxonName, TaxonNamePopupEditorView> {
69

    
70

    
71
    private static final List<String> BASIONYM_INIT_STRATEGY = Arrays.asList(
72
            "$",
73
            "relationsFromThisName",
74
            "relationsToThisName.type",
75
            "homotypicalGroup.typifiedNames"
76
            );
77

    
78
    private static final List<String> REFERENCE_INIT_STRATEGY = Arrays.asList("authorship", "inReference.authorship", "inReference.inReference.authorship", "inReference.inReference.inReference.authorship");
79

    
80
    private static final long serialVersionUID = -3538980627079389221L;
81

    
82
    private static final Logger logger = Logger.getLogger(TaxonNameEditorPresenter.class);
83

    
84
    private CdmFilterablePagingProvider<Reference, Reference> nomReferencePagingProvider;
85

    
86
    private Reference publishedUnit;
87

    
88
    private BeanInstantiator<Reference> newReferenceInstantiator;
89

    
90
    private TaxonNameStringFilterablePagingProvider genusOrUninomialPartPagingProvider;
91

    
92
    private TaxonNameStringFilterablePagingProvider specificEpithetPartPagingProvider;
93

    
94
    private Property.ValueChangeListener refreshSpecificEpithetComboBoxListener;
95

    
96
    /**
97
     * {@inheritDoc}
98
     */
99
    @Override
100
    public void handleViewEntered() {
101

    
102
        super.handleViewEntered();
103

    
104
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
105
        getView().getRankSelect().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(TermType.Rank));
106
        getView().getRankSelect().setItemCaptionPropertyId("label");
107

    
108
        // genusOrUninomialField
109
        if(getView().getGenusOrUninomialField() instanceof LazyComboBox){
110
            genusOrUninomialPartPagingProvider = new TaxonNameStringFilterablePagingProvider(getRepo().getNameService());
111
            genusOrUninomialPartPagingProvider.listenToFields(
112
                    null,
113
                    getView().getInfraGenericEpithetField(),
114
                    getView().getSpecificEpithetField(),
115
                    getView().getInfraSpecificEpithetField()
116
                   );
117
            ((LazyComboBox)getView().getGenusOrUninomialField()).loadFrom(genusOrUninomialPartPagingProvider, genusOrUninomialPartPagingProvider, genusOrUninomialPartPagingProvider.getPageSize());
118
        }
119

    
120
        CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase> termOrPersonPagingProvider = new CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase>(getRepo().getAgentService(), TeamOrPersonBase.class);
121
        termOrPersonPagingProvider.setInitStrategy(AgentBaseInit.TEAM_OR_PERSON_INIT_STRATEGY);
122
        CdmFilterablePagingProvider<AgentBase, Person> personPagingProvider = new CdmFilterablePagingProvider<AgentBase, Person>(getRepo().getAgentService(), Person.class);
123

    
124
        getView().getCombinationAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
125
        getView().getCombinationAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
126

    
127
        getView().getExCombinationAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
128
        getView().getExCombinationAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
129

    
130
        getView().getBasionymAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
131
        getView().getBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
132

    
133
        getView().getExBasionymAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
134
        getView().getExBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
135

    
136
        getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
137
        nomReferencePagingProvider = pagingProviderFactory.referencePagingProvider();
138
        nomReferencePagingProvider.setInitStrategy(REFERENCE_INIT_STRATEGY);
139
        getView().getNomReferenceCombobox().loadFrom(nomReferencePagingProvider, nomReferencePagingProvider, nomReferencePagingProvider.getPageSize());
140
        getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getNomReferenceCombobox()));
141
        getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getNomReferenceCombobox(), this));
142

    
143
        getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
144

    
145
        CdmFilterablePagingProvider<TaxonName, TaxonName> basionymPagingProvider = new CdmFilterablePagingProvider<TaxonName, TaxonName>(getRepo().getNameService());
146
        basionymPagingProvider.setInitStrategy(BASIONYM_INIT_STRATEGY);
147
        getView().getBasionymComboboxSelect().setPagingProviders(basionymPagingProvider, basionymPagingProvider, basionymPagingProvider.getPageSize(), this);
148

    
149
        getView().getReplacedSynonymsComboboxSelect().setCaptionGenerator( new CdmTitleCacheCaptionGenerator<TaxonName>());
150
        // reusing the basionymPagingProvider for the replaced synonyms to benefit from caching
151
        getView().getReplacedSynonymsComboboxSelect().setPagingProviders(basionymPagingProvider, basionymPagingProvider, basionymPagingProvider.getPageSize(), this);
152

    
153
        getView().getValidationField().getValidatedNameComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
154
        // reusing the basionymPagingProvider for the replaced synonyms to benefit from caching
155
        getView().getValidationField().getValidatedNameComboBox().loadFrom(basionymPagingProvider, basionymPagingProvider, basionymPagingProvider.getPageSize());
156
        getView().getValidationField().getValidatedNameComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getValidatedNameComboBox(), this));
157

    
158
        getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
159
        CdmFilterablePagingProvider<Reference, Reference> icbnCodesPagingProvider = pagingProviderFactory.referencePagingProvider();
160
        icbnCodesPagingProvider.setInitStrategy(REFERENCE_INIT_STRATEGY);
161
        // @formatter:off
162
        // TODO use markers on references instead of isbn. The marker type MarkerType.NOMENCLATURAL_RELEVANT() has already prepared (#7466)
163
        icbnCodesPagingProvider.getCriteria().add(Restrictions.in("isbn", new String[]{
164
                "3-904144-22-7",     // Saint Louis Code
165
                "3-906166-48-1",     // Vienna Code
166
                "978-3-87429-425-6", // Melbourne Code
167
                "978-3-946583-16-5", // Shenzhen Code
168
                "0-85301-006-4"      // ICZN 1999
169
                                     // ICNB
170
                }));
171
        // @formatter:on
172
        getView().getValidationField().getCitatonComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
173
        getView().getValidationField().getCitatonComboBox().loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize());
174
        getView().getValidationField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getCitatonComboBox(), this));
175
    }
176

    
177
    /**
178
     * {@inheritDoc}
179
     */
180
    @Override
181
    protected TaxonName loadCdmEntity(UUID identifier) {
182

    
183
        List<String> initStrategy = Arrays.asList(new String []{
184

    
185
                "$",
186
                "rank.vocabulary", // needed for comparing ranks
187

    
188
                "nomenclaturalReference.authorship",
189
                "nomenclaturalReference.inReference.authorship",
190
                "nomenclaturalReference.inReference.inReference.authorship",
191
                "nomenclaturalReference.inReference.inReference.inReference.authorship",
192

    
193
                "status.type",
194

    
195
                "combinationAuthorship",
196
                "exCombinationAuthorship",
197
                "basionymAuthorship",
198
                "exBasionymAuthorship",
199

    
200
                // basionyms: relationsToThisName.fromName
201
                "relationsToThisName.type",
202
                "relationsToThisName.fromName.rank",
203
                "relationsToThisName.fromName.combinationAuthorship",
204
                "relationsToThisName.fromName.exCombinationAuthorship",
205
                "relationsToThisName.fromName.nomenclaturalReference.authorship",
206
                "relationsToThisName.fromName.nomenclaturalReference.inReference.authorship",
207
                "relationsToThisName.fromName.nomenclaturalReference.inReference.inReference.inReference.authorship",
208
                "relationsToThisName.fromName.relationsToThisName",
209
                "relationsToThisName.fromName.relationsFromThisName",
210
                "relationsToThisName.citation",
211

    
212
                "relationsFromThisName",
213
                "homotypicalGroup.typifiedNames"
214

    
215
                }
216
        );
217

    
218
        TaxonName taxonName;
219
        if(identifier != null){
220
            taxonName = getRepo().getNameService().load(identifier, initStrategy);
221
        } else {
222
            taxonName = TaxonNameFactory.NewNameInstance(RegistrationUIDefaults.NOMENCLATURAL_CODE, Rank.SPECIES());
223
        }
224

    
225
        if(getView().isModeEnabled(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY)){
226
            if(taxonName.getNomenclaturalReference() != null){
227
                Reference nomRef = taxonName.getNomenclaturalReference();
228
                //getView().getNomReferenceCombobox().setEnabled(nomRef.isOfType(ReferenceType.Section));
229
                publishedUnit = nomRef;
230
                while(publishedUnit.isOfType(ReferenceType.Section) && publishedUnit.getInReference() != null){
231
                    publishedUnit = nomRef.getInReference();
232
                }
233
                // reduce available references to those which are sections of the publishedUnit and the publishedUnit itself
234
                // nomReferencePagingProvider
235
                nomReferencePagingProvider.getCriteria().add(Restrictions.or(
236
                        Restrictions.and(Restrictions.eq("inReference", publishedUnit), Restrictions.eq("type", ReferenceType.Section)),
237
                        Restrictions.idEq(publishedUnit.getId())
238
                        )
239
                );
240
                // and remove the empty option
241
                getView().getNomReferenceCombobox().getSelect().setNullSelectionAllowed(false);
242

    
243
                // new Reference only a sub sections of the publishedUnit
244
                newReferenceInstantiator = new BeanInstantiator<Reference>() {
245
                    @Override
246
                    public Reference createNewBean() {
247
                        Reference newRef = ReferenceFactory.newSection();
248
                        newRef.setInReference(publishedUnit);
249
                        return newRef;
250
                    }
251
                };
252

    
253
            }
254
        }
255

    
256
        return taxonName;
257
    }
258

    
259
    /**
260
     * {@inheritDoc}
261
     */
262
    @Override
263
    protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
264
        if(crud != null){
265
            newAuthorityCreated = UserHelper.fromSession().createAuthorityForCurrentUser(TaxonName.class, identifier, crud, null);
266
        }
267

    
268
    }
269

    
270
    /**
271
     * {@inheritDoc}
272
     */
273
    @Override
274
    protected void guaranteePerEntityCRUDPermissions(TaxonName bean) {
275
        if(crud != null){
276
            newAuthorityCreated = UserHelper.fromSession().createAuthorityForCurrentUser(bean, crud, null);
277
        }
278
    }
279

    
280
    /**
281
     * {@inheritDoc}
282
     */
283
    @Override
284
    protected INameService getService() {
285
        return getRepo().getNameService();
286
    }
287

    
288
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
289
    public void onReferenceEditorActionAdd(ReferenceEditorAction event) {
290

    
291
        if(getView() == null || event.getSourceView() != getView() ){
292
            return;
293
        }
294

    
295
        ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
296

    
297
        referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
298
        referenceEditorPopup.withDeleteButton(true);
299
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
300
        referenceEditorPopup.loadInEditor(null);
301
        if(newReferenceInstantiator != null){
302
            // this is a bit clumsy, we actually need to inject something like a view configurer
303
            // which can enable, disable fields
304
            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
305
            referenceEditorPopup.getTypeSelect().setEnabled(false);
306
        }
307
    }
308

    
309
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
310
    public void onReferenceEditorActionEdit(ReferenceEditorAction event) {
311

    
312

    
313
        if(!isFromOwnView(event)){
314
            return;
315
        }
316
        ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
317

    
318
        referenceEditorPopup.withDeleteButton(true);
319
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
320
        referenceEditorPopup.loadInEditor(event.getEntityUuid());
321
        if(newReferenceInstantiator != null){
322
            // this is a bit clumsy, we actually need to inject something like a view configurator
323
            // which can enable, disable fields
324
            referenceEditorPopup.getInReferenceCombobox().setEnabled(false);
325
            referenceEditorPopup.getTypeSelect().setEnabled(false);
326
        }
327
    }
328

    
329
    @EventBusListenerMethod
330
    public void onFieldReplaceEvent(FieldReplaceEvent<String> event){
331

    
332
        PropertyIdPath boundPropertyIdPath = boundPropertyIdPath(event.getNewField());
333
        if(boundPropertyIdPath != null && boundPropertyIdPath.matches("specificEpithet")){
334
            if(event.getNewField() instanceof LazyComboBox){
335

    
336
                if(specificEpithetPartPagingProvider  == null){
337
                    specificEpithetPartPagingProvider = new TaxonNameStringFilterablePagingProvider(getRepo().getNameService(), Rank.SPECIES());
338
                }
339
                specificEpithetPartPagingProvider.listenToFields(
340
                        getView().getGenusOrUninomialField(),
341
                        null, null, null);
342
                specificEpithetPartPagingProvider.updateFromFields();
343
                LazyComboBox<String> specificEpithetField = (LazyComboBox<String>)event.getNewField();
344
                refreshSpecificEpithetComboBoxListener = e -> { specificEpithetField.refresh(); specificEpithetField.setValue(null);};
345
                getView().getGenusOrUninomialField().addValueChangeListener(refreshSpecificEpithetComboBoxListener);
346
                specificEpithetField.loadFrom(specificEpithetPartPagingProvider, specificEpithetPartPagingProvider, specificEpithetPartPagingProvider.getPageSize());
347
            } else {
348
                if(specificEpithetPartPagingProvider != null){
349
                    specificEpithetPartPagingProvider.unlistenAllFields();
350
                }
351
                if(refreshSpecificEpithetComboBoxListener != null){
352
                    getView().getGenusOrUninomialField().removeValueChangeListener(refreshSpecificEpithetComboBoxListener);
353
                    refreshSpecificEpithetComboBoxListener = null;
354
                }
355
            }
356
        }
357

    
358
    }
359

    
360
    @EventBusListenerMethod
361
    public void onEntityChangeEvent(EntityChangeEvent<?> event){
362

    
363
        if(event.getSourceView() instanceof AbstractPopupEditor) {
364

    
365
            BoundField boundTargetField = boundTargetField((PopupView) event.getSourceView());
366

    
367
            if(boundTargetField != null){
368
                if(boundTargetField.matchesPropertyIdPath("nomenclaturalReference")){
369
                    if(event.isCreateOrModifiedType()){
370

    
371
                        getCache().load(event.getEntity());
372
                        if(event.isCreatedType()){
373
                            getView().getNomReferenceCombobox().setValue((Reference) event.getEntity());
374
                        } else {
375
                            getView().getNomReferenceCombobox().reload(); // refreshSelectedValue(modifiedReference);
376
                        }
377
                        getView().getCombinationAuthorshipField().discard(); //refresh from the datasource
378
                        getView().updateAuthorshipFields();
379
                    }
380
                }
381
                if(boundTargetField.matchesPropertyIdPath("validationFor.otherName")){
382
                    ReloadableLazyComboBox<TaxonName> otherNameField = (ReloadableLazyComboBox<TaxonName>)boundTargetField.getField(TaxonName.class);
383
                    if(event.isCreateOrModifiedType()){
384
                        getCache().load(event.getEntity());
385
                        if(event.isCreatedType()){
386
                            otherNameField.setValue((TaxonName) event.getEntity());
387
                        } else {
388
                            otherNameField.reload();
389
                        }
390
                    } else
391
                    if(event.isRemovedType()){
392
                        otherNameField.setValue(null);
393
                    }
394
                } else
395
                if(boundTargetField.matchesPropertyIdPath("basionyms")){
396
                    ReloadableLazyComboBox<TaxonName> basionymSourceField = (ReloadableLazyComboBox<TaxonName>)boundTargetField.getField(TaxonName.class);
397
                    if(event.isCreateOrModifiedType()){
398
                        getCache().load(event.getEntity());
399
                        if(event.isCreatedType()){
400
                            basionymSourceField .setValue((TaxonName) event.getEntity());
401
                        } else {
402
                            basionymSourceField.reload();
403
                        }
404
                        getView().getBasionymAuthorshipField().discard(); //refresh from the datasource
405
                        getView().getExBasionymAuthorshipField().discard(); //refresh from the datasource
406
                        getView().updateAuthorshipFields();
407
                    } else
408
                    if(event.isRemovedType()){
409
                        basionymSourceField.setValue(null);
410
                        getView().updateAuthorshipFields();
411
                    }
412
                }
413

    
414
            }
415
        }
416
    }
417

    
418

    
419

    
420
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
421
    public void onTaxonNameEditorActionEdit(TaxonNameEditorAction event) {
422

    
423
        if(getView() == null || event.getSourceView() != getView() ){
424
            return;
425
        }
426

    
427
        PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
428

    
429
        if(boundPropertyId != null){
430
            if(boundPropertyId.matches("validationFor.otherName") || boundPropertyId.matches("basionyms") || boundPropertyId.matches("replacedSynonyms")){
431
                TaxonNamePopupEditor validatedNamePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
432
                validatedNamePopup.withDeleteButton(true);
433
                getView().getModesActive().stream()
434
                    .filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
435
                    .forEach(m -> validatedNamePopup.enableMode(m));
436
                validatedNamePopup.loadInEditor(event.getEntityUuid());
437
            }
438
        }
439

    
440
    }
441

    
442
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
443
    public void onTaxonNameEditorActionAdd(TaxonNameEditorAction event) {
444

    
445
        if(getView() == null || event.getSourceView() != getView() ){
446
            return;
447
        }
448

    
449
        PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
450

    
451
        if(boundPropertyId != null){
452
            if(boundPropertyId.matches("validationFor.otherName") || boundPropertyId.matches("basionyms") || boundPropertyId.matches("replacedSynonyms")){
453
                TaxonNamePopupEditor validatedNamePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
454
                validatedNamePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
455
                validatedNamePopup.withDeleteButton(true);
456
                getView().getModesActive().stream()
457
                        .filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
458
                        .forEach(m -> validatedNamePopup.enableMode(m));
459
                validatedNamePopup.loadInEditor(null);
460
            }
461
        }
462
    }
463

    
464
    /**
465
     * {@inheritDoc}
466
     */
467
    @Override
468
    protected TaxonNameDTO createDTODecorator(TaxonName cdmEntitiy) {
469
        return new TaxonNameDTO(cdmEntitiy);
470
    }
471

    
472

    
473

    
474

    
475
}
(9-9/13)