Skip to content

Commit 068cfd7

Browse files
feat(demo): toggle production mode with checkbox
Co-authored-by: Javier Godoy <[email protected]> Fixes #6
1 parent f48dd17 commit 068cfd7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/test/java/com/flowingcode/vaadin/addons/errorwindow/ErrorwindowDemoView.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.flowingcode.vaadin.addons.DemoLayout;
44
import com.vaadin.flow.component.button.Button;
55
import com.vaadin.flow.component.button.ButtonVariant;
6+
import com.vaadin.flow.component.checkbox.Checkbox;
67
import com.vaadin.flow.component.html.Label;
78
import com.vaadin.flow.component.html.Paragraph;
89
import com.vaadin.flow.component.notification.Notification;
@@ -35,15 +36,15 @@ public ErrorwindowDemoView() {
3536
w.open();
3637
}
3738
});
38-
39-
Button toggleProductionMode = new Button("Toggle production mode");
40-
toggleProductionMode.addClickListener(ev->{
41-
System.setProperty("productionMode",""+("false".equals(System.getProperty("productionMode"))));
39+
40+
Checkbox productionModeCb = new Checkbox("Production Mode");
41+
productionModeCb.addValueChangeListener(e -> {
42+
System.setProperty("productionMode", "" + productionModeCb.getValue().toString());
4243
Notification.show("Currently production mode is: " + System.getProperty("productionMode"));
4344
});
44-
45+
4546
setSizeFull();
46-
add(errorButton, throwErrorWithoutErrorHandler, throwErrorWithCustomMessage, toggleProductionMode);
47+
add(productionModeCb, errorButton, throwErrorWithoutErrorHandler, throwErrorWithCustomMessage);
4748
}
4849

4950
}

0 commit comments

Comments
 (0)