Skip to content

Conversation

@javier-godoy
Copy link
Member

@javier-godoy javier-godoy commented Jan 29, 2026

In Vaadin 25, the framework officially uses the term ColorScheme (light/dark). Previously, our codebase used "themeAttribute," which has become ambiguous now that we’re considering to implement dynamic theme switching. I’ve updated the naming to align with Vaadin’s nomenclature and to make the distinction between a Theme (the whole look) and a ColorScheme (the specific color mode) clearer.

Summary by CodeRabbit

  • New Features

    • Added color scheme support with light and dark theme options
    • Introduced new APIs for layout orientation and source code visibility controls
    • Added event listener support for source code changes
  • Chores

    • Updated project version to 5.2.0

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

Version bump from 5.1.1-SNAPSHOT to 5.2.0-SNAPSHOT in pom.xml. Introduction of a new ColorScheme enum with LIGHT and DARK constants. Refactoring of TabbedDemo to migrate theme attribute application to color scheme-based logic, along with expanded public API for source visibility and layout orientation control.

Changes

Cohort / File(s) Summary
Build Configuration
pom.xml
Version updated from 5.1.1-SNAPSHOT to 5.2.0-SNAPSHOT.
New Enum
src/main/java/com/flowingcode/vaadin/addons/demo/ColorScheme.java
New public enum ColorScheme with LIGHT and DARK constants; uses Lombok @RequiredArgsConstructor and @Getter for constructor and value accessor.
Core Refactoring
src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java
Migrated theming from theme attribute to color scheme approach with new static setColorScheme() and getColorScheme() methods. Added public methods for source visibility control (setSourceVisible(), toggleSourcePosition()), layout orientation management (getOrientation(), setOrientation()), event listener registration (addTabbedDemoSourceListener()), and custom helper viewer injection (setDemoHelperViewer()). Deprecated getThemeAttribute() and applyThemeAttribute(). Expanded Javadoc coverage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • mlopezFC
  • paodb
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 65.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: deprecating get/applyThemeAttribute methods in favor of get/setColorScheme, which aligns with the primary modifications in TabbedDemo.java and the new ColorScheme enum.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@src/main/java/com/flowingcode/vaadin/addons/demo/ColorScheme.java`:
- Around line 22-36: Remove the accidental Vaadin license block that was
inserted between imports: delete the entire comment block located between the
import lines for lombok.Getter and lombok.RequiredArgsConstructor so imports are
contiguous; ensure the file still imports lombok.Getter and
lombok.RequiredArgsConstructor and that the ColorScheme class and its
annotations remain unaffected.

In `@src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java`:
- Around line 346-348: getOrientation() can NPE because it calls
currentLayout.getOrientation() without checking currentLayout; update the
getOrientation method to mirror the defensive checks used in
toggleSourcePosition/setOrientation by returning a safe default (e.g., null or a
default Orientation) when currentLayout is null or otherwise handling the null
case, so reference currentLayout and getOrientation in your change and align
behavior with toggleSourcePosition/setOrientation.
- Around line 400-407: The applyThemeAttribute method uses
element.getComponent().get() unsafely and silently ignores unknown themes;
update applyThemeAttribute to check element.getComponent().isPresent() (or use
orElseThrow with a clear message) before obtaining the Component, and ensure
unknown theme strings fall back to a defined behavior (e.g., call
setColorScheme(c, ColorScheme.LIGHT) or log/warn and leave unchanged) rather
than doing nothing; reference the Element#getComponent() Optional handling and
the setColorScheme(Component, ColorScheme) and ColorScheme enum to locate the
changes.
🧹 Nitpick comments (1)
src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java (1)

315-318: Potential visibility state inconsistency.

setSourceVisible(true) always makes codePositionCB visible, but updateFooterButtonsVisibility() sets its visibility based on whether currentLayout != null. This could lead to inconsistent states where codePositionCB is visible even when there's no source code layout.

Consider aligning the visibility logic or delegating to updateFooterButtonsVisibility().

♻️ Proposed fix
 public void setSourceVisible(boolean visible) {
   codeCB.setValue(visible);
-  codePositionCB.setVisible(visible);
+  codePositionCB.setVisible(visible && currentLayout != null);
 }

@sonarqubecloud
Copy link

@paodb paodb merged commit 2783988 into master Jan 29, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from To Do to Pending release in Flowing Code Addons Jan 29, 2026
@paodb paodb deleted the color-scheme branch January 29, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending release

Development

Successfully merging this pull request may close these issues.

3 participants