feat: support DynamicTheme initialization in multi-version add-ons#143
feat: support DynamicTheme initialization in multi-version add-ons#143
Conversation
WalkthroughExtended DynamicTheme feature support to Vaadin versions that cannot use AppShellConfigurator by introducing an alternative initialization path via IndexHtmlResponse and a service initializer that loads theme configuration from a properties file. Updated documentation and service loader registration accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 67-71: The fenced code block in README.md showing the
dynamic-theme.properties content lacks a language tag, triggering MD040; update
the block that currently contains "theme=LUMO" to use a properties language tag
(i.e., change the opening fence to ```properties) so the snippet is fenced as a
properties block; locate the block in the README where the instructions mention
creating src/test/resources/META-INF/dynamic-theme.properties and add the
language tag to that fenced code block.
In
`@src/main/java/com/flowingcode/vaadin/addons/demo/DynamicThemeServiceInitListener.java`:
- Around line 1-38: The DynamicThemeServiceInitListener.serviceInit currently
calls DynamicTheme.valueOf(themeName.toUpperCase()) which will throw
IllegalArgumentException for invalid values; update serviceInit to trim the
themeName, convert to upper case using Locale.ROOT (e.g.,
themeName.trim().toUpperCase(Locale.ROOT)), and wrap the DynamicTheme.valueOf
call in a try-catch that catches IllegalArgumentException; when caught, do not
rethrow—log a warning instead and skip registering the IndexHtmlRequestListener
(add a Logger field to the class and use it to record the invalid theme value
and the exception), leaving valid values to call
event.addIndexHtmlRequestListener(theme::initialize).
src/main/java/com/flowingcode/vaadin/addons/demo/DynamicThemeInitializer.java
Show resolved
Hide resolved
ed7f717 to
6610c4b
Compare
6610c4b to
a8a3365
Compare
|



Close #142
Summary by CodeRabbit
Release Notes
New Features
Documentation