Project

General

Profile

Download (24.1 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.AbstractField;
35
import com.vaadin.ui.Alignment;
36
import com.vaadin.ui.Button;
37
import com.vaadin.ui.Component;
38
import com.vaadin.ui.CssLayout;
39
import com.vaadin.ui.GridLayout;
40
import com.vaadin.ui.HorizontalLayout;
41
import com.vaadin.ui.Label;
42
import com.vaadin.ui.Notification;
43
import com.vaadin.ui.Panel;
44
import com.vaadin.ui.UI;
45
import com.vaadin.ui.VerticalLayout;
46
import com.vaadin.ui.Window;
47
import com.vaadin.ui.themes.ValoTheme;
48

    
49
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
50
import eu.etaxonomy.cdm.api.service.dto.RegistrationType;
51
import eu.etaxonomy.cdm.api.service.dto.RegistrationWorkingSet;
52
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.TypeDesignationWorkingSetType;
53
import eu.etaxonomy.cdm.api.utility.RoleProber;
54
import eu.etaxonomy.cdm.model.name.Registration;
55
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
56
import eu.etaxonomy.cdm.model.name.TaxonName;
57
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
58
import eu.etaxonomy.cdm.ref.EntityReference;
59
import eu.etaxonomy.cdm.ref.TypedEntityReference;
60
import eu.etaxonomy.cdm.service.UserHelperAccess;
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.component.registration.RegistrationStyles;
69
import eu.etaxonomy.cdm.vaadin.event.AbstractEditorAction.EditorActionContext;
70
import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction;
71
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
72
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
73
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction;
74
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction;
75
import eu.etaxonomy.cdm.vaadin.permission.AccessRestrictedView;
76
import eu.etaxonomy.cdm.vaadin.permission.PermissionDebugUtils;
77
import eu.etaxonomy.cdm.vaadin.permission.RolesAndPermissions;
78
import eu.etaxonomy.cdm.vaadin.theme.EditValoTheme;
79
import eu.etaxonomy.cdm.vaadin.view.AbstractPageView;
80
import eu.etaxonomy.vaadin.event.EditorActionType;
81

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

    
91

    
92
    private static final int COL_INDEX_STATE_LABEL = 0;
93

    
94
    private static final int COL_INDEX_REG_ITEM = 1;
95

    
96
    private static final int COL_INDEX_BUTTON_GROUP = 2;
97

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

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

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

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

    
107
    public RegistrationType regType = null;
108

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

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

    
114
    private UUID citationUuid;
115

    
116
    private Button addNewNameRegistrationButton;
117

    
118
    private LazyComboBox<TaxonName> existingNameCombobox;
119

    
120
    private GridLayout registrationsGrid;
121

    
122
    private Button addExistingNameButton;
123

    
124
    private Label existingNameRegistrationTypeLabel;
125

    
126
    private RegistrationItem workingsetHeader;
127

    
128
    private Panel registrationListPanel;
129

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

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

    
140
    private RegistrationStatusFieldInstantiator statusFieldInstantiator;
141

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

    
146

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

    
157

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

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

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

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

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

    
189
    }
190

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

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

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

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

    
219
    }
220

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

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

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

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

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

    
246
        addNewNameRegistrationButton = new Button("new name");
247
        addNewNameRegistrationButton.setDescription("A name which is newly published in this publication.");
248
        addNewNameRegistrationButton.addClickListener(
249
                e -> getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this)));
250

    
251
        existingNameRegistrationTypeLabel = new Label();
252
        addExistingNameButton = new Button("existing name:");
253
        addExistingNameButton.setEnabled(false);
254
        addExistingNameButton.addClickListener(
255
                e -> getViewEventBus().publish(this, new RegistrationWorkingsetAction(
256
                        citationUuid,
257
                        RegistrationWorkingsetAction.Action.start
258
                )
259
             )
260
                );
261

    
262
        existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class);
263
        existingNameCombobox.addValueChangeListener(
264
                e -> {
265
                    boolean selectionNotEmpty = e.getProperty().getValue() != null;
266
                    addExistingNameButton.setEnabled(false);
267
                    existingNameRegistrationTypeLabel.setValue(null);
268
                    if(selectionNotEmpty){
269
                        TaxonName name = (TaxonName)e.getProperty().getValue();
270
                        if(getPresenter().canCreateNameRegistrationFor(name)){
271
                            existingNameRegistrationTypeLabel.setValue(TEXT_NAME_TYPIFICATION);
272
                            addExistingNameButton.setEnabled(true);
273
                        } else {
274
                            if(!getPresenter().checkWokingsetContainsProtologe(name)){
275
                                existingNameRegistrationTypeLabel.setValue(TEXT_TYPIFICATION_ONLY);
276
                                addExistingNameButton.setEnabled(true);
277
                            }
278
                        }
279
                    } else {
280
                        existingNameRegistrationTypeLabel.setValue(null);
281
                    }
282
                }
283
                );
284

    
285
        HorizontalLayout buttonContainer = new HorizontalLayout(
286
                addRegistrationLabel_1,
287
                addNewNameRegistrationButton,
288
                addRegistrationLabel_2,
289
                addExistingNameButton,
290
                existingNameCombobox,
291
                existingNameRegistrationTypeLabel
292
                );
293
        buttonContainer.setSpacing(true);
294
//        buttonContainer.setWidth(100, Unit.PERCENTAGE);
295
        buttonContainer.setComponentAlignment(addRegistrationLabel_1, Alignment.MIDDLE_LEFT);
296
        buttonContainer.setComponentAlignment(addRegistrationLabel_2, Alignment.MIDDLE_LEFT);
297

    
298
        row++;
299
        registrationsGrid.addComponent(buttonContainer, 0, row, COL_INDEX_BUTTON_GROUP, row);
300
        registrationsGrid.setComponentAlignment(buttonContainer, Alignment.MIDDLE_RIGHT);
301

    
302
        row++;
303
        Label hint = new Label(
304
                "For most names that already exist in the system, it is only possible to create a registration covering type designations. "
305
                + "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.",
306
                ContentMode.HTML);
307
        registrationsGrid.addComponent(hint, 0, row, COL_INDEX_BUTTON_GROUP, row);
308
        registrationsGrid.setComponentAlignment(hint, Alignment.MIDDLE_RIGHT);
309

    
310
        Panel namesTypesPanel = new Panel(registrationsGrid);
311
        namesTypesPanel.setStyleName(EditValoTheme.PANEL_CONTENT_PADDING_LEFT);
312
        return namesTypesPanel;
313
    }
314

    
315

    
316
    protected int putRegistrationListComponent(int row, RegistrationDTO dto) {
317

    
318
        EntityReference typifiedNameReference = dto.getTypifiedNameRef();
319
        if(typifiedNameReference == null){
320
            typifiedNameReference = dto.getNameRef();
321
        }
322
        typifiedNamesMap.put(dto.getUuid(), typifiedNameReference);
323

    
324
        RegistrationItemNameAndTypeButtons regItemButtonGroup = new RegistrationItemNameAndTypeButtons(dto);
325
        UUID registrationEntityUuid = dto.getUuid();
326

    
327
        RegistrationItemButtons regItemButtons = new RegistrationItemButtons();
328

    
329
        CssLayout footer = new CssLayout();
330
        footer.setWidth(100, Unit.PERCENTAGE);
331
        footer.setStyleName("item-footer");
332

    
333
        RegistrationDetailsItem regDetailsItem = new RegistrationDetailsItem(regItemButtonGroup, regItemButtons, footer);
334
        registrationItemMap.put(registrationEntityUuid, regDetailsItem);
335

    
336
        Stack<EditorActionContext> context = new Stack<EditorActionContext>();
337
        context.push(new EditorActionContext(
338
                    new TypedEntityReference<>(Registration.class, registrationEntityUuid),
339
                    this)
340
                    );
341

    
342
        if(regItemButtonGroup.getNameButton() != null){
343
            regItemButtonGroup.getNameButton().getButton().addClickListener(e -> {
344
                UUID nameuUuid = regItemButtonGroup.getNameButton().getUuid();
345
                getViewEventBus().publish(this, new TaxonNameEditorAction(
346
                    EditorActionType.EDIT,
347
                    nameuUuid,
348
                    e.getButton(),
349
                    null,
350
                    this,
351
                    context
352
                    )
353
                );
354
            });
355
        }
356

    
357
        for(TypeDesignationWorkingSetButton workingsetButton : regItemButtonGroup.getTypeDesignationButtons()){
358
            workingsetButton.getButton().addClickListener(e -> {
359
                TypedEntityReference baseEntityRef = workingsetButton.getBaseEntity();
360
                EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
361
                TypeDesignationWorkingSetType workingsetType = workingsetButton.getType();
362
                getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
363
                        baseEntityRef,
364
                        workingsetType,
365
                        registrationEntityUuid,
366
                        typifiedNameRef.getUuid(),
367
                        e.getButton(),
368
                        null,
369
                        this,
370
                        context
371
                        )
372
                    );
373
            });
374
        }
375

    
376
        regItemButtonGroup.getAddTypeDesignationButton().addClickListener(
377
                e -> chooseNewTypeRegistrationWorkingset(dto.getUuid())
378
                );
379

    
380

    
381
        Button blockingRegistrationButton = regItemButtons.getBlockingRegistrationButton();
382
        blockingRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
383
        blockingRegistrationButton.setDescription("No blocking registrations");
384
        if(dto.isBlocked()){
385
            blockingRegistrationButton.setEnabled(true);
386
            blockingRegistrationButton.setDescription("This registration is currently blocked by other registrations");
387
            blockingRegistrationButton.addStyleName(EditValoTheme.BUTTON_HIGHLITE);
388
            blockingRegistrationButton.addClickListener(e -> getViewEventBus().publish(
389
                    this,
390
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
391
                            e,
392
                            RegistrationDTO.class,
393
                            dto.getUuid(),
394
                            RegistrationItem.BLOCKED_BY
395
                            )
396
                    ));
397
        }
398

    
399
        Button validationProblemsButton = regItemButtons.getValidationProblemsButton();
400
        validationProblemsButton.setStyleName(ValoTheme.BUTTON_TINY); //  + " " + RegistrationStyles.STYLE_FRIENDLY_FOREGROUND);
401

    
402
        if(!dto.getValidationProblems().isEmpty()){
403
            validationProblemsButton.setEnabled(true);
404
            validationProblemsButton.addClickListener(e -> getViewEventBus().publish(this,
405
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
406
                        e,
407
                        RegistrationDTO.class,
408
                        dto.getUuid(),
409
                        RegistrationItem.VALIDATION_PROBLEMS
410
                        )
411
                    )
412
                );
413
        }
414
        validationProblemsButton.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + dto.getValidationProblems().size() + "</span>");
415
        validationProblemsButton.setCaptionAsHtml(true);
416

    
417
        Button messageButton = regItemButtons.getMessagesButton();
418
        messageButton.addClickListener(e -> getViewEventBus().publish(this,
419
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
420
                        e,
421
                        RegistrationDTO.class,
422
                        dto.getUuid(),
423
                        RegistrationItem.MESSAGES
424
                        )
425
                    )
426
                );
427
        messageButton.setStyleName(ValoTheme.BUTTON_TINY);
428

    
429
        Component statusComponent;
430
        if(statusFieldInstantiator != null){
431
            AbstractField<Object> statusField = statusFieldInstantiator.create(dto);
432
            statusField.setValue(dto.getStatus());
433
            statusComponent = statusField;
434
        } else {
435
            statusComponent = new RegistrationStatusLabel().update(dto.getStatus());
436
        }
437
        Label submitterLabel = new Label(dto.getSubmitterUserName());
438
        submitterLabel.setStyleName(LABEL_NOWRAP + " submitter");
439
        submitterLabel.setIcon(FontAwesome.USER);
440
        submitterLabel.setContentMode(ContentMode.HTML);
441
        CssLayout stateAndSubmitter = new CssLayout(statusComponent, submitterLabel);
442

    
443

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

    
458
        PermissionDebugUtils.addGainPerEntityPermissionButton(regItemButtons, Registration.class, dto.getUuid(),
459
                EnumSet.of(CRUD.UPDATE), RegistrationStatus.PREPARATION.name());
460

    
461
        row++;
462
        registrationsGrid.addComponent(stateAndSubmitter, COL_INDEX_STATE_LABEL, row);
463
        // registrationsGrid.setComponentAlignment(stateLabel, Alignment.TOP_LEFT);
464
        registrationsGrid.addComponent(regItemButtonGroup, COL_INDEX_REG_ITEM, row);
465
        registrationsGrid.addComponent(regItemButtons, COL_INDEX_BUTTON_GROUP, row);
466
        registrationsGrid.setComponentAlignment(regItemButtons, Alignment.TOP_LEFT);
467

    
468
        row++;
469
        registrationsGrid.addComponent(footer, 0, row, COL_INDEX_BUTTON_GROUP, row);
470

    
471
        return row;
472
    }
473

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

    
491
        VerticalLayout layout = new VerticalLayout(label, newSpecimenTypeDesignationButton, newNameTypeDesignationButton);
492
        layout.setMargin(true);
493
        layout.setSpacing(true);
494
        layout.setComponentAlignment(newSpecimenTypeDesignationButton, Alignment.MIDDLE_CENTER);
495
        layout.setComponentAlignment(newNameTypeDesignationButton, Alignment.MIDDLE_CENTER);
496
        typeDesignationTypeCooser.setContent(layout);
497
        UI.getCurrent().addWindow(typeDesignationTypeCooser);
498
    }
499

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

    
517
    /**
518
     * {@inheritDoc}
519
     */
520
    @Override
521
    public void openReferenceEditor(UUID referenceUuid) {
522
        // TODO Auto-generated method stub
523

    
524
    }
525

    
526
    /**
527
     * {@inheritDoc}
528
     */
529
    @Override
530
    public void openNameEditor(UUID nameUuid) {
531
        // TODO Auto-generated method stub
532

    
533
    }
534

    
535
    /**
536
     * {@inheritDoc}
537
     */
538
    @Override
539
    protected String getHeaderText() {
540
        return headerText;
541
    }
542

    
543
    /**
544
     * {@inheritDoc}
545
     */
546
    @Override
547
    public void setHeaderText(String text) {
548
        this.headerText = text;
549
        updateHeader();
550

    
551
    }
552

    
553
    /**
554
     * @return the subheaderText
555
     */
556
    public String getSubheaderText() {
557
        return subheaderText;
558
    }
559

    
560
    /**
561
     * {@inheritDoc}
562
     */
563
    @Override
564
    public void setSubheaderText(String text) {
565
        subheaderText = text;
566
        updateHeader();
567
    }
568

    
569
    /**
570
     * {@inheritDoc}
571
     */
572
    @Override
573
    protected String getSubHeaderText() {
574
        return subheaderText;
575
    }
576

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

    
589
    /**
590
     * {@inheritDoc}
591
     */
592
    @Override
593
    public boolean allowAnonymousAccess() {
594
        return false;
595
    }
596

    
597
    /**
598
     * {@inheritDoc}
599
     */
600
    @Override
601
    public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
602
        return null;
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
}
(14-14/19)