c1e536f02ce0d5f561fc45e43b09ed308405c69e
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / vaadin / uiset / redlist / views / ErrorView.java
1 package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
2
3 import javax.annotation.PostConstruct;
4
5 import org.springframework.context.annotation.Scope;
6 import org.springframework.stereotype.Component;
7
8 import ru.xpoft.vaadin.VaadinView;
9
10 import com.vaadin.navigator.View;
11 import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
12 import com.vaadin.server.ExternalResource;
13 import com.vaadin.server.Page;
14 import com.vaadin.ui.CustomComponent;
15 import com.vaadin.ui.Label;
16 import com.vaadin.ui.Link;
17 import com.vaadin.ui.VerticalLayout;
18
19 /**
20 *
21 * This view is intended to be the default error view. It doesn't work yet as intended, but it will be only
22 * a matter of time until the right wiring is found, so this view will serve its purpose in the near future.
23 *
24 * @author a.oppermann
25 *
26 */
27
28 @Component
29 @Scope("prototype")
30 @VaadinView(ErrorView.NAME)
31 public class ErrorView extends CustomComponent implements View{
32
33 /**
34 * automatically generated ID
35 */
36 private static final long serialVersionUID = -5247307478297680373L;
37
38 public final static String NAME = "error";
39
40
41 @PostConstruct
42 public void PostConstruct(){// throws GeneralSecurityException
43 Page.getCurrent().setLocation("/");
44 setSizeFull();
45 VerticalLayout layout = new VerticalLayout();
46 layout.setSpacing(true);
47 layout.setMargin(true);
48
49
50 Label header = new Label("ERROR");
51 header.setStyleName("h1");
52
53 Label message = new Label("We are sorry for the inconvenience, but the site you were trying to reach is not registered in our System.");
54 Link startpage = new Link("Go to the startpage", new ExternalResource("/"));
55
56 layout.addComponent(header);
57 layout.addComponent(message);
58 layout.addComponent(startpage);
59 setCompositionRoot(layout);
60
61
62 }
63
64
65 @Override
66 public void enter(ViewChangeEvent event) {
67 }
68
69
70 }