Project

General

Profile

Download (24.4 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.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, getPresenter().getCache());
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, getPresenter().getCache()));
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
        Stack<EditorActionContext> context = new Stack<EditorActionContext>();
249
        context.push(new EditorActionContext(
250
                    new TypedEntityReference<>(Registration.class, null),
251
                    this)
252
                    );
253
        addNewNameRegistrationButton.addClickListener(
254
                e -> {
255
                    getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this, context));
256

    
257
                }
258
        );
259

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

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

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

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

    
311
        row++;
312
        Label hint = new Label(
313
                "For most names that already exist in the system, it is only possible to create a registration covering type designations. "
314
                + "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.",
315
                ContentMode.HTML);
316
        registrationsGrid.addComponent(hint, 0, row, COL_INDEX_BUTTON_GROUP, row);
317
        registrationsGrid.setComponentAlignment(hint, Alignment.MIDDLE_RIGHT);
318

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

    
324

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

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

    
333
        RegistrationItemNameAndTypeButtons regItemButtonGroup = new RegistrationItemNameAndTypeButtons(dto);
334
        UUID registrationEntityUuid = dto.getUuid();
335

    
336
        RegistrationItemButtons regItemButtons = new RegistrationItemButtons();
337

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

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

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

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

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

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

    
389

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

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

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

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

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

    
452

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

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

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

    
477
        row++;
478
        registrationsGrid.addComponent(footer, 0, row, COL_INDEX_BUTTON_GROUP, row);
479

    
480
        return row;
481
    }
482

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

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

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

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

    
533
    }
534

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

    
542
    }
543

    
544
    /**
545
     * {@inheritDoc}
546
     */
547
    @Override
548
    protected String getHeaderText() {
549
        return headerText;
550
    }
551

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

    
560
    }
561

    
562
    /**
563
     * @return the subheaderText
564
     */
565
    public String getSubheaderText() {
566
        return subheaderText;
567
    }
568

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

    
578
    /**
579
     * {@inheritDoc}
580
     */
581
    @Override
582
    protected String getSubHeaderText() {
583
        return subheaderText;
584
    }
585

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

    
598
    /**
599
     * {@inheritDoc}
600
     */
601
    @Override
602
    public boolean allowAnonymousAccess() {
603
        return false;
604
    }
605

    
606
    /**
607
     * {@inheritDoc}
608
     */
609
    @Override
610
    public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
611
        return null;
612
    }
613

    
614
    /**
615
     * @return the addNewNameRegistrationButton
616
     */
617
    @Override
618
    public Button getAddNewNameRegistrationButton() {
619
        return addNewNameRegistrationButton;
620
    }
621

    
622
    @Override
623
    public Button getAddExistingNameRegistrationButton() {
624
        return addExistingNameButton;
625
    }
626

    
627
    @Override
628
    public LazyComboBox<TaxonName> getAddExistingNameCombobox() {
629
        return existingNameCombobox;
630
    }
631

    
632
    /**
633
     * @return the citationID
634
     */
635
    @Override
636
    public UUID getCitationUuid() {
637
        return citationUuid;
638
    }
639

    
640
    @Override
641
    public Map<UUID, RegistrationDetailsItem> getRegistrationItemMap(){
642
        return Collections.unmodifiableMap(registrationItemMap);
643
    }
644

    
645

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

    
654

    
655
}
(15-15/20)