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.context.ApplicationEventPublisher;
|
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.Responsive;
|
21
|
import com.vaadin.server.VaadinRequest;
|
22
|
import com.vaadin.spring.annotation.SpringUI;
|
23
|
import com.vaadin.ui.Component;
|
24
|
import com.vaadin.ui.UI;
|
25
|
import com.vaadin.ui.themes.ValoTheme;
|
26
|
|
27
|
import eu.etaxonomy.cdm.vaadin.view.phycobank.TestView1;
|
28
|
import eu.etaxonomy.cdm.vaadin.view.phycobank.TestView2;
|
29
|
import eu.etaxonomy.vaadin.ui.MainMenu;
|
30
|
import eu.etaxonomy.vaadin.ui.UIInitializedEvent;
|
31
|
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent;
|
32
|
|
33
|
/**
|
34
|
* @author a.kohlbecker
|
35
|
* @since Feb 24, 2017
|
36
|
*
|
37
|
*/
|
38
|
@Theme("edit-valo")
|
39
|
@Title("Registration")
|
40
|
@SpringUI(path="registration")
|
41
|
@Viewport("width=device-width, initial-scale=1")
|
42
|
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
43
|
// @PreserveOnRefresh
|
44
|
// @Push
|
45
|
public class RegistrationUI extends UI {
|
46
|
|
47
|
private static final long serialVersionUID = -8626236111335323691L;
|
48
|
|
49
|
@Autowired
|
50
|
private ViewDisplay viewDisplay;
|
51
|
|
52
|
/*
|
53
|
* this HACKY solution forces the bean to be instantiated, TODO do it properly
|
54
|
*/
|
55
|
// @Autowired
|
56
|
// MenuBeanDiscoveryBean bean;
|
57
|
|
58
|
@Autowired
|
59
|
private MainMenu mainMenu;
|
60
|
|
61
|
@Autowired
|
62
|
ApplicationEventPublisher eventBus;
|
63
|
|
64
|
public RegistrationUI() {
|
65
|
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
protected void init(VaadinRequest request) {
|
70
|
addStyleName(ValoTheme.UI_WITH_MENU);
|
71
|
Responsive.makeResponsive(this);
|
72
|
|
73
|
setContent((Component) viewDisplay);
|
74
|
|
75
|
mainMenu.addMenuItem(TestView1.NAME, FontAwesome.AMBULANCE, TestView1.NAME);
|
76
|
mainMenu.addMenuItem(TestView2.NAME, FontAwesome.APPLE, TestView2.NAME);
|
77
|
|
78
|
eventBus.publishEvent(new UIInitializedEvent());
|
79
|
|
80
|
//navigate to initial view
|
81
|
eventBus.publishEvent(new NavigationEvent(TestView1.NAME));
|
82
|
}
|
83
|
}
|