ref #5285 SpringUI configuration working
[cdm-vaadin.git] / src / test / java / eu / etaxonomy / cdm / vaadin / ui / NavigatorTestUI.java
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.Widgetset;
9 import com.vaadin.navigator.Navigator;
10 import com.vaadin.server.VaadinRequest;
11 import com.vaadin.spring.annotation.SpringUI;
12 import com.vaadin.ui.UI;
13
14 import eu.etaxonomy.cdm.vaadin.servlet.CdmVaadinConversationalServlet;
15 import eu.etaxonomy.cdm.vaadin.view.NaviTestView;
16
17 @Theme("edit")
18 @SpringUI(path="/app-test/navi")
19 @Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
20 public class NavigatorTestUI extends AbstractAuthenticatedUI {
21
22 Navigator navigator;
23
24 private static final String FIRST_VIEW = "firstView";
25 public static final String SECOND_VIEW = "secondView";
26
27 private final static Logger logger =
28 Logger.getLogger(NavigatorTestUI.class.getName());
29
30 @WebServlet(value = {"/*"}, asyncSupported = true)
31 public static class Servlet extends CdmVaadinConversationalServlet {
32
33 }
34
35 @Override
36 protected void doInit(VaadinRequest request) {
37 getPage().setTitle("Navigation Example");
38 NaviTestView ntv1 = new NaviTestView();
39 ntv1.setText("Congratulations! you have reached the first view. If you have got here without logging in there we are in trouble :)");
40
41 NaviTestView ntv2 = new NaviTestView();
42 ntv2.setText("Wow! you made it to the second view. Get yourself a beer - preferably a Krusovice Cerne");
43
44 ntv2.removeButton();
45
46 UI.getCurrent().getNavigator().addView(FIRST_VIEW, ntv1);
47 UI.getCurrent().getNavigator().addView(SECOND_VIEW, ntv2);
48
49 }
50
51 @Override
52 public String getFirstViewName() {
53 return FIRST_VIEW;
54 }
55
56 }