Skip to content

Add first-class Sheet title component customization#4709

Merged
liannacasper merged 3 commits intomasterfrom
codex/improve-title-area-customization-for-sheet
Apr 6, 2026
Merged

Add first-class Sheet title component customization#4709
liannacasper merged 3 commits intomasterfrom
codex/improve-title-area-customization-for-sheet

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a supported API for customizing the center area of a Sheet title bar (e.g. an image above the title) instead of relying on fragile parent traversal hacks.
  • Preserve the existing default title label so callers can set text via API even when a custom component is installed.

Description

  • Added titleComponent and titleComponentContainer members to Sheet and refactored the title bar center to use the dedicated container instead of FlowLayout.encloseCenterMiddle(title).
  • Added public APIs: getTitle(), setTitle(String), getTitleComponent(), and setTitleComponent(Component) that allow installing, querying, and restoring the default title label.
  • Updated the title spacing logic in show() to apply margins to the titleComponentContainer so custom components are laid out correctly and title/back/commands do not overlap.
  • Added a core unit test SheetTest.titleComponentCanBeCustomized and updated scripts/hellocodenameone screenshot test SheetScreenshotTest to exercise an icon-over-title custom component.

Testing

  • Ran the core unit tests for the modified class with: cd maven && mvn -pl core-unittests -am -DunitTests=true -Dmaven.javadoc.skip=true -DfailIfNoTests=false -Dtest=SheetTest test, and the SheetTest suite passed (4 tests run, 0 failures).
  • Attempted to run the hellocodenameone screenshot test with: cd scripts/hellocodenameone && mvn -pl common -Dtest=SheetScreenshotTest -DfailIfNoTests=false test, but it failed in this environment because the com.codenameone:codenameone-maven-plugin:8.0-SNAPSHOT plugin/artifact is not available locally.
  • Tried to follow the project Java 8 test recommendation by setting JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64, but that path did not exist in this container so the JVM selection step could not be completed here (tests were still executed with the available JVM and the core unit tests passed).

Codex Task

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 6, 2026

Compared 35 screenshots: 35 matched.

Native Android coverage

  • 📊 Line coverage: 7.75% (3962/51104 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.12% (19647/321171), branch 2.88% (898/31161), complexity 3.62% (1079/29819), method 6.38% (887/13907), class 10.56% (195/1847)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 7.75% (3962/51104 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.12% (19647/321171), branch 2.88% (898/31161), complexity 3.62% (1079/29819), method 6.38% (887/13907), class 10.56% (195/1847)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 6, 2026

iOS screenshot updates

Compared 35 screenshots: 34 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 149 seconds

Detailed Performance Metrics

Metric Duration
Simulator Boot 1000 ms
Simulator Boot (Run) 1000 ms
App Install 5000 ms
App Launch 4000 ms
Test Execution 179000 ms

Signed-off-by: liannacasper <67953602+liannacasper@users.noreply.github.com>
Signed-off-by: liannacasper <67953602+liannacasper@users.noreply.github.com>
@liannacasper liannacasper linked an issue Apr 6, 2026 that may be closed by this pull request
@liannacasper liannacasper merged commit a5d0ad5 into master Apr 6, 2026
18 of 19 checks passed
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.

RFE: add setTitleComponent method to Sheet

2 participants