[External] : Re: RichTextArea: API Review

Andy Goryachev andy.goryachev at oracle.com
Wed Aug 14 18:09:24 UTC 2024


Dear Nir, everyone:

Thank you for asking these good questions!


1. If these are provided to the user, how difficult is it for them to compose a RTA? JavaFX doesn't provide some somewhat-common controls that you see in various other libraries with the reasoning that the library should give the user the ability to create their own controls (which is not so easy right now). Is RTA an exception, like ColorPicker and DatePicker?

To create a full equivalent of the RTA as implemented in https://bugs.openjdk.org/browse/JDK-8301121 - difficult.

For starters, there are several missing pieces – some do not have public API, and some are just missing.  No public API: focus traversal APIs, text layout information, input map.  Missing – tab stop policy.  My intent is to make all of these available as public API, as well as fix some of the related bugs.  RTA is a complex control, and in that sense it goes beyond the Date/ColorPicker level of complexity, but the general idea is the same (as Robert explained earlier): to give the developers a fully functional control that can be used out of the box, or can serve as a basis for more complex things.


2. Can these building blocks be used to enhance existing controls? For example, to help with TextArea's performance with long texts, or allow rich text-like features in other controls, like the squiggly red line under the text in a TextField?

Some of the builing blocks are already available: for example, rich text can be rendered by using TextFlow set as a graphic on a Label.

Adding a squiggly line or similar decoration to the TextArea might also be possible.

Support for long texts in TextArea... I must say that pretty much nothing in the TextArea is done with long texts in mind.  Redesigning of TextArea for long texts or performance is rather unlikely for obvious reasons (one of which is textProperty).  One have to resort to paragraph-based text model and virtualization to do that, and even then the proposed RichTextArea will struggle with long paragraphs.


3. As also mentioned in the proposal, there are already 3rd party RTAs - RichTextFX and Gluon's. Does the proposed RTA offer more than these (besides the ease of use by being in JavaFX)? Do the building blocks of these offer advantages that the proposed building blocks don't? An abstract test that can be done is to see if these controls can be "retrofitted" with the proposed new building blocks (no need to actually rewrite the code). If not, it could hint to an incompatibility or a limit of the proposal that makes it less appealing.

Robert already addressed this in his earlier response (thank you, Robert!), so let me just reiterate one point: the proposed RTA is simpler than RichTextFX offering.  Simpler to use, and simpler in terms of supported features – does not offer tables, for instance.  There are still use cases which RTA won’t be able to address, and for which an external library is still needed.

Thanks again for good questions.  Did I provide good answers?

-andy




From: Nir Lisker <nlisker at gmail.com>
Date: Wednesday, August 14, 2024 at 05:04
To: Andy Goryachev <andy.goryachev at oracle.com>
Cc: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: [External] : Re: RichTextArea: API Review
My questions are similar to the ones in the previous discussion, but now I can be more specific.

I see a list of "building blocks" in https://bugs.openjdk.org/browse/JDK-8300569, which I like. Specifically, two types of building blocks additions are important as I see it: rich text-specific ones like document models and a way to add decorations/colors etc., and the split of controls in general into skin/input/behavior (on which there has been a long discussion). My questions are:

1. If these are provided to the user, how difficult is it for them to compose a RTA? JavaFX doesn't provide some somewhat-common controls that you see in various other libraries with the reasoning that the library should give the user the ability to create their own controls (which is not so easy right now). Is RTA an exception, like ColorPicker and DatePicker?
2. Can these building blocks be used to enhance existing controls? For example, to help with TextArea's performance with long texts, or allow rich text-like features in other controls, like the squiggly red line under the text in a TextField?
3. As also mentioned in the proposal, there are already 3rd party RTAs - RichTextFX and Gluon's. Does the proposed RTA offer more than these (besides the ease of use by being in JavaFX)? Do the building blocks of these offer advantages that the proposed building blocks don't? An abstract test that can be done is to see if these controls can be "retrofitted" with the proposed new building blocks (no need to actually rewrite the code). If not, it could hint to an incompatibility or a limit of the proposal that makes it less appealing.

Thanks,
Nir


On Fri, Aug 2, 2024 at 10:41 PM Andy Goryachev <andy.goryachev at oracle.com<mailto:andy.goryachev at oracle.com>> wrote:

Dear fellow developers:



Thank you for the early feedback on the RichTextArea proposal [0].



We are moving to the next phase by submitting the public pull request [1].  The main goal is to include the new control in an incubating module [8], hopefully in jfx24, as a means of putting non-final API in the hands of developers while the API and implementation progress towards either finalization or removal in a future release.



For your convenience, two test applications are provided - RichTextAreaDemoApp and CodeAreaDemoApp which demonstrate the new controls with a number of different models.  In addition to these two testers, please check out a simple standalone rich text editor application, RichEditorDemoApp,



We would encourage anyone - the javafx developers, and especially the application developers, to take a look at the public API [3].  It's probably less important at this stage to do a deep code review of the implementation, but we would certainly appreciate and welcome your code review comments.



Thank you in advance,

-andy





[0] Proposal: https://github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextArea.md<https://urldefense.com/v3/__https:/github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextArea.md__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9t4274lJ$>

[1] Pull request: https://github.com/openjdk/jfx/pull/1524<https://urldefense.com/v3/__https:/github.com/openjdk/jfx/pull/1524__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9gf9BYIK$>

[2] Discussion points: https://github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextAreaDiscussion.md<https://urldefense.com/v3/__https:/github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextAreaDiscussion.md__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9nUSujTl$>

[3] API specification (javadoc): https://cr.openjdk.org/~angorya/RichTextArea/javadoc

[4] CSS Reference: https://cr.openjdk.org/~angorya/RichTextArea/javadoc/javafx.graphics/javafx/scene/doc-files/cssref.html

[5] Behavior doc: https://github.com/andy-goryachev-oracle/jfx/blob/8301121.RichTextArea/doc-files/behavior/RichTextAreaBehavior.md<https://urldefense.com/v3/__https:/github.com/andy-goryachev-oracle/jfx/blob/8301121.RichTextArea/doc-files/behavior/RichTextAreaBehavior.md__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9pq__cpG$>

[6] RichTextArea RFE: https://bugs.openjdk.org/browse/JDK-8301121

[7] Previous (now obsolete) draft pull request: https://github.com/openjdk/jfx/pull/1374<https://urldefense.com/v3/__https:/github.com/openjdk/jfx/pull/1374__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9v4KgU9J$>

[8] Incubator module JEP: https://github.com/kevinrushforth/jfx/blob/javafx.incubator/INCUBATOR-MODULES.md<https://urldefense.com/v3/__https:/github.com/kevinrushforth/jfx/blob/javafx.incubator/INCUBATOR-MODULES.md__;!!ACWV5N9M2RV99hQ!ObEX8HGQdm3Luimk7A9mRrJzS0gFeKC4Ys9K2gFkf9Sy_MN_X0OtuWziJDW3btm8gyihirZMlkJO9pjE-pZ5$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240814/60116fb6/attachment-0001.htm>


More information about the openjfx-dev mailing list