b068f37b61ea490a667cf19b388a5deb9fae3801
[cdm-vaadin.git] / src / main / java / eu / etaxonomy / cdm / vaadin / view / registration / RegistrationWorksetViewBean.java
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.TypeDesignationWorkingSet.TypeDesignationWorkingSetType;
52 import eu.etaxonomy.cdm.api.util.RoleProberImpl;
53 import eu.etaxonomy.cdm.model.common.VersionableEntity;
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.model.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.BadgeButton;
62 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem;
63 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemButtons;
64 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTypeButtons;
65 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemNameAndTypeButtons.TypeDesignationWorkingSetButton;
66 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemsPanel;
67 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusFieldInstantiator;
68 import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusLabel;
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 GridLayout registrationsGrid;
117
118 private RegistrationItem workingsetHeader;
119
120 private Panel registrationListPanel;
121
122 private Button addNewNameRegistrationButton;
123
124 private Button addExistingNameButton;
125
126 private LazyComboBox<TaxonName> existingNameCombobox;
127
128 private Label existingNameRegistrationTypeLabel;
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 private String accessDeniedMessage;
143
144 private Object existingNameEditor;
145
146 public RegistrationWorksetViewBean() {
147 super();
148 }
149
150
151 /**
152 * {@inheritDoc}
153 */
154 @Override
155 protected void initContent() {
156 getLayout().setId(NAME);
157 updateHeader();
158 // all content is added in createRegistrationsList()
159 }
160
161
162 /**
163 * {@inheritDoc}
164 */
165 @Override
166 public void enter(ViewChangeEvent event) {
167 if(event.getParameters() != null){
168 this.citationUuid = UUID.fromString(event.getParameters());
169
170 getPresenter().handleViewEntered();
171 }
172 }
173
174 /**
175 * {@inheritDoc}
176 */
177 @Override
178 public void setWorkingset(RegistrationWorkingSet workingset) {
179
180 if(workingsetHeader != null){
181 getLayout().removeComponent(workingsetHeader);
182 getLayout().removeComponent(registrationListPanel);
183 }
184 workingsetHeader = new RegistrationItem(workingset, this, getPresenter().getCache());
185 addContentComponent(workingsetHeader, null);
186
187 registrationListPanel = createRegistrationsList(workingset);
188 registrationListPanel.setHeight("100%");
189 registrationListPanel.setStyleName("registration-list");
190 registrationListPanel.setCaption("Registrations");
191 addContentComponent(registrationListPanel, 1.0f);
192
193 }
194
195 @Override
196 public void setBlockingRegistrations(UUID registrationUuid, Set<RegistrationDTO> blockingRegDTOs) {
197
198 RegistrationDetailsItem regItem = registrationItemMap.get(registrationUuid);
199
200 boolean blockingRegAdded = false;
201 for(Iterator it = regItem.itemFooter.iterator(); it.hasNext(); ){
202 if(it.next() instanceof RegistrationItemsPanel){
203 blockingRegAdded = true;
204 break;
205 }
206 }
207 if(!blockingRegAdded){
208 regItem.itemFooter.addComponent(new RegistrationItemsPanel(this, "Blocked by", blockingRegDTOs, getPresenter().getCache()));
209 }
210 }
211
212 /**
213 * {@inheritDoc}
214 */
215 @Override
216 @Deprecated // no longer needed
217 public void addBlockingRegistration(RegistrationDTO blocking) {
218 if(registrations == null) {
219 throw new RuntimeException("A Workingset must be present prior adding blocking registrations.");
220 }
221 // add the blocking registration
222
223 }
224
225 /**
226 * @param workingset
227 * @return
228 */
229 public Panel createRegistrationsList(RegistrationWorkingSet workingset) {
230
231 registrationsGrid = new GridLayout(3, 1);
232 registrationsGrid.setWidth("100%");
233 // allow vertical scrolling:
234 registrationsGrid.setHeightUndefined();
235
236 //registrationsGrid.setColumnExpandRatio(0, 0.1f);
237 registrationsGrid.setColumnExpandRatio(1, 1f);
238
239 registrationItemMap.clear();
240 registrationsGrid.setRows(workingset.getRegistrationDTOs().size() * 2 + 3);
241 int row = 0;
242 for(RegistrationDTO dto : workingset.getRegistrationDTOs()) {
243 row = putRegistrationListComponent(row, dto);
244 }
245
246 // --- Footer with UI to create new registrations ----
247 Label addRegistrationLabel_1 = new Label("Add a new registration for a");
248 Label addRegistrationLabel_2 = new Label("or an");
249
250 addNewNameRegistrationButton = new Button("new name");
251 addNewNameRegistrationButton.setDescription("A name which is newly published in this publication.");
252 Stack<EditorActionContext> context = new Stack<EditorActionContext>();
253 context.push(new EditorActionContext(
254 new TypedEntityReference<>(Registration.class, null),
255 this)
256 );
257 addNewNameRegistrationButton.addClickListener(
258 e -> {
259 getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this, context));
260
261 }
262 );
263
264 existingNameRegistrationTypeLabel = new Label();
265 addExistingNameButton = new Button("existing name:");
266 addExistingNameButton.setEnabled(false);
267 addExistingNameButton.addClickListener(e -> reviewExistingName());
268
269 existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class);
270 existingNameCombobox.addValueChangeListener(
271 e -> {
272 boolean selectionNotEmpty = e.getProperty().getValue() != null;
273 addExistingNameButton.setEnabled(false);
274 existingNameRegistrationTypeLabel.setValue(null);
275 if(selectionNotEmpty){
276 TaxonName name = (TaxonName)e.getProperty().getValue();
277 if(getPresenter().canCreateNameRegistrationFor(name)){
278 existingNameRegistrationTypeLabel.setValue(TEXT_NAME_TYPIFICATION);
279 addExistingNameButton.setEnabled(true);
280 } else {
281 if(!getPresenter().checkWokingsetContainsProtologe(name)){
282 existingNameRegistrationTypeLabel.setValue(TEXT_TYPIFICATION_ONLY);
283 addExistingNameButton.setEnabled(true);
284 }
285 }
286 } else {
287 existingNameRegistrationTypeLabel.setValue(null);
288 }
289 }
290 );
291
292 HorizontalLayout buttonContainer = new HorizontalLayout(
293 addRegistrationLabel_1,
294 addNewNameRegistrationButton,
295 addRegistrationLabel_2,
296 addExistingNameButton,
297 existingNameCombobox,
298 existingNameRegistrationTypeLabel
299 );
300 buttonContainer.setSpacing(true);
301 // buttonContainer.setWidth(100, Unit.PERCENTAGE);
302 buttonContainer.setComponentAlignment(addRegistrationLabel_1, Alignment.MIDDLE_LEFT);
303 buttonContainer.setComponentAlignment(addRegistrationLabel_2, Alignment.MIDDLE_LEFT);
304
305 row++;
306 registrationsGrid.addComponent(buttonContainer, 0, row, COL_INDEX_BUTTON_GROUP, row);
307 registrationsGrid.setComponentAlignment(buttonContainer, Alignment.MIDDLE_RIGHT);
308
309 row++;
310 Label hint = new Label(
311 "For most names that already exist in the system, it is only possible to create a registration covering type designations. "
312 + "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.",
313 ContentMode.HTML);
314 registrationsGrid.addComponent(hint, 0, row, COL_INDEX_BUTTON_GROUP, row);
315 registrationsGrid.setComponentAlignment(hint, Alignment.MIDDLE_RIGHT);
316
317 Panel namesTypesPanel = new Panel(registrationsGrid);
318 namesTypesPanel.setStyleName(EditValoTheme.PANEL_CONTENT_PADDING_LEFT);
319 return namesTypesPanel;
320 }
321
322 private void reviewExistingName() {
323 // call commit to make the selection available
324 existingNameCombobox.commit();
325 UUID uuid = existingNameCombobox.getValue().getUuid();
326 Stack<EditorActionContext> context = new Stack<EditorActionContext>();
327 context.push(new EditorActionContext(
328 new TypedEntityReference<>(TaxonName.class, uuid),
329 this)
330 );
331 getViewEventBus().publish(
332 this,
333 new TaxonNameEditorAction(
334 EditorActionType.EDIT,
335 uuid,
336 addExistingNameButton,
337 existingNameCombobox,
338 this,
339 context)
340 );
341
342 }
343
344 /**
345 * publishes an event to the {@link RegistrationWorkingsetPresenter}
346 * @deprecated no longer used but kept for reference
347 * TODO remove for version 5.8 when not used again.
348 */
349 @Deprecated
350 private void triggerRegistrationForExistingName() {
351 getViewEventBus().publish(this, new RegistrationWorkingsetAction(
352 citationUuid,
353 RegistrationWorkingsetAction.Action.start
354 )
355 );
356 }
357
358
359 protected int putRegistrationListComponent(int row, RegistrationDTO dto) {
360
361 EntityReference typifiedNameReference = dto.getTypifiedNameRef();
362 if(typifiedNameReference == null){
363 typifiedNameReference = dto.getNameRef();
364 }
365 typifiedNamesMap.put(dto.getUuid(), typifiedNameReference);
366
367 RegistrationItemNameAndTypeButtons regItemButtonGroup = new RegistrationItemNameAndTypeButtons(dto, getPresenter().getCache());
368 UUID registrationEntityUuid = dto.getUuid();
369
370 RegistrationItemButtons regItemButtons = new RegistrationItemButtons();
371
372 CssLayout footer = new CssLayout();
373 footer.setWidth(100, Unit.PERCENTAGE);
374 footer.setStyleName("item-footer");
375
376 RegistrationDetailsItem regDetailsItem = new RegistrationDetailsItem(regItemButtonGroup, regItemButtons, footer);
377 registrationItemMap.put(registrationEntityUuid, regDetailsItem);
378
379 Stack<EditorActionContext> context = new Stack<EditorActionContext>();
380 context.push(new EditorActionContext(
381 new TypedEntityReference<>(Registration.class, registrationEntityUuid),
382 this)
383 );
384
385 if(regItemButtonGroup.getNameButton() != null){
386 regItemButtonGroup.getNameButton().getButton().addClickListener(e -> {
387 UUID nameuUuid = regItemButtonGroup.getNameButton().getUuid();
388 getViewEventBus().publish(this, new TaxonNameEditorAction(
389 EditorActionType.EDIT,
390 nameuUuid,
391 e.getButton(),
392 null,
393 this,
394 context
395 )
396 );
397 });
398 }
399
400 for(TypeDesignationWorkingSetButton workingsetButton : regItemButtonGroup.getTypeDesignationButtons()){
401 workingsetButton.getButton().addClickListener(e -> {
402 VersionableEntity baseEntity = workingsetButton.getBaseEntity();
403 EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
404 TypeDesignationWorkingSetType workingsetType = workingsetButton.getType();
405 getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
406 baseEntity,
407 workingsetType,
408 registrationEntityUuid,
409 typifiedNameRef.getUuid(),
410 e.getButton(),
411 null,
412 this,
413 context
414 )
415 );
416 });
417 }
418
419 regItemButtonGroup.getAddTypeDesignationButton().addClickListener(
420 e -> chooseNewTypeRegistrationWorkingset(dto.getUuid())
421 );
422
423
424 Button blockingRegistrationButton = regItemButtons.getBlockingRegistrationButton();
425 blockingRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
426 blockingRegistrationButton.setDescription("No blocking registrations");
427 if(dto.isBlocked()){
428 blockingRegistrationButton.setEnabled(true);
429 blockingRegistrationButton.setDescription("This registration is currently blocked by other registrations");
430 blockingRegistrationButton.addStyleName(EditValoTheme.BUTTON_HIGHLITE);
431 blockingRegistrationButton.addClickListener(e -> getViewEventBus().publish(
432 this,
433 new ShowDetailsEvent<RegistrationDTO, UUID>(
434 e,
435 RegistrationDTO.class,
436 dto.getUuid(),
437 RegistrationItem.BLOCKED_BY
438 )
439 ));
440 }
441
442 BadgeButton validationProblemsButton = regItemButtons.getValidationProblemsButton();
443 validationProblemsButton.setStyleName(ValoTheme.BUTTON_TINY); // + " " + RegistrationStyles.STYLE_FRIENDLY_FOREGROUND);
444
445 if(!dto.getValidationProblems().isEmpty()){
446 validationProblemsButton.setEnabled(true);
447 validationProblemsButton.addClickListener(e -> getViewEventBus().publish(this,
448 new ShowDetailsEvent<RegistrationDTO, UUID>(
449 e,
450 RegistrationDTO.class,
451 dto.getUuid(),
452 RegistrationItem.VALIDATION_PROBLEMS
453 )
454 )
455 );
456 }
457 int problemCount = dto.getValidationProblems().size();
458 validationProblemsButton.setCaption(problemCount > 0 ? Integer.toString(problemCount) : null);
459
460 Component statusComponent;
461 if(statusFieldInstantiator != null){
462 statusComponent = statusFieldInstantiator.create(dto);
463 } else {
464 statusComponent = new RegistrationStatusLabel().update(dto.getStatus());
465 }
466 Label submitterLabel = new Label(dto.getSubmitterUserName());
467 submitterLabel.setStyleName(LABEL_NOWRAP + " submitter");
468 submitterLabel.setIcon(FontAwesome.USER);
469 submitterLabel.setContentMode(ContentMode.HTML);
470 CssLayout stateAndSubmitter = new CssLayout(statusComponent, submitterLabel);
471
472
473 if(UserHelperAccess.userHelper().userIs(new RoleProberImpl(RolesAndPermissions.ROLE_CURATION)) || UserHelperAccess.userHelper().userIsAdmin()) {
474
475 Button editRegistrationButton = new Button(FontAwesome.COG);
476 editRegistrationButton.setStyleName(ValoTheme.BUTTON_TINY);
477 editRegistrationButton.setDescription("Edit registration");
478 editRegistrationButton.addClickListener(e -> getViewEventBus().publish(this, new RegistrationEditorAction(
479 EditorActionType.EDIT,
480 dto.getUuid(),
481 e.getButton(),
482 null,
483 this
484 )));
485
486 Button unlockButton = new Button(FontAwesome.LOCK);
487 unlockButton.setStyleName(ValoTheme.BUTTON_TINY);
488 unlockButton.setDescription("Unlock");
489 unlockButton.addClickListener(e -> {
490 regItemButtonGroup.setLockOverride(!regItemButtonGroup.isLockOverride());
491 if(regItemButtonGroup.isRegistrationLocked()){
492 unlockButton.setIcon(regItemButtonGroup.isLockOverride() ? FontAwesome.UNLOCK_ALT : FontAwesome.LOCK);
493 unlockButton.setDescription(regItemButtonGroup.isLockOverride() ? "Click to unlock editing" : "Click to lock editing");
494 }
495 });
496 unlockButton.setEnabled(regItemButtonGroup.isRegistrationLocked());
497 regItemButtons.addComponents(unlockButton, editRegistrationButton);
498 }
499
500 PermissionDebugUtils.addGainPerEntityPermissionButton(regItemButtons, Registration.class, dto.getUuid(),
501 EnumSet.of(CRUD.UPDATE), RegistrationStatus.PREPARATION.name());
502
503 row++;
504 registrationsGrid.addComponent(stateAndSubmitter, COL_INDEX_STATE_LABEL, row);
505 // registrationsGrid.setComponentAlignment(stateLabel, Alignment.TOP_LEFT);
506 registrationsGrid.addComponent(regItemButtonGroup, COL_INDEX_REG_ITEM, row);
507 registrationsGrid.addComponent(regItemButtons, COL_INDEX_BUTTON_GROUP, row);
508 registrationsGrid.setComponentAlignment(regItemButtons, Alignment.TOP_LEFT);
509
510 row++;
511 registrationsGrid.addComponent(footer, 0, row, COL_INDEX_BUTTON_GROUP, row);
512
513 return row;
514 }
515
516 /**
517 * @param button
518 * @param registrationEntityId
519 *
520 */
521 @Override
522 public void chooseNewTypeRegistrationWorkingset(UUID registrationEntityUuid){
523 Window typeDesignationTypeCooser = new Window();
524 typeDesignationTypeCooser.setModal(true);
525 typeDesignationTypeCooser.setResizable(false);
526 typeDesignationTypeCooser.setCaption("Add new type designation");
527 Label label = new Label("Please select kind of type designation to be created.");
528 Button newSpecimenTypeDesignationButton = new Button("Specimen type designation",
529 e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.SPECIMEN_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
530 Button newNameTypeDesignationButton = new Button("Name type designation",
531 e -> addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType.NAME_TYPE_DESIGNATION_WORKINGSET, registrationEntityUuid, typeDesignationTypeCooser, e.getButton()));
532
533 VerticalLayout layout = new VerticalLayout(label, newSpecimenTypeDesignationButton, newNameTypeDesignationButton);
534 layout.setMargin(true);
535 layout.setSpacing(true);
536 layout.setComponentAlignment(newSpecimenTypeDesignationButton, Alignment.MIDDLE_CENTER);
537 layout.setComponentAlignment(newNameTypeDesignationButton, Alignment.MIDDLE_CENTER);
538 typeDesignationTypeCooser.setContent(layout);
539 UI.getCurrent().addWindow(typeDesignationTypeCooser);
540 }
541
542 /**
543 * @param button
544 *
545 */
546 protected void addNewTypeDesignationWorkingset(TypeDesignationWorkingSetType newWorkingsetType, UUID registrationEntityUuid, Window typeDesignationTypeCooser, Button sourceButton) {
547 UI.getCurrent().removeWindow(typeDesignationTypeCooser);
548 EntityReference typifiedNameRef = typifiedNamesMap.get(registrationEntityUuid);
549 getViewEventBus().publish(this, new TypeDesignationWorkingsetEditorAction(
550 newWorkingsetType,
551 registrationEntityUuid,
552 typifiedNameRef.getUuid(),
553 sourceButton,
554 null,
555 this
556 ));
557 }
558
559 /**
560 * {@inheritDoc}
561 */
562 @Override
563 public void openReferenceEditor(UUID referenceUuid) {
564 // TODO Auto-generated method stub
565
566 }
567
568 /**
569 * {@inheritDoc}
570 */
571 @Override
572 public void openNameEditor(UUID nameUuid) {
573 // TODO Auto-generated method stub
574
575 }
576
577 /**
578 * {@inheritDoc}
579 */
580 @Override
581 protected String getHeaderText() {
582 return headerText;
583 }
584
585 /**
586 * {@inheritDoc}
587 */
588 @Override
589 public void setHeaderText(String text) {
590 this.headerText = text;
591 updateHeader();
592
593 }
594
595 /**
596 * @return the subheaderText
597 */
598 public String getSubheaderText() {
599 return subheaderText;
600 }
601
602 /**
603 * {@inheritDoc}
604 */
605 @Override
606 public void setSubheaderText(String text) {
607 subheaderText = text;
608 updateHeader();
609 }
610
611 /**
612 * {@inheritDoc}
613 */
614 @Override
615 protected String getSubHeaderText() {
616 return subheaderText;
617 }
618
619 /**
620 * {@inheritDoc}
621 */
622 @Override
623 public void openDetailsPopup(String caption, List<String> messages) {
624 StringBuffer sb = new StringBuffer();
625 sb.append("<div class=\"details-popup-content\">");
626 messages.forEach(s -> sb.append(s).append("</br>"));
627 sb.append("</div>");
628 new Notification(caption, sb.toString(), Notification.Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
629 }
630
631 @Override
632 public boolean allowAnonymousAccess() {
633 return false;
634 }
635
636 @Override
637 public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
638 return null;
639 }
640
641 @Override
642 public String getAccessDeniedMessage() {
643 return accessDeniedMessage;
644 }
645
646 @Override
647 public void setAccessDeniedMessage(String accessDeniedMessage) {
648 this.accessDeniedMessage = accessDeniedMessage;
649 }
650
651 /**
652 * @return the addNewNameRegistrationButton
653 */
654 @Override
655 public Button getAddNewNameRegistrationButton() {
656 return addNewNameRegistrationButton;
657 }
658
659 @Override
660 public Button getAddExistingNameRegistrationButton() {
661 return addExistingNameButton;
662 }
663
664 @Override
665 public LazyComboBox<TaxonName> getAddExistingNameCombobox() {
666 return existingNameCombobox;
667 }
668
669 /**
670 * @return the citationID
671 */
672 @Override
673 public UUID getCitationUuid() {
674 return citationUuid;
675 }
676
677 @Override
678 public Map<UUID, RegistrationDetailsItem> getRegistrationItemMap(){
679 return Collections.unmodifiableMap(registrationItemMap);
680 }
681
682
683 /**
684 * @param statusFieldInstantiator the statusFieldInstantiator to set
685 */
686 @Override
687 public void setStatusComponentInstantiator(RegistrationStatusFieldInstantiator statusComponentInstantiator) {
688 this.statusFieldInstantiator = statusComponentInstantiator;
689 }
690
691
692 }