Skip to content

Add advanced theme CSS editing with live preview in Initializr#4601

Open
shai-almog wants to merge 1 commit intomasterfrom
codex/add-advanced-theme-mode-with-live-preview
Open

Add advanced theme CSS editing with live preview in Initializr#4601
shai-almog wants to merge 1 commit intomasterfrom
codex/add-advanced-theme-mode-with-live-preview

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Provide an "Advanced Theme Mode" in the Initializr UI so users can edit the CSS that would be generated for their project and see changes immediately in the preview.
  • Reuse existing CSS compilation/runtime plumbing (MutableResource + CSSThemeCompiler) to apply edits into the running preview without requiring a full regenerate.

Description

  • Added a customThemeCss field and an overloaded constructor to ProjectOptions so custom CSS is carried through generation and preview via ProjectOptions.
  • Extended the Initializr UI (createThemeOptionsPanel) with an Advanced Theme Mode checkbox and a TextArea editor for custom CSS, and threaded the advanced CSS into ProjectOptions used for generation/preview.
  • Refactored theme override generation in GeneratorModel into a reusable entry point buildThemeOverrides(ProjectOptions) (and a small buildThemeCss() adapter) so generated zip output and live preview share the same logic and advanced CSS is appended to common/src/main/css/theme.css when present.
  • Implemented live preview application in TemplatePreviewPanel via MutableResource + CSSThemeCompiler by compiling generated CSS into a theme Hashtable and applying it to the preview form with UIManager.addThemeProps, plus restoring defaults before applying changes.
  • Added a unit test validateAdvancedThemeCssGeneration to GeneratorModelMatrixTest that verifies advanced CSS is emitted into common/src/main/css/theme.css in generated zips.

Testing

  • Attempted to run module tests with Java 8 using export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && export PATH="$JAVA_HOME/bin:$PATH" && cd scripts/initializr && mvn -pl common -am test -DskipTests=false, but the build is blocked by environment/bootstrap steps (the CN1 bootstrap expected /root/.codenameone/CodeNameOneBuildClient.jar).
  • A non--am invocation (mvn -pl common test) failed due to missing reactor dependency when not building the dependent modules first, so a full reactor build is required to validate end-to-end.
  • Copied the bundled maven/UpdateCodenameOne.jar into /root/UpdateCodenameOne.jar to bypass the downloader in this environment, which allowed Maven to progress further, but the CN1 plugin still requires /root/.codenameone/CodeNameOneBuildClient.jar and/or network access for full plugin bootstrap; as a result automated tests could not complete successfully here.
  • The new unit test was added to the suite and should pass once the repository is built in an environment that satisfies the CN1 bootstrap requirements and builds the reactor modules together.

Codex Task

@github-actions
Copy link

Cloudflare Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant