Project

General

Profile

Download (24 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.registration;
10

    
11
import static eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles.LABEL_NOWRAP;
12

    
13
import java.util.ArrayList;
14
import java.util.Collection;
15
import java.util.Collections;
16
import java.util.EnumSet;
17
import java.util.HashMap;
18
import java.util.Iterator;
19
import java.util.List;
20
import java.util.Map;
21
import java.util.Set;
22
import java.util.Stack;
23
import java.util.UUID;
24

    
25
import org.springframework.security.core.GrantedAuthority;
26
import org.vaadin.viritin.fields.LazyComboBox;
27

    
28
import com.vaadin.navigator.View;
29
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
30
import com.vaadin.server.FontAwesome;
31
import com.vaadin.server.Page;
32
import com.vaadin.shared.ui.label.ContentMode;
33
import com.vaadin.spring.annotation.SpringView;
34
import com.vaadin.ui.Alignment;
35
import com.vaadin.ui.Button;
36
import com.vaadin.ui.Component;
37
import com.vaadin.ui.CssLayout;
38
import com.vaadin.ui.GridLayout;
39
import com.vaadin.ui.HorizontalLayout;
40
import com.vaadin.ui.Label;
41
import com.vaadin.ui.Notification;
42
import com.vaadin.ui.Panel;
43
import com.vaadin.ui.UI;
44
import com.vaadin.ui.VerticalLayout;
45
import com.vaadin.ui.Window;
46
import com.vaadin.ui.themes.ValoTheme;
47

    
48
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
49
import eu.etaxonomy.cdm.api.service.dto.RegistrationType;
50
import eu.etaxonomy.cdm.api.service.dto.RegistrationWorkingSet;
51
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.TypeDesignationWorkingSetType;
52
import eu.etaxonomy.cdm.api.utility.RoleProber;
53
import eu.etaxonomy.cdm.model.name.Registration;
54
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
55
import eu.etaxonomy.cdm.model.name.TaxonName;
56
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
57
import eu.etaxonomy.cdm.ref.EntityReference;
58
import eu.etaxonomy.cdm.ref.TypedEntityReference;
59
import eu.etaxonomy.cdm.service.UserHelperAccess;
60
import eu.etaxonomy.cdm.vaadin.component.BadgeButton;
61
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem;
62
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemButtons;
63
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTypeButtons;
64
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTypeButtons.TypeDesignationWorkingSetButton;
65
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemsPanel;
66
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusFieldInstantiator;
67
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusLabel;
68
import eu.etaxonomy.cdm.vaadin.event.EditorActionContext;
69
import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction;
70
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
71
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
72
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction;
73
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction;
74
import eu.etaxonomy.cdm.vaadin.permission.AccessRestrictedView;
75
import eu.etaxonomy.cdm.vaadin.permission.PermissionDebugUtils;
76
import eu.etaxonomy.cdm.vaadin.permission.RolesAndPermissions;
77
import eu.etaxonomy.cdm.vaadin.theme.EditValoTheme;
78
import eu.etaxonomy.cdm.vaadin.view.AbstractPageView;
79
import eu.etaxonomy.vaadin.event.EditorActionType;
80

    
81
/**
82
 * @author a.kohlbecker
83
 * @since Mar 2, 2017
84
 *
85
 */
86
@SpringView(name=RegistrationWorksetViewBean.NAME)
87
public class RegistrationWorksetViewBean extends AbstractPageView<RegistrationWorkingsetPresenter>
88
    implements RegistrationWorkingsetView, View, AccessRestrictedView {
89

    
90

    
91
    private static final int COL_INDEX_STATE_LABEL = 0;
92

    
93
    private static final int COL_INDEX_REG_ITEM = 1;
94

    
95
    private static final int COL_INDEX_BUTTON_GROUP = 2;
96

    
97
    public static final String DOM_ID_WORKINGSET = "workingset";
98

    
99
    public static final String TEXT_NAME_TYPIFICATION = "covering the name and typifications";
100
    public static final String TEXT_TYPIFICATION_ONLY = "covering typifications only";
101

    
102
    private static final long serialVersionUID = -213040114015958970L;
103

    
104
    public static final String NAME = "workingset";
105

    
106
    public RegistrationType regType = null;
107

    
108
    private List<CssLayout> registrations = new ArrayList<>();
109

    
110
    private String headerText = "Registration Workingset Editor";
111
    private String subheaderText = "";
112

    
113
    private UUID citationUuid;
114

    
115
    private Button addNewNameRegistrationButton;
116

    
117
    private LazyComboBox<TaxonName> existingNameCombobox;
118

    
119
    private GridLayout registrationsGrid;
120

    
121
    private Button addExistingNameButton;
122

    
123
    private Label existingNameRegistrationTypeLabel;
124

    
125
    private RegistrationItem workingsetHeader;
126

    
127
    private Panel registrationListPanel;
128

    
129
    /**
130
     * uses the registrationId as key
131
     */
132
    private Map<UUID, RegistrationDetailsItem> registrationItemMap = new HashMap<>();
133

    
134
    /**
135
     * uses the registrationId as key
136
     */
137
    private Map<UUID, EntityReference> typifiedNamesMap = new HashMap<>();
138

    
139
    private RegistrationStatusFieldInstantiator statusFieldInstantiator;
140

    
141
    private String accessDeniedMessage;
142

    
143
    public RegistrationWorksetViewBean() {
144
        super();
145
    }
146

    
147

    
148
    /**
149
     * {@inheritDoc}
150
     */
151
    @Override
152
    protected void initContent() {
153
        getLayout().setId(NAME);
154
        updateHeader();
155
        // all content is added in createRegistrationsList()
156
    }
157

    
158

    
159
    /**
160
     * {@inheritDoc}
161
     */
162
    @Override
163
    public void enter(ViewChangeEvent event) {
164
        if(event.getParameters() != null){
165
            this.citationUuid = UUID.fromString(event.getParameters());
166

    
167
            getPresenter().handleViewEntered();
168
        }
169
    }
170

    
171
    /**
172
     * {@inheritDoc}
173
     */
174
    @Override
175
    public void setWorkingset(RegistrationWorkingSet workingset) {
176

    
177
        if(workingsetHeader != null){
178
            getLayout().removeComponent(workingsetHeader);
179
            getLayout().removeComponent(registrationListPanel);
180
        }
181
        workingsetHeader = new RegistrationItem(workingset, this, getPresenter().getCache());
182
        addContentComponent(workingsetHeader, null);
183

    
184
        registrationListPanel = createRegistrationsList(workingset);
185
        registrationListPanel.setHeight("100%");
186
        registrationListPanel.setStyleName("registration-list");
187
        registrationListPanel.setCaption("Registrations");
188
        addContentComponent(registrationListPanel, 1.0f);
189

    
190
    }
191

    
192
    @Override
193
    public void setBlockingRegistrations(UUID registrationUuid, Set<RegistrationDTO> blockingRegDTOs) {
194

    
195
        RegistrationDetailsItem regItem = registrationItemMap.get(registrationUuid);
196

    
197
        boolean blockingRegAdded = false;
198
        for(Iterator it = regItem.itemFooter.iterator(); it.hasNext(); ){
199
            if(it.next() instanceof RegistrationItemsPanel){
200
                blockingRegAdded = true;
201
                break;
202
            }
203
        }
204
        if(!blockingRegAdded){
205
            regItem.itemFooter.addComponent(new RegistrationItemsPanel(this, "Blocked by", blockingRegDTOs, getPresenter().getCache()));
206
        }
207
    }
208

    
209
    /**
210
     * {@inheritDoc}
211
     */
212
    @Override
213
    @Deprecated // no longer needed
214
    public void addBlockingRegistration(RegistrationDTO blocking) {
215
        if(registrations == null) {
216
            throw new RuntimeException("A Workingset must be present prior adding blocking registrations.");
217
        }
218
        // add the blocking registration
219

    
220
    }
221

    
222
    /**
223
     * @param workingset
224
     * @return
225
     */
226
    public Panel createRegistrationsList(RegistrationWorkingSet workingset) {
227

    
228
        registrationsGrid = new GridLayout(3, 1);
229
        registrationsGrid.setWidth("100%");
230
        // allow vertical scrolling:
231
        registrationsGrid.setHeightUndefined();
232

    
233
        //registrationsGrid.setColumnExpandRatio(0, 0.1f);
234
        registrationsGrid.setColumnExpandRatio(1, 1f);
235

    
236
        registrationItemMap.clear();
237
        registrationsGrid.setRows(workingset.getRegistrationDTOs().size() * 2  + 3);
238
        int row = 0;
239
        for(RegistrationDTO dto : workingset.getRegistrationDTOs()) {
240
            row = putRegistrationListComponent(row, dto);
241
        }
242

    
243
        // --- Footer with UI to create new registrations ----
244
        Label addRegistrationLabel_1 = new Label("Add a new registration for a");
245
        Label addRegistrationLabel_2 = new Label("or an");
246

    
247
        addNewNameRegistrationButton = new Button("new name");
248
        addNewNameRegistrationButton.setDescription("A name which is newly published in this publication.");
249
        Stack<EditorActionContext> context = new Stack<EditorActionContext>();
250
        context.push(new EditorActionContext(
251
                    new TypedEntityReference<>(Registration.class, null),
252
                    this)
253
                    );
254
        addNewNameRegistrationButton.addClickListener(
255
                e -> {
256
                    getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this, context));
257

    
258
                }
259
        );
260

    
261
        existingNameRegistrationTypeLabel = new Label();
262
        addExistingNameButton = new Button("existing name:");
263
        addExistingNameButton.setEnabled(false);
264
        addExistingNameButton.addClickListener(
265
                e -> getViewEventBus().publish(this, new RegistrationWorkingsetAction(
266
                        citationUuid,
267
                        RegistrationWorkingsetAction.Action.start
268
                )
269
             )
270
        );
271

    
272
        existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class);
273
        existingNameCombobox.addValueChangeListener(
274
                e -> {
275
                    boolean selectionNotEmpty = e.getProperty().getValue() != null;
276
                    addExistingNameButton.setEnabled(false);
277
                    existingNameRegistrationTypeLabel.setValue(null);
278
                    if(selectionNotEmpty){
279
                        TaxonName name = (TaxonName)e.getProperty().getValue();
280
                        if(getPresenter().canCreateNameRegistrationFor(name)){
281
                            existingNameRegistrationTypeLabel.setValue(TEXT_NAME_TYPIFICATION);
282
                            addExistingNameButton.setEnabled(true);
283
                        } else {
284
                            if(!getPresenter().checkWokingsetContainsProtologe(name)){
285
                                existingNameRegistrationTypeLabel.setValue(TEXT_TYPIFICATION_ONLY);
286
                                addExistingNameButton.setEnabled(true);
287
                            }
288
                        }
289
                    } else {
290
                        existingNameRegistrationTypeLabel.setValue(null);
291
                    }
292
                }
293
                );
294

    
295
        HorizontalLayout buttonContainer = new HorizontalLayout(
296
                addRegistrationLabel_1,
297
                addNewNameRegistrationButton,
298
                addRegistrationLabel_2,
299
                addExistingNameButton,
300
                existingNameCombobox,
301
                existingNameRegistrationTypeLabel
302
                );
303
        buttonContainer.setSpacing(true);
304
//        buttonContainer.setWidth(100, Unit.PERCENTAGE);
305
        buttonContainer.setComponentAlignment(addRegistrationLabel_1, Alignment.MIDDLE_LEFT);
306
        buttonContainer.setComponentAlignment(addRegistrationLabel_2, Alignment.MIDDLE_LEFT);
307

    
308
        row++;
309
        registrationsGrid.addComponent(buttonContainer, 0, row, COL_INDEX_BUTTON_GROUP, row);
310
        registrationsGrid.setComponentAlignment(buttonContainer, Alignment.MIDDLE_RIGHT);
311

    
312
        row++;
313
        Label hint = new Label(
314
                "For most names that already exist in the system, it is only possible to create a registration covering type designations. "
315
                + "In all other cases please choose <a href=\"registration#!regStart\">\"New\"</a> from the main menu and start a registration for the nomenclatural reference of the name to be registered.",
316
                ContentMode.HTML);
317
        registrationsGrid.addComponent(hint, 0, row, COL_INDEX_BUTTON_GROUP, row);
318
        registrationsGrid.setComponentAlignment(hint, Alignment.MIDDLE_RIGHT);
319

    
320
        Panel namesTypesPanel = new Panel(registrationsGrid);
321
        namesTypesPanel.setStyleName(EditValoTheme.PANEL_CONTENT_PADDING_LEFT);
322
        return namesTypesPanel;
323
    }
324

    
325

    
326
    protected int putRegistrationListComponent(int row, RegistrationDTO dto) {
327

    
328
        EntityReference typifiedNameReference = dto.getTypifiedNameRef();
329
        if(typifiedNameReference == null){
330
            typifiedNameReference = dto.getNameRef();
331
        }
332
        typifiedNamesMap.put(dto.getUuid(), typifiedNameReference);
333

    
334
        RegistrationItemNameAndTypeButtons regItemButtonGroup = new RegistrationItemNameAndTypeButtons(dto, getPresenter().getCache());
335
        UUID registrationEntityUuid = dto.getUuid();
336

    
337
        RegistrationItemButtons regItemButtons = new RegistrationItemButtons();
338

    
339
        CssLayout footer = new CssLayout();
340
        footer.setWidth(100, Unit.PERCENTAGE);
341
        footer.setStyleName("item-footer");
342

    
343
        RegistrationDetailsItem regDetailsItem = new RegistrationDetailsItem(regItemButtonGroup, regItemButtons, footer);
344
        registrationItemMap.put(registrationEntityUuid, regDetailsItem);
345

    
346
        Stack<EditorActionContext> context = new Stack<EditorActionContext>();
347
        context.push(new EditorActionContext(
348
                    new TypedEntityReference<>(Registration.class, registrationEntityUuid),
349
                    this)
350
                    );
351

    
352
        if(regItemButtonGroup.getNameButton() != null){
353
            regItemButtonGroup.getNameButton().getButton().addClickListener(e -> {
354
                UUID nameuUuid = regItemButtonGroup.getNameButton().getUuid();
355
                getViewEventBus().publish(this, new TaxonNameEditorAction(
356
                    EditorActionType.EDIT,
357
                    nameuUuid,
358
                    e.getButton(),
359
                    null,
360
                    this,
361
                    context
362
                    )
363
                );
364
            });
365
        }
366

    
367
        for(TypeDesignationWorkingSetButton workingsetButton : regItemButtonGroup.getTypeDesignationButtons()){
368
            workingsetButton.getButton().addClickListener(e -> {
369
                TypedEntityReference baseEntityRef = workingsetButton.getBaseEntity();
370
                EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
371
                TypeDesignationWorkingSetType workingsetType = workingsetButton.getType();
372
                getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
373
                        baseEntityRef,
374
                        workingsetType,
375
                        registrationEntityUuid,
376
                        typifiedNameRef.getUuid(),
377
                        e.getButton(),
378
                        null,
379
                        this,
380
                        context
381
                        )
382
                    );
383
            });
384
        }
385

    
386
        regItemButtonGroup.getAddTypeDesignationButton().addClickListener(
387
                e -> chooseNewTypeRegistrationWorkingset(dto.getUuid())
388
                );
389

    
390

    
391
        Button blockingRegistrationButton = regItemButtons.getBlockingRegistrationButton();
392
        blockingRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
393
        blockingRegistrationButton.setDescription("No blocking registrations");
394
        if(dto.isBlocked()){
395
            blockingRegistrationButton.setEnabled(true);
396
            blockingRegistrationButton.setDescription("This registration is currently blocked by other registrations");
397
            blockingRegistrationButton.addStyleName(EditValoTheme.BUTTON_HIGHLITE);
398
            blockingRegistrationButton.addClickListener(e -> getViewEventBus().publish(
399
                    this,
400
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
401
                            e,
402
                            RegistrationDTO.class,
403
                            dto.getUuid(),
404
                            RegistrationItem.BLOCKED_BY
405
                            )
406
                    ));
407
        }
408

    
409
        BadgeButton validationProblemsButton = regItemButtons.getValidationProblemsButton();
410
        validationProblemsButton.setStyleName(ValoTheme.BUTTON_TINY); //  + " " + RegistrationStyles.STYLE_FRIENDLY_FOREGROUND);
411

    
412
        if(!dto.getValidationProblems().isEmpty()){
413
            validationProblemsButton.setEnabled(true);
414
            validationProblemsButton.addClickListener(e -> getViewEventBus().publish(this,
415
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
416
                        e,
417
                        RegistrationDTO.class,
418
                        dto.getUuid(),
419
                        RegistrationItem.VALIDATION_PROBLEMS
420
                        )
421
                    )
422
                );
423
        }
424
        int problemCount = dto.getValidationProblems().size();
425
        validationProblemsButton.setCaption(problemCount > 0 ? Integer.toString(problemCount) : null);
426

    
427
        Component statusComponent;
428
        if(statusFieldInstantiator != null){
429
            statusComponent = statusFieldInstantiator.create(dto);
430
        } else {
431
            statusComponent = new RegistrationStatusLabel().update(dto.getStatus());
432
        }
433
        Label submitterLabel = new Label(dto.getSubmitterUserName());
434
        submitterLabel.setStyleName(LABEL_NOWRAP + " submitter");
435
        submitterLabel.setIcon(FontAwesome.USER);
436
        submitterLabel.setContentMode(ContentMode.HTML);
437
        CssLayout stateAndSubmitter = new CssLayout(statusComponent, submitterLabel);
438

    
439

    
440
        if(UserHelperAccess.userHelper().userIs(new RoleProber(RolesAndPermissions.ROLE_CURATION)) || UserHelperAccess.userHelper().userIsAdmin()) {
441
            Button editRegistrationButton = new Button(FontAwesome.COG);
442
            editRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
443
            editRegistrationButton.setDescription("Edit registration");
444
            editRegistrationButton.addClickListener(e -> getViewEventBus().publish(this, new RegistrationEditorAction(
445
                EditorActionType.EDIT,
446
                dto.getUuid(),
447
                e.getButton(),
448
                null,
449
                this
450
                )));
451
            regItemButtons.addComponent(editRegistrationButton);
452
        }
453

    
454
        PermissionDebugUtils.addGainPerEntityPermissionButton(regItemButtons, Registration.class, dto.getUuid(),
455
                EnumSet.of(CRUD.UPDATE), RegistrationStatus.PREPARATION.name());
456

    
457
        row++;
458
        registrationsGrid.addComponent(stateAndSubmitter, COL_INDEX_STATE_LABEL, row);
459
        // registrationsGrid.setComponentAlignment(stateLabel, Alignment.TOP_LEFT);
460
        registrationsGrid.addComponent(regItemButtonGroup, COL_INDEX_REG_ITEM, row);
461
        registrationsGrid.addComponent(regItemButtons, COL_INDEX_BUTTON_GROUP, row);
462
        registrationsGrid.setComponentAlignment(regItemButtons, Alignment.TOP_LEFT);
463

    
464
        row++;
465
        registrationsGrid.addComponent(footer, 0, row, COL_INDEX_BUTTON_GROUP, row);
466

    
467
        return row;
468
    }
469

    
470
    /**
471
     * @param button
472
     * @param registrationEntityId
473
     *
474
     */
475
    @Override
476
    public void chooseNewTypeRegistrationWorkingset(UUID registrationEntityUuid){
477
        Window typeDesignationTypeCooser = new Window();
478
        typeDesignationTypeCooser.setModal(true);
479
        typeDesignationTypeCooser.setResizable(false);
480
        typeDesignationTypeCooser.setCaption("Add new type designation");
481
        Label label = new Label("Please select kind of type designation to be created.");
482
        Button newSpecimenTypeDesignationButton = new Button("Specimen type designation",
483
                e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.SPECIMEN_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
484
        Button newNameTypeDesignationButton = new Button("Name type designation",
485
                e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.NAME_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
486

    
487
        VerticalLayout layout = new VerticalLayout(label, newSpecimenTypeDesignationButton, newNameTypeDesignationButton);
488
        layout.setMargin(true);
489
        layout.setSpacing(true);
490
        layout.setComponentAlignment(newSpecimenTypeDesignationButton, Alignment.MIDDLE_CENTER);
491
        layout.setComponentAlignment(newNameTypeDesignationButton, Alignment.MIDDLE_CENTER);
492
        typeDesignationTypeCooser.setContent(layout);
493
        UI.getCurrent().addWindow(typeDesignationTypeCooser);
494
    }
495

    
496
    /**
497
     * @param button
498
     *
499
     */
500
    protected void addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType newWorkingsetType, UUID registrationEntityUuid, Window typeDesignationTypeCooser, Button sourceButton) {
501
        UI.getCurrent().removeWindow(typeDesignationTypeCooser);
502
        EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
503
        getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
504
                newWorkingsetType,
505
                registrationEntityUuid,
506
                typifiedNameRef.getUuid(),
507
                sourceButton,
508
                null,
509
                this
510
                ));
511
    }
512

    
513
    /**
514
     * {@inheritDoc}
515
     */
516
    @Override
517
    public void openReferenceEditor(UUID referenceUuid) {
518
        // TODO Auto-generated method stub
519

    
520
    }
521

    
522
    /**
523
     * {@inheritDoc}
524
     */
525
    @Override
526
    public void openNameEditor(UUID nameUuid) {
527
        // TODO Auto-generated method stub
528

    
529
    }
530

    
531
    /**
532
     * {@inheritDoc}
533
     */
534
    @Override
535
    protected String getHeaderText() {
536
        return headerText;
537
    }
538

    
539
    /**
540
     * {@inheritDoc}
541
     */
542
    @Override
543
    public void setHeaderText(String text) {
544
        this.headerText = text;
545
        updateHeader();
546

    
547
    }
548

    
549
    /**
550
     * @return the subheaderText
551
     */
552
    public String getSubheaderText() {
553
        return subheaderText;
554
    }
555

    
556
    /**
557
     * {@inheritDoc}
558
     */
559
    @Override
560
    public void setSubheaderText(String text) {
561
        subheaderText = text;
562
        updateHeader();
563
    }
564

    
565
    /**
566
     * {@inheritDoc}
567
     */
568
    @Override
569
    protected String getSubHeaderText() {
570
        return subheaderText;
571
    }
572

    
573
    /**
574
     * {@inheritDoc}
575
     */
576
    @Override
577
    public void openDetailsPopup(String caption, List<String> messages) {
578
        StringBuffer sb = new StringBuffer();
579
        sb.append("<div class=\"details-popup-content\">");
580
        messages.forEach(s -> sb.append(s).append("</br>"));
581
        sb.append("</div>");
582
        new Notification(caption, sb.toString(), Notification.Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
583
    }
584

    
585
    @Override
586
    public boolean allowAnonymousAccess() {
587
        return false;
588
    }
589

    
590
    @Override
591
    public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
592
        return null;
593
    }
594

    
595
    @Override
596
    public String getAccessDeniedMessage() {
597
        return accessDeniedMessage;
598
    }
599

    
600
    @Override
601
    public void setAccessDeniedMessage(String accessDeniedMessage) {
602
        this.accessDeniedMessage = accessDeniedMessage;
603
    }
604

    
605
    /**
606
     * @return the addNewNameRegistrationButton
607
     */
608
    @Override
609
    public Button getAddNewNameRegistrationButton() {
610
        return addNewNameRegistrationButton;
611
    }
612

    
613
    @Override
614
    public Button getAddExistingNameRegistrationButton() {
615
        return addExistingNameButton;
616
    }
617

    
618
    @Override
619
    public LazyComboBox<TaxonName> getAddExistingNameCombobox() {
620
        return existingNameCombobox;
621
    }
622

    
623
    /**
624
     * @return the citationID
625
     */
626
    @Override
627
    public UUID getCitationUuid() {
628
        return citationUuid;
629
    }
630

    
631
    @Override
632
    public Map<UUID, RegistrationDetailsItem> getRegistrationItemMap(){
633
        return Collections.unmodifiableMap(registrationItemMap);
634
    }
635

    
636

    
637
    /**
638
     * @param statusFieldInstantiator the statusFieldInstantiator to set
639
     */
640
    @Override
641
    public void setStatusComponentInstantiator(RegistrationStatusFieldInstantiator statusComponentInstantiator) {
642
        this.statusFieldInstantiator = statusComponentInstantiator;
643
    }
644

    
645

    
646
}
(12-12/18)