Project

General

Profile

Download (24.6 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.ListSelect;
43
import com.vaadin.ui.Notification;
44
import com.vaadin.ui.Panel;
45
import com.vaadin.ui.UI;
46
import com.vaadin.ui.VerticalLayout;
47
import com.vaadin.ui.Window;
48
import com.vaadin.ui.themes.ValoTheme;
49

    
50
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
51
import eu.etaxonomy.cdm.api.service.dto.RegistrationType;
52
import eu.etaxonomy.cdm.api.service.dto.RegistrationWorkingSet;
53
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.TypeDesignationWorkingSetType;
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.RegistrationCuratorRoleProbe;
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
     *
93
     */
94
    private static final int COL_INDEX_STATE_LABEL = 0;
95

    
96
    /**
97
     *
98
     */
99
    private static final int COL_INDEX_REG_ITEM = 1;
100

    
101
    /**
102
     *
103
     */
104
    private static final int COL_INDEX_BUTTON_GROUP = 2;
105

    
106
    public static final String DOM_ID_WORKINGSET = "workingset";
107

    
108
    private static final long serialVersionUID = -213040114015958970L;
109

    
110
    public static final String NAME = "workingset";
111

    
112
    public RegistrationType regType = null;
113

    
114
    private List<CssLayout> registrations = new ArrayList<>();
115

    
116
    private String headerText = "Registration Workingset Editor";
117
    private String subheaderText = "";
118

    
119
    private UUID citationUuid;
120

    
121
    private Button addNewNameRegistrationButton;
122

    
123
    private LazyComboBox<TaxonName> existingNameCombobox;
124

    
125
    private GridLayout registrationsGrid;
126

    
127
    private Button addExistingNameButton;
128

    
129
    private ListSelect existingNameRegistrationTypeSelect;
130

    
131
    private RegistrationItem workingsetHeader;
132

    
133
    private Panel registrationListPanel;
134

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

    
140
    /**
141
     * uses the registrationId as key
142
     */
143
    private Map<UUID, EntityReference> typifiedNamesMap = new HashMap<>();
144

    
145
    private RegistrationStatusFieldInstantiator statusFieldInstantiator;
146

    
147
    public RegistrationWorksetViewBean() {
148
        super();
149
    }
150

    
151

    
152
    /**
153
     * {@inheritDoc}
154
     */
155
    @Override
156
    protected void initContent() {
157
        getLayout().setId(NAME);
158
        updateHeader();
159
        // all content is added in createRegistrationsList()
160
    }
161

    
162

    
163
    /**
164
     * {@inheritDoc}
165
     */
166
    @Override
167
    public void enter(ViewChangeEvent event) {
168
        if(event.getParameters() != null){
169
            this.citationUuid = UUID.fromString(event.getParameters());
170

    
171
            getPresenter().handleViewEntered();
172
        }
173
    }
174

    
175
    /**
176
     * {@inheritDoc}
177
     */
178
    @Override
179
    public void setWorkingset(RegistrationWorkingSet workingset) {
180

    
181
        if(workingsetHeader != null){
182
            getLayout().removeComponent(workingsetHeader);
183
            getLayout().removeComponent(registrationListPanel);
184
        }
185
        workingsetHeader = new RegistrationItem(workingset, this);
186
        addContentComponent(workingsetHeader, null);
187

    
188
        registrationListPanel = createRegistrationsList(workingset);
189
        registrationListPanel.setHeight("100%");
190
        registrationListPanel.setStyleName("registration-list");
191
        registrationListPanel.setCaption("Registrations");
192
        addContentComponent(registrationListPanel, 1.0f);
193

    
194
    }
195

    
196
    @Override
197
    public void setBlockingRegistrations(UUID registrationUuid, Set<RegistrationDTO> blockingRegDTOs) {
198

    
199
        RegistrationDetailsItem regItem = registrationItemMap.get(registrationUuid);
200

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

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

    
224
    }
225

    
226
    /**
227
     * @param workingset
228
     * @return
229
     */
230
    public Panel createRegistrationsList(RegistrationWorkingSet workingset) {
231

    
232
        registrationsGrid = new GridLayout(3, 1);
233
        registrationsGrid.setWidth("100%");
234
        // allow vertical scrolling:
235
        registrationsGrid.setHeightUndefined();
236

    
237
        //registrationsGrid.setColumnExpandRatio(0, 0.1f);
238
        registrationsGrid.setColumnExpandRatio(1, 1f);
239

    
240
        registrationItemMap.clear();
241
        registrationsGrid.setRows(workingset.getRegistrationDTOs().size() * 2  + 3);
242
        int row = 0;
243
        for(RegistrationDTO dto : workingset.getRegistrationDTOs()) {
244
            row = putRegistrationListComponent(row, dto);
245
        }
246

    
247
        // --- Footer with UI to create new registrations ----
248
        Label addRegistrationLabel_1 = new Label("Add a new registration for a");
249
        Label addRegistrationLabel_2 = new Label("or an");
250

    
251
        addNewNameRegistrationButton = new Button("new name");
252
        addNewNameRegistrationButton.setDescription("A name which is newly published in this publication.");
253
        addNewNameRegistrationButton.addClickListener(
254
                e -> getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this)));
255

    
256
        existingNameRegistrationTypeSelect = new ListSelect(null, EnumSet.allOf(ExistingNameRegistrationType.class));
257
        existingNameRegistrationTypeSelect.setRows(1);
258
        existingNameRegistrationTypeSelect.setNullSelectionAllowed(true);
259
        existingNameRegistrationTypeSelect.setEnabled(false);
260
        addExistingNameButton = new Button("existing name:");
261
        addExistingNameButton.setEnabled(false);
262
        addExistingNameButton.addClickListener(
263
                e -> getViewEventBus().publish(this, new RegistrationWorkingsetAction(
264
                        citationUuid,
265
                        RegistrationWorkingsetAction.Action.start,
266
                        (ExistingNameRegistrationType)existingNameRegistrationTypeSelect.getValue())
267
                )
268
             );
269

    
270
        existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class);
271
        existingNameCombobox.addValueChangeListener(
272
                e -> {
273
                    boolean selectionNotEmpty = e.getProperty().getValue() != null;
274
                    addExistingNameButton.setEnabled(selectionNotEmpty);
275
                    existingNameRegistrationTypeSelect.setEnabled(selectionNotEmpty);
276
                    if(selectionNotEmpty){
277
                        TaxonName name = (TaxonName)e.getProperty().getValue();
278
                        if(getPresenter().canCreateRegistrationForName(name)){
279
                            existingNameRegistrationTypeSelect.setValue(ExistingNameRegistrationType.NAME_TYPIFICATION);
280
                            existingNameRegistrationTypeSelect.setEnabled(true);
281
                            existingNameRegistrationTypeSelect.setNullSelectionAllowed(false);
282
                        } else {
283
                            existingNameRegistrationTypeSelect.setValue(ExistingNameRegistrationType.TYPIFICATION_ONLY);
284
                            existingNameRegistrationTypeSelect.setEnabled(false);
285
                        }
286
                    } else {
287
                        existingNameRegistrationTypeSelect.setNullSelectionAllowed(true);
288
                        existingNameRegistrationTypeSelect.clear();
289
                        existingNameRegistrationTypeSelect.setEnabled(false);
290

    
291
                    }
292
                }
293
                );
294

    
295
        HorizontalLayout buttonContainer = new HorizontalLayout(
296
                addRegistrationLabel_1,
297
                addNewNameRegistrationButton,
298
                addRegistrationLabel_2,
299
                addExistingNameButton,
300
                existingNameCombobox,
301
                existingNameRegistrationTypeSelect
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);
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
                        EditorActionType.EDIT,
374
                        baseEntityRef,
375
                        workingsetType,
376
                        registrationEntityUuid,
377
                        typifiedNameRef.getUuid(),
378
                        e.getButton(),
379
                        null,
380
                        this,
381
                        context
382
                        )
383
                    );
384
            });
385
        }
386

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

    
391

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

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

    
413
        if(!dto.getValidationProblems().isEmpty()){
414
            validationProblemsButton.setEnabled(true);
415
            validationProblemsButton.addClickListener(e -> getViewEventBus().publish(this,
416
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
417
                        e,
418
                        RegistrationDTO.class,
419
                        dto.getUuid(),
420
                        RegistrationItem.VALIDATION_PROBLEMS
421
                        )
422
                    )
423
                );
424
        }
425
        validationProblemsButton.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + dto.getValidationProblems().size() + "</span>");
426
        validationProblemsButton.setCaptionAsHtml(true);
427

    
428
        Button messageButton = regItemButtons.getMessagesButton();
429
        messageButton.addClickListener(e -> getViewEventBus().publish(this,
430
                    new ShowDetailsEvent<RegistrationDTO, UUID>(
431
                        e,
432
                        RegistrationDTO.class,
433
                        dto.getUuid(),
434
                        RegistrationItem.MESSAGES
435
                        )
436
                    )
437
                );
438
        messageButton.setStyleName(ValoTheme.BUTTON_TINY);
439

    
440
        Component statusComponent;
441
        if(statusFieldInstantiator != null){
442
            AbstractField<Object> statusField = statusFieldInstantiator.create(dto);
443
            statusField.setValue(dto.getStatus());
444
            statusComponent = statusField;
445
        } else {
446
            statusComponent = new RegistrationStatusLabel().update(dto.getStatus());
447
        }
448
        Label submitterLabel = new Label(dto.getSubmitterUserName());
449
        submitterLabel.setStyleName(LABEL_NOWRAP + " submitter");
450
        submitterLabel.setIcon(FontAwesome.USER);
451
        submitterLabel.setContentMode(ContentMode.HTML);
452
        CssLayout stateAndSubmitter = new CssLayout(statusComponent, submitterLabel);
453

    
454

    
455
        if(UserHelperAccess.userHelper().userIs(new RegistrationCuratorRoleProbe()) || UserHelperAccess.userHelper().userIsAdmin()) {
456
            Button editRegistrationButton = new Button(FontAwesome.COG);
457
            editRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
458
            editRegistrationButton.setDescription("Edit registration");
459
            editRegistrationButton.addClickListener(e -> getViewEventBus().publish(this, new RegistrationEditorAction(
460
                EditorActionType.EDIT,
461
                dto.getUuid(),
462
                e.getButton(),
463
                null,
464
                this
465
                )));
466
            regItemButtons.addComponent(editRegistrationButton);
467
        }
468

    
469
        PermissionDebugUtils.addGainPerEntityPermissionButton(regItemButtons, Registration.class, dto.getUuid(),
470
                EnumSet.of(CRUD.UPDATE), RegistrationStatus.PREPARATION.name());
471

    
472
        row++;
473
        registrationsGrid.addComponent(stateAndSubmitter, COL_INDEX_STATE_LABEL, row);
474
        // registrationsGrid.setComponentAlignment(stateLabel, Alignment.TOP_LEFT);
475
        registrationsGrid.addComponent(regItemButtonGroup, COL_INDEX_REG_ITEM, row);
476
        registrationsGrid.addComponent(regItemButtons, COL_INDEX_BUTTON_GROUP, row);
477
        registrationsGrid.setComponentAlignment(regItemButtons, Alignment.TOP_LEFT);
478

    
479
        row++;
480
        registrationsGrid.addComponent(footer, 0, row, COL_INDEX_BUTTON_GROUP, row);
481

    
482
        return row;
483
    }
484

    
485
    /**
486
     * @param button
487
     * @param registrationEntityId
488
     *
489
     */
490
    @Override
491
    public void chooseNewTypeRegistrationWorkingset(UUID registrationEntityUuid){
492
        Window typeDesignationTypeCooser = new Window();
493
        typeDesignationTypeCooser.setModal(true);
494
        typeDesignationTypeCooser.setResizable(false);
495
        typeDesignationTypeCooser.setCaption("Add new type designation");
496
        Label label = new Label("Please select kind of type designation to be created.");
497
        Button newSpecimenTypeDesignationButton = new Button("Specimen type designation",
498
                e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.SPECIMEN_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
499
        Button newNameTypeDesignationButton = new Button("Name type designation",
500
                e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.NAME_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
501

    
502
        VerticalLayout layout = new VerticalLayout(label, newSpecimenTypeDesignationButton, newNameTypeDesignationButton);
503
        layout.setMargin(true);
504
        layout.setSpacing(true);
505
        layout.setComponentAlignment(newSpecimenTypeDesignationButton, Alignment.MIDDLE_CENTER);
506
        layout.setComponentAlignment(newNameTypeDesignationButton, Alignment.MIDDLE_CENTER);
507
        typeDesignationTypeCooser.setContent(layout);
508
        UI.getCurrent().addWindow(typeDesignationTypeCooser);
509
    }
510

    
511
    /**
512
     * @param button
513
     *
514
     */
515
    protected void addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType newWorkingsetType, UUID registrationEntityUuid, Window typeDesignationTypeCooser, Button sourceButton) {
516
        UI.getCurrent().removeWindow(typeDesignationTypeCooser);
517
        EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
518
        getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
519
                EditorActionType.ADD,
520
                newWorkingsetType,
521
                registrationEntityUuid,
522
                typifiedNameRef.getUuid(),
523
                sourceButton,
524
                null,
525
                this
526
                ));
527
    }
528

    
529
    /**
530
     * {@inheritDoc}
531
     */
532
    @Override
533
    public void openReferenceEditor(UUID referenceUuid) {
534
        // TODO Auto-generated method stub
535

    
536
    }
537

    
538
    /**
539
     * {@inheritDoc}
540
     */
541
    @Override
542
    public void openNameEditor(UUID nameUuid) {
543
        // TODO Auto-generated method stub
544

    
545
    }
546

    
547
    /**
548
     * {@inheritDoc}
549
     */
550
    @Override
551
    protected String getHeaderText() {
552
        return headerText;
553
    }
554

    
555
    /**
556
     * {@inheritDoc}
557
     */
558
    @Override
559
    public void setHeaderText(String text) {
560
        this.headerText = text;
561
        updateHeader();
562

    
563
    }
564

    
565
    /**
566
     * @return the subheaderText
567
     */
568
    public String getSubheaderText() {
569
        return subheaderText;
570
    }
571

    
572
    /**
573
     * {@inheritDoc}
574
     */
575
    @Override
576
    public void setSubheaderText(String text) {
577
        subheaderText = text;
578
        updateHeader();
579
    }
580

    
581
    /**
582
     * {@inheritDoc}
583
     */
584
    @Override
585
    protected String getSubHeaderText() {
586
        return subheaderText;
587
    }
588

    
589
    /**
590
     * {@inheritDoc}
591
     */
592
    @Override
593
    public void openDetailsPopup(String caption, List<String> messages) {
594
        StringBuffer sb = new StringBuffer();
595
        sb.append("<div class=\"details-popup-content\">");
596
        messages.forEach(s -> sb.append(s).append("</br>"));
597
        sb.append("</div>");
598
        new Notification(caption, sb.toString(), Notification.Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
599
    }
600

    
601
    /**
602
     * {@inheritDoc}
603
     */
604
    @Override
605
    public boolean allowAnonymousAccess() {
606
        return false;
607
    }
608

    
609
    /**
610
     * {@inheritDoc}
611
     */
612
    @Override
613
    public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
614
        return null;
615
    }
616

    
617
    /**
618
     * @return the addNewNameRegistrationButton
619
     */
620
    @Override
621
    public Button getAddNewNameRegistrationButton() {
622
        return addNewNameRegistrationButton;
623
    }
624

    
625
    @Override
626
    public Button getAddExistingNameRegistrationButton() {
627
        return addExistingNameButton;
628
    }
629

    
630
    @Override
631
    public LazyComboBox<TaxonName> getAddExistingNameCombobox() {
632
        return existingNameCombobox;
633
    }
634

    
635
    /**
636
     * @return the citationID
637
     */
638
    @Override
639
    public UUID getCitationUuid() {
640
        return citationUuid;
641
    }
642

    
643
    @Override
644
    public Map<UUID, RegistrationDetailsItem> getRegistrationItemMap(){
645
        return Collections.unmodifiableMap(registrationItemMap);
646
    }
647

    
648

    
649
    /**
650
     * @param statusFieldInstantiator the statusFieldInstantiator to set
651
     */
652
    @Override
653
    public void setStatusComponentInstantiator(RegistrationStatusFieldInstantiator statusComponentInstantiator) {
654
        this.statusFieldInstantiator = statusComponentInstantiator;
655
    }
656

    
657

    
658
}
(15-15/20)