@@ -93,7 +93,9 @@ public TabbedDemo() {
9393 themeCB .setValue (false );
9494 themeCB .addClassName ("smallcheckbox" );
9595 themeCB .addValueChangeListener (cb -> {
96- applyTheme (getElement (), themeCB .getValue ());
96+ boolean useDarkTheme = themeCB .getValue ();
97+ String theme = useDarkTheme ? "dark" : "" ;
98+ applyThemeAttribute (getElement (), theme );
9799 });
98100 footer = new HorizontalLayout ();
99101 footer .setWidthFull ();
@@ -229,7 +231,7 @@ public void showRouterLayoutContent(HasElement content) {
229231 updateFooterButtonsVisibility ();
230232 getElement ().insertChild (1 , content .getElement ());
231233
232- applyTheme (getElement (), getThemeName ());
234+ applyThemeAttribute (getElement (), getThemeAttribute ());
233235 }
234236
235237 private static SourceUrlResolver resolver = null ;
@@ -345,7 +347,12 @@ public void setOrientation(Orientation orientation) {
345347
346348 private static final String THEME_NAME = TabbedDemo .class .getName () + "#THEME_NAME" ;
347349
350+ @ Deprecated
348351 public static String getThemeName () {
352+ return getThemeAttribute ();
353+ }
354+
355+ public static String getThemeAttribute () {
349356 return (String ) Optional .ofNullable (VaadinSession .getCurrent ().getAttribute (THEME_NAME ))
350357 .orElse ("" );
351358 }
@@ -356,7 +363,12 @@ public static void applyTheme(Element element, boolean useDarkTheme) {
356363 applyTheme (element , theme );
357364 }
358365
366+ @ Deprecated
359367 public static void applyTheme (Element element , String theme ) {
368+ applyThemeAttribute (element , theme );
369+ }
370+
371+ public static void applyThemeAttribute (Element element , String theme ) {
360372 VaadinSession .getCurrent ().setAttribute (THEME_NAME , theme );
361373
362374 String script ;
0 commit comments