From 750f9f16ad83fe741f086ef5b857c2f5ba3b9b20 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 16 Sep 2026 22:07:42 +0200 Subject: [PATCH 1/5] Migrate to javafx 27 and update fix gradle depcreation --- .codegraph/.gitignore | 5 +++++ build.gradle.kts | 6 +++--- .../java/org/jabref/htmltonode/rich/RichTextRenderer.java | 6 +++--- .../java/org/jabref/htmltonode/HtmlRichTextAreaTest.java | 6 ++++++ .../java/org/jabref/htmltonode/RichTextAreaSpikeTest.java | 4 ++-- .../java/org/jabref/htmltonode/RichTextRendererTest.java | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 .codegraph/.gitignore diff --git a/.codegraph/.gitignore b/.codegraph/.gitignore new file mode 100644 index 0000000..d20c0fe --- /dev/null +++ b/.codegraph/.gitignore @@ -0,0 +1,5 @@ +# CodeGraph data files — local to each machine, not for committing. +# Ignore everything in .codegraph/ except this file itself, so transient +# files (the database, daemon.pid, sockets, logs) never show up in git. +* +!.gitignore diff --git a/build.gradle.kts b/build.gradle.kts index 7779dbd..9914411 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { group = "org.jabref" // -PversionSuffix=PR17 turns 0.3.0-SNAPSHOT into 0.3.0-PR17-SNAPSHOT, so a pull request // snapshot is identifiable and does not clobber the one built from main -version = "0.3.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" +version = "1.0.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" repositories { mavenCentral() @@ -29,7 +29,7 @@ tasks.withType().configureEach { } // JavaFX artifacts are platform-specific; consumers provide their own JavaFX (hence compileOnly) -val javafxVersion = "26.0.1" +val javafxVersion = "27" val jfxPlatform = run { val osName = System.getProperty("os.name").lowercase() val arch = System.getProperty("os.arch").lowercase() @@ -136,7 +136,7 @@ tasks.test { } // Tests of the RichTextArea renderer need the JavaFX toolkit: a display or xvfb-run -val guiTest by tasks.registering(Test::class) { +val guiTest = tasks.register("guiTest") { description = "Runs tests requiring the JavaFX toolkit (tag 'gui'); needs a display or xvfb-run" group = "verification" testClassesDirs = sourceSets.test.get().output.classesDirs diff --git a/src/main/java/org/jabref/htmltonode/rich/RichTextRenderer.java b/src/main/java/org/jabref/htmltonode/rich/RichTextRenderer.java index e0a84de..de1bbe1 100644 --- a/src/main/java/org/jabref/htmltonode/rich/RichTextRenderer.java +++ b/src/main/java/org/jabref/htmltonode/rich/RichTextRenderer.java @@ -34,7 +34,7 @@ public final class RichTextRenderer { /// Character attribute carrying a link target; resolved on mouse click. - public static final StyleAttribute HREF = new StyleAttribute<>("HREF", String.class, false); + public static final StyleAttribute HREF = StyleAttribute.character("HREF", String.class); /// Fallback link color; matches FxRenderer's un-themed link fill. private static final Color LINK_COLOR = Color.web("#0b66c3"); @@ -98,7 +98,7 @@ public static void configure(RichTextArea area, HtmlRenderOptions options) { if (position != null) { // Node segments (embedded images, tables) carry no character attributes, so the // model returns null there — only text runs can hold an HREF. - StyleAttributeMap attributes = area.getModel().getStyleAttributeMap(null, position); + StyleAttributeMap attributes = area.getStyleAttributeMap(position, false); String href = attributes != null ? attributes.get(HREF) : null; if (href != null) { options.linkHandler().accept(href); @@ -114,7 +114,7 @@ public static void configure(RichTextArea area, HtmlRenderOptions options) { /// returns a null attribute map there — only text runs can hold an [#HREF]. Clicking an /// image therefore lands on a null map, which this method tolerates. public static @Nullable String hrefAt(StyledTextModel model, TextPos position) { - StyleAttributeMap attributes = model.getStyleAttributeMap(null, position); + StyleAttributeMap attributes = model.getStyleAttributeMap(null, position, false); return attributes != null ? attributes.get(HREF) : null; } diff --git a/src/test/java/org/jabref/htmltonode/HtmlRichTextAreaTest.java b/src/test/java/org/jabref/htmltonode/HtmlRichTextAreaTest.java index b992bc1..b89b68b 100644 --- a/src/test/java/org/jabref/htmltonode/HtmlRichTextAreaTest.java +++ b/src/test/java/org/jabref/htmltonode/HtmlRichTextAreaTest.java @@ -11,6 +11,7 @@ import org.jabref.htmltonode.rich.HtmlRichTextArea; import org.jabref.htmltonode.rich.RichTextRenderer; +import jfx.incubator.scene.control.richtext.model.StyleAttribute; import jfx.incubator.scene.control.richtext.model.StyleAttributeMap; import jfx.incubator.scene.control.richtext.skin.CellContext; import org.junit.jupiter.api.BeforeAll; @@ -62,6 +63,11 @@ public StyleAttributeMap getAttributes() { return StyleAttributeMap.builder().build(); } + @Override + public void decorateRun(StyleAttribute attribute, RunDecor type, String styleName) { + // Decorations are not involved in the cursor-style handler under test. + } + String style() { return style.toString(); } diff --git a/src/test/java/org/jabref/htmltonode/RichTextAreaSpikeTest.java b/src/test/java/org/jabref/htmltonode/RichTextAreaSpikeTest.java index 848a4d9..9a3633c 100644 --- a/src/test/java/org/jabref/htmltonode/RichTextAreaSpikeTest.java +++ b/src/test/java/org/jabref/htmltonode/RichTextAreaSpikeTest.java @@ -29,7 +29,7 @@ @Tag("gui") class RichTextAreaSpikeTest { - private static final StyleAttribute HREF = new StyleAttribute<>("HREF", String.class, false); + private static final StyleAttribute HREF = StyleAttribute.character("HREF", String.class); @BeforeAll static void startToolkit() throws InterruptedException { @@ -83,7 +83,7 @@ void styledModelCarriesSegmentsHighlightsAndCustomAttributes() { assertEquals("Kopp, O.: Some Paper", model.getPlainText(0)); assertEquals("doi.org/10.1/x", model.getPlainText(1)); - StyleAttributeMap linkAttrs = model.getStyleAttributeMap(null, jfx.incubator.scene.control.richtext.TextPos.ofLeading(1, 3)); + StyleAttributeMap linkAttrs = model.getStyleAttributeMap(null, jfx.incubator.scene.control.richtext.TextPos.ofLeading(1, 3), false); assertEquals("https://doi.org/10.1/x", linkAttrs.get(HREF)); assertEquals(Boolean.TRUE, linkAttrs.get(StyleAttributeMap.UNDERLINE)); } diff --git a/src/test/java/org/jabref/htmltonode/RichTextRendererTest.java b/src/test/java/org/jabref/htmltonode/RichTextRendererTest.java index b75c79d..e6f350d 100644 --- a/src/test/java/org/jabref/htmltonode/RichTextRendererTest.java +++ b/src/test/java/org/jabref/htmltonode/RichTextRendererTest.java @@ -27,7 +27,7 @@ private static StyledTextModel model(String html) { } private static StyleAttributeMap attributesAt(StyledTextModel model, int paragraph, int offset) { - return model.getStyleAttributeMap(null, TextPos.ofLeading(paragraph, offset)); + return model.getStyleAttributeMap(null, TextPos.ofLeading(paragraph, offset), false); } @Test From aa7a84e578eb63c6e8ee95846720d1e5a9bb317a Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 16 Sep 2026 22:28:19 +0200 Subject: [PATCH 2/5] udpate readme and baseline --- CHANGELOG.md | 5 +++++ README.md | 9 +++++---- build.gradle.kts | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 646e79c..c747721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Migrated the RichTextArea renderer to the JavaFX 27 incubator APIs. +- Baseline for JavaFX is jdk25 and thus this project now requires Java 25. + ## [0.2.0] - 2026-07-22 ### Added diff --git a/README.md b/README.md index b1bcf80..9833107 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # html-to-node + [![APIdia](https://apidia.net/mvn/org.jabref/html-to-node/badge.svg)](https://apidia.net/mvn/org.jabref/html-to-node) A JavaFX library that renders HTML as plain scene-graph nodes (`TextFlow`, `Text`, `ImageView`), @@ -13,8 +14,8 @@ markup. ## Requirements -- Java 24 or later -- JavaFX 26 or later, provided by the consuming application: `javafx.base`, `javafx.graphics`, +- Java 25 or later +- JavaFX 27 or later, provided by the consuming application: `javafx.base`, `javafx.graphics`, and — for the RichTextArea renderer — `javafx.controls`, `jfx.incubator.input`, and `jfx.incubator.richtext` @@ -30,7 +31,7 @@ Released versions are available from [Maven Central](https://central.sonatype.co ```kotlin dependencies { - implementation("org.jabref:html-to-node:0.2.0") + implementation("org.jabref:html-to-node:1.0.0") } ``` @@ -58,7 +59,7 @@ repositories { } dependencies { - implementation("org.jabref:html-to-node:0.3.0-SNAPSHOT") + implementation("org.jabref:html-to-node:1.0.0-SNAPSHOT") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9914411..9435207 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "org.jabref" -// -PversionSuffix=PR17 turns 0.3.0-SNAPSHOT into 0.3.0-PR17-SNAPSHOT, so a pull request +// -PversionSuffix=PR17 turns 1.0.0-SNAPSHOT into 1.0.0-PR17-SNAPSHOT, so a pull request // snapshot is identifiable and does not clobber the one built from main version = "1.0.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" @@ -23,8 +23,8 @@ java { } tasks.withType().configureEach { - // JavaFX 26 ships Java-24 class files; 24 keeps the library usable one release below JabRef's 25 - options.release = 24 + // JavaFX 27 baseline is now jdk 25 + options.release = 25 options.encoding = "UTF-8" } From 7b850b0d43d45c514582adac52272326bd9efceb Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 16 Sep 2026 23:30:01 +0200 Subject: [PATCH 3/5] 0.4.0 --- README.md | 4 ++-- build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9833107..26f146f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Released versions are available from [Maven Central](https://central.sonatype.co ```kotlin dependencies { - implementation("org.jabref:html-to-node:1.0.0") + implementation("org.jabref:html-to-node:0.4.0") } ``` @@ -59,7 +59,7 @@ repositories { } dependencies { - implementation("org.jabref:html-to-node:1.0.0-SNAPSHOT") + implementation("org.jabref:html-to-node:0.4.0-SNAPSHOT") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9435207..b7f0312 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { group = "org.jabref" // -PversionSuffix=PR17 turns 1.0.0-SNAPSHOT into 1.0.0-PR17-SNAPSHOT, so a pull request // snapshot is identifiable and does not clobber the one built from main -version = "1.0.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" +version = "0.4.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" repositories { mavenCentral() From 926bac30cf02252539b5a0b57ed21ca159def2d0 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 17 Sep 2026 20:18:47 +0200 Subject: [PATCH 4/5] correct version to 0.3.0 --- CHANGELOG.md | 3 +++ README.md | 4 ++-- build.gradle.kts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c747721..bbebfd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### [0.3.0] - 2026-09-17 + ### Changed - Migrated the RichTextArea renderer to the JavaFX 27 incubator APIs. @@ -30,5 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The module is null-marked with [JSpecify](https://jspecify.dev/) annotations. [Unreleased]: https://github.com/JabRef/html-to-node/compare/v0.2.0...HEAD +[0.3.0]: https://github.com/JabRef/html-to-node/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/JabRef/html-to-node/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/JabRef/html-to-node/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 26f146f..847b7ad 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Released versions are available from [Maven Central](https://central.sonatype.co ```kotlin dependencies { - implementation("org.jabref:html-to-node:0.4.0") + implementation("org.jabref:html-to-node:0.3.0") } ``` @@ -59,7 +59,7 @@ repositories { } dependencies { - implementation("org.jabref:html-to-node:0.4.0-SNAPSHOT") + implementation("org.jabref:html-to-node:0.3.0-SNAPSHOT") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index b7f0312..5c38774 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { group = "org.jabref" // -PversionSuffix=PR17 turns 1.0.0-SNAPSHOT into 1.0.0-PR17-SNAPSHOT, so a pull request // snapshot is identifiable and does not clobber the one built from main -version = "0.4.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" +version = "0.3.0" + (findProperty("versionSuffix")?.let { "-$it" } ?: "") + "-SNAPSHOT" repositories { mavenCentral() From 8031592403a5af7febe5d14a1651132c7eaecad9 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 17 Sep 2026 20:20:47 +0200 Subject: [PATCH 5/5] revert --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbebfd3..c747721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### [0.3.0] - 2026-09-17 - ### Changed - Migrated the RichTextArea renderer to the JavaFX 27 incubator APIs. @@ -32,6 +30,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The module is null-marked with [JSpecify](https://jspecify.dev/) annotations. [Unreleased]: https://github.com/JabRef/html-to-node/compare/v0.2.0...HEAD -[0.3.0]: https://github.com/JabRef/html-to-node/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/JabRef/html-to-node/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/JabRef/html-to-node/releases/tag/v0.1.0