From 7e80d79838f7c18a7773693bd8167785d98d3ff7 Mon Sep 17 00:00:00 2001 From: ucrhh Date: Mon, 1 Feb 2021 14:42:33 +0100 Subject: [PATCH] add NotFoundView --- .../kit/typicalc/view/main/NotFoundView.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/edu/kit/typicalc/view/main/NotFoundView.java diff --git a/src/main/java/edu/kit/typicalc/view/main/NotFoundView.java b/src/main/java/edu/kit/typicalc/view/main/NotFoundView.java new file mode 100644 index 0000000..72f0fda --- /dev/null +++ b/src/main/java/edu/kit/typicalc/view/main/NotFoundView.java @@ -0,0 +1,27 @@ +package edu.kit.typicalc.view.main; + +import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.router.*; + +import javax.servlet.http.HttpServletResponse; + +@ParentLayout(MainViewImpl.class) +public class NotFoundView extends Div + implements HasErrorParameter { + + private final Label error = new Label(); + + public NotFoundView() { + add(error); // todo make more beautiful + } + + @Override + public int setErrorParameter( + BeforeEnterEvent event, + ErrorParameter parameter) { + + error.setText("Cannot find URL: " + event.getLocation().getPath()); + return HttpServletResponse.SC_NOT_FOUND; + } +} \ No newline at end of file