RFR: 8371070: RichParagraph enhancements [v8]
Kevin Rushforth
kcr at openjdk.org
Mon Dec 22 21:54:23 UTC 2025
On Wed, 10 Dec 2025 18:33:45 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> This PR addresses the user feedback:
>>
>> In RichParagraph you have a note to make getSegments() public. It would be helpful if it was.
>>
>>
>> The problem being solved here is to allow the developers to easily add functionality to the existing `RichTextModel` (and its storage implementation) without creating a new model from scratch.
>>
>> This is done in two parts:
>>
>> 1. Allowing the custom model to alter the paragraph by giving access to its Builder via a new protected method
>>
>>
>> protected RichParagraph.Builder buildParagraph(int index)
>>
>>
>> 2. Adding two methods that give access to the segments in the `RichParagraph` and `RichParagraph.Builder` classes:
>>
>> - getSegmentCount()
>> - getSegment(int index)
>>
>> NOTE: Even though returning an (immutable) List might be considered "more useful", doing so would necessitate creating a copy - something I do want to avoid.
>
> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
>
> - javadoc
> - cleanup
> - Merge branch 'master' into 8366198.rbuilder
> - rich paragraph builder api
> - Merge branch 'master' into 8371070.enhance
> - npe
> - merge
> - Merge branch 'master' into 8371070.enhance
> - Merge branch 'master' into 8371070.enhance
> - Merge branch 'master' into 8371070.enhance
> - ... and 2 more: https://git.openjdk.org/jfx/compare/03612e1b...05136fe1
New API looks fine with a question about the name of the method that returns the builder.
modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/model/RichTextModel.java line 94:
> 92: * @since 26
> 93: */
> 94: protected RichParagraph.Builder buildParagraph(int index) {
The name `buildParagraph` implies that this method build something, but it actually returns a builder. Perhaps `paragraphBuilder` would be a better method name?
modules/jfx.incubator.richtext/src/shims/java/jfx/incubator/scene/control/richtext/model/RichTextModelShim.java line 29:
> 27:
> 28: public class RichTextModelShim {
> 29: //
Are you leaving this class as a placeholder or do you have plans to put something here in the near future? Either way, I suppose there's no real harm in leaving it.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1966#pullrequestreview-3605857868
PR Review Comment: https://git.openjdk.org/jfx/pull/1966#discussion_r2641340327
PR Review Comment: https://git.openjdk.org/jfx/pull/1966#discussion_r2641345795
More information about the openjfx-dev
mailing list