RFR: 8301121: RichTextArea Control (Incubator) [v3]

Robert Lichtenberger rlichten at openjdk.org
Mon Aug 19 05:03:55 UTC 2024


On Wed, 14 Aug 2024 18:26:03 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/model/BasicTextModel.java line 198:
>> 
>>> 196:      */
>>> 197:     public static class InMemoryContent implements Content {
>>> 198:         private final ArrayList<String> paragraphs = new ArrayList<>();
>> 
>> Since paragraphs may be inserted anywhere, I would guess that using a LinkedList should be more efficient here. Otherwise, when adding a line break somewhere in the middle of a long text, a lot of array members must be copied.
>
> You are right, but this is just a default implementation.  you can still implement your own `BasicTextModel.Content` and pass it to the constructor.
> 
> Do you want to see an in-memory implementation optimized for large number of paragraphs or should it better be left up to the app developers?

Yes, we should definitely provide a very efficient implementation, because most app developers will not want to change it. We should definitely avoid another "TextArea situation", where the application breaks apart, if the text grows too big.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1524#discussion_r1721215337


More information about the openjfx-dev mailing list