mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
add NotFoundView
This commit is contained in:
parent
fbb3d6fd63
commit
7e80d79838
27
src/main/java/edu/kit/typicalc/view/main/NotFoundView.java
Normal file
27
src/main/java/edu/kit/typicalc/view/main/NotFoundView.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user