use of com.vaadin.flow.dom.ThemeList in project vaadin-date-range-picker by xdev-software.
the class DateRangePickerStyledDemo method initUI.
protected void initUI() {
this.btnDarkMode.addClickListener(ev -> {
final ThemeList themeList = UI.getCurrent().getElement().getThemeList();
if (themeList.contains(Lumo.DARK)) {
themeList.remove(Lumo.DARK);
} else {
themeList.add(Lumo.DARK);
}
this.updateBtnDarkMode();
});
this.taResult.setSizeFull();
this.getContent().setPadding(false);
this.getContent().add(new VerticalLayout(this.dateRangePicker), new VerticalLayout(this.taResult, this.btnDarkMode));
this.getContent().getChildren().forEach(comp -> ((HasSize) comp).setHeight("50%"));
this.getContent().setHeightFull();
this.dateRangePicker.addValueChangeListener(ev -> {
final DateRangeModel<SimpleDateRange> modell = ev.getValue();
this.taResult.clear();
// @formatter:off
this.taResult.setValue("DateRange: " + modell.getDateRange().getKey() + "\r\n" + "Start: " + modell.getStart() + "\r\n" + "End: " + modell.getEnd() + "\r\n" + (ev.getOldValue() != null ? "OldValue-DateRange: " + ev.getOldValue().getDateRange().getKey() + "\r\n" + "OldValue-Start: " + ev.getOldValue().getStart() + "\r\n" + "OldValue-End: " + ev.getOldValue().getEnd() : "OldValue: null") + "\r\n" + "IsFromClient: " + ev.isFromClient());
// @formatter:on
});
this.updateBtnDarkMode();
}
use of com.vaadin.flow.dom.ThemeList in project linkki by linkki-framework.
the class PlaygroundApplicationHeader method addHelpMenuItems.
@Override
protected void addHelpMenuItems(MenuItem helpMenu) {
super.addHelpMenuItems(helpMenu);
helpMenu.getSubMenu().addItem("Locale", i -> {
new PmoBasedDialogFactory().newOkDialog("Browser Locale", new LocaleInfoPmo()).open();
});
helpMenu.getSubMenu().addItem("Toogle Dark Mode", i -> {
ThemeList themeList = UI.getCurrent().getElement().getThemeList();
if (themeList.contains(Lumo.DARK)) {
themeList.remove(Lumo.DARK);
} else {
themeList.add(Lumo.DARK);
}
});
}
Aggregations