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.ui;
|
10
|
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
12
|
import org.springframework.beans.factory.annotation.Qualifier;
|
13
|
|
14
|
import com.vaadin.annotations.Theme;
|
15
|
import com.vaadin.annotations.Title;
|
16
|
import com.vaadin.annotations.Viewport;
|
17
|
import com.vaadin.annotations.Widgetset;
|
18
|
import com.vaadin.navigator.ViewDisplay;
|
19
|
import com.vaadin.server.FontAwesome;
|
20
|
import com.vaadin.server.VaadinRequest;
|
21
|
import com.vaadin.spring.annotation.SpringUI;
|
22
|
import com.vaadin.ui.Component;
|
23
|
import com.vaadin.ui.Label;
|
24
|
import com.vaadin.ui.themes.ValoTheme;
|
25
|
|
26
|
import eu.etaxonomy.cdm.vaadin.debug.EntityCacheDebugger;
|
27
|
import eu.etaxonomy.cdm.vaadin.toolbar.Toolbar;
|
28
|
import eu.etaxonomy.cdm.vaadin.view.name.TaxonNamePopupEditor;
|
29
|
import eu.etaxonomy.cdm.vaadin.view.registration.DashBoardView;
|
30
|
import eu.etaxonomy.cdm.vaadin.view.registration.ListView;
|
31
|
import eu.etaxonomy.cdm.vaadin.view.registration.ListViewBean;
|
32
|
import eu.etaxonomy.cdm.vaadin.view.registration.StartRegistrationViewBean;
|
33
|
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
|
34
|
import eu.etaxonomy.vaadin.ui.MainMenu;
|
35
|
import eu.etaxonomy.vaadin.ui.view.ToolbarDisplay;
|
36
|
|
37
|
/**
|
38
|
* @author a.kohlbecker
|
39
|
* @since Feb 24, 2017
|
40
|
*
|
41
|
*/
|
42
|
@Theme("edit-valo")
|
43
|
@Title("Registration")
|
44
|
@SpringUI(path=RegistrationUI.NAME)
|
45
|
@Viewport("width=device-width, initial-scale=1")
|
46
|
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
47
|
// @PreserveOnRefresh
|
48
|
// @Push
|
49
|
public class RegistrationUI extends AbstractUI implements PopupEditorDefaultStatusMessageSource {
|
50
|
|
51
|
private static final long serialVersionUID = -8626236111335323691L;
|
52
|
|
53
|
public static final String NAME = "registration";
|
54
|
|
55
|
@Autowired
|
56
|
@Qualifier("viewAreaBean")
|
57
|
private ViewDisplay viewDisplay;
|
58
|
|
59
|
//---- pull into abstract super class AbstractApplicationUI ? ---------
|
60
|
|
61
|
@Autowired
|
62
|
private MainMenu mainMenu;
|
63
|
|
64
|
@Autowired
|
65
|
@Qualifier("registrationToolbar")
|
66
|
private Toolbar toolbar;
|
67
|
|
68
|
@Autowired(required = false)
|
69
|
EntityCacheDebugger entityCacheDebugger = null;
|
70
|
|
71
|
//---------------------------------------------
|
72
|
|
73
|
public static final String BRAND_NAME = "phycobank";
|
74
|
|
75
|
public static final String INITIAL_VIEW = DashBoardView.NAME;
|
76
|
|
77
|
public RegistrationUI() {
|
78
|
super();
|
79
|
}
|
80
|
|
81
|
@Override
|
82
|
protected void init(VaadinRequest request) {
|
83
|
super.init(request);
|
84
|
if(entityCacheDebugger != null){
|
85
|
addShortcutListener(entityCacheDebugger.getShortcutListener());
|
86
|
}
|
87
|
}
|
88
|
|
89
|
@Override
|
90
|
protected ViewDisplay getViewDisplay() {
|
91
|
return viewDisplay;
|
92
|
}
|
93
|
|
94
|
@Override
|
95
|
protected void initAdditionalContent() {
|
96
|
setContent((Component) getViewDisplay());
|
97
|
Label phycoBankLogo = new Label("PhycoBank");
|
98
|
phycoBankLogo.addStyleName("phycobank-green");
|
99
|
phycoBankLogo.addStyleName(ValoTheme.LABEL_HUGE);
|
100
|
|
101
|
mainMenu.addMenuComponent(phycoBankLogo);
|
102
|
|
103
|
mainMenu.addMenuItem("New", FontAwesome.EDIT, StartRegistrationViewBean.NAME );
|
104
|
mainMenu.addMenuItem("Continue", FontAwesome.ARROW_RIGHT, ListViewBean.NAME + "/" + ListView.Mode.inProgress.name());
|
105
|
mainMenu.addMenuItem("List", FontAwesome.TASKS, ListViewBean.NAME + "/" + ListView.Mode.all.name());
|
106
|
|
107
|
if(ToolbarDisplay.class.isAssignableFrom(getViewDisplay().getClass())){
|
108
|
((ToolbarDisplay)getViewDisplay()).setToolbar(toolbar);
|
109
|
}
|
110
|
}
|
111
|
|
112
|
@Override
|
113
|
public <T extends AbstractPopupEditor> String defaultStatusMarkup(Class<T> popupEditorClass){
|
114
|
if(popupEditorClass.equals(TaxonNamePopupEditor.class)){
|
115
|
return "<strong>Check if this name already occurs in the <a href=\"https://www.phycobank.org/index-search\" target=\"index-search\">PhycoBank Index</a> (The link will open in a new window.)</strong>";
|
116
|
}
|
117
|
return null;
|
118
|
}
|
119
|
|
120
|
@Override
|
121
|
protected String getInitialViewName() {
|
122
|
return INITIAL_VIEW;
|
123
|
}
|
124
|
|
125
|
}
|