|
1 | 1 | package com.flowingcode.vaadin.addons.errorwindow; |
2 | 2 |
|
3 | 3 | import com.flowingcode.vaadin.addons.DemoLayout; |
4 | | -import com.vaadin.flow.component.button.Button; |
5 | | -import com.vaadin.flow.component.button.ButtonVariant; |
6 | | -import com.vaadin.flow.component.checkbox.Checkbox; |
7 | | -import com.vaadin.flow.component.html.Label; |
8 | | -import com.vaadin.flow.component.html.Paragraph; |
9 | | -import com.vaadin.flow.component.notification.Notification; |
| 4 | +import com.flowingcode.vaadin.addons.demo.impl.TabbedDemoImpl; |
10 | 5 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; |
11 | 6 | import com.vaadin.flow.router.Route; |
12 | | -import java.awt.TextField; |
13 | 7 |
|
14 | 8 | @SuppressWarnings("serial") |
15 | 9 | @Route(value = "error-window", layout = DemoLayout.class) |
16 | 10 | public class ErrorwindowDemoView extends VerticalLayout { |
17 | 11 |
|
18 | | - public ErrorwindowDemoView() { |
19 | | - Button errorButton = new Button("Throw Error", event -> { |
20 | | - Integer.parseInt("asdf"); |
21 | | - }); |
22 | | - |
23 | | - Button throwErrorWithoutErrorHandler = new Button("Throw Error without an error handler", ev->{ |
24 | | - try { |
25 | | - Integer.parseInt("asdf"); |
26 | | - } catch (NumberFormatException e) { |
27 | | - ErrorManager.showError(e); |
28 | | - } |
29 | | - }); |
30 | | - |
31 | | - Button throwErrorWithCustomMessage = new Button("Throw Error with custom message", ev->{ |
32 | | - try { |
33 | | - Integer.parseInt("asdf"); |
34 | | - } catch (NumberFormatException e) { |
35 | | - ErrorWindow w = new ErrorWindow(e, "CUSTOM ERROR MESSAGE"); |
36 | | - w.open(); |
37 | | - } |
38 | | - }); |
39 | | - |
40 | | - Checkbox productionModeCb = new Checkbox("Production Mode"); |
41 | | - productionModeCb.addValueChangeListener(e -> { |
42 | | - System.setProperty("productionMode", "" + productionModeCb.getValue().toString()); |
43 | | - Notification.show("Currently production mode is: " + System.getProperty("productionMode")); |
44 | | - }); |
| 12 | + private static final String ERROR_DEMO = "Error Window Demo"; |
| 13 | + private static final String ERROR_SOURCE = "https://github.com/FlowingCode/ErrorWindowAddon/blob/master/src/test/java/com/flowingcode/vaadin/addons/errorwindow/ErrorwindowDemoView.java"; |
45 | 14 |
|
| 15 | + public ErrorwindowDemoView() { |
| 16 | + TabbedDemoImpl<ErrorwindowDemo> errorDemo = new TabbedDemoImpl<>(new ErrorwindowDemo(), ERROR_DEMO, |
| 17 | + ERROR_SOURCE); |
| 18 | + add(errorDemo); |
46 | 19 | setSizeFull(); |
47 | | - add(productionModeCb, errorButton, throwErrorWithoutErrorHandler, throwErrorWithCustomMessage); |
48 | 20 | } |
49 | 21 |
|
50 | 22 | } |
0 commit comments