add NotFoundView

This commit is contained in:
ucrhh 2021-02-01 14:42:33 +01:00
parent fbb3d6fd63
commit 7e80d79838

View File

@ -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<NotFoundException> {
private final Label error = new Label();
public NotFoundView() {
add(error); // todo make more beautiful
}
@Override
public int setErrorParameter(
BeforeEnterEvent event,
ErrorParameter<NotFoundException> parameter) {
error.setText("Cannot find URL: " + event.getLocation().getPath());
return HttpServletResponse.SC_NOT_FOUND;
}
}