1
|
package eu.etaxonomy.cdm.vaadin.ui;
|
2
|
|
3
|
import java.util.logging.Logger;
|
4
|
|
5
|
import javax.servlet.annotation.WebServlet;
|
6
|
|
7
|
import com.vaadin.annotations.Theme;
|
8
|
import com.vaadin.annotations.VaadinServletConfiguration;
|
9
|
import com.vaadin.navigator.Navigator;
|
10
|
import com.vaadin.ui.UI;
|
11
|
|
12
|
import eu.etaxonomy.cdm.vaadin.servlet.CdmVaadinConversationalServlet;
|
13
|
import eu.etaxonomy.cdm.vaadin.view.NaviTestView;
|
14
|
|
15
|
@Theme("chameleon")
|
16
|
public class NavigatorTestUI extends AbstractAuthenticatedUI {
|
17
|
|
18
|
Navigator navigator;
|
19
|
|
20
|
private static final String FIRST_VIEW = "firstView";
|
21
|
public static final String SECOND_VIEW = "secondView";
|
22
|
|
23
|
private final static Logger logger =
|
24
|
Logger.getLogger(NavigatorTestUI.class.getName());
|
25
|
|
26
|
@WebServlet(value = {"/app-test/navi/*"}, asyncSupported = true)
|
27
|
@VaadinServletConfiguration(productionMode = false, ui = NavigatorTestUI.class, widgetset = "eu.etaxonomy.AppWidgetSet")
|
28
|
public static class Servlet extends CdmVaadinConversationalServlet {
|
29
|
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
protected void doInit() {
|
34
|
getPage().setTitle("Navigation Example");
|
35
|
NaviTestView ntv1 = new NaviTestView();
|
36
|
ntv1.setText("Congratulations! you have reached the first view. If you have got here without logging in there we are in trouble :)");
|
37
|
|
38
|
NaviTestView ntv2 = new NaviTestView();
|
39
|
ntv2.setText("Wow! you made it to the second view. Get yourself a beer - preferably a KruĊĦovice Cerne");
|
40
|
|
41
|
ntv2.removeButton();
|
42
|
|
43
|
UI.getCurrent().getNavigator().addView(FIRST_VIEW, ntv1);
|
44
|
UI.getCurrent().getNavigator().addView(SECOND_VIEW, ntv2);
|
45
|
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public String getFirstViewName() {
|
50
|
return FIRST_VIEW;
|
51
|
}
|
52
|
|
53
|
}
|