jfx
jfx copied to clipboard
8355774: RichTextArea: provide mechanism for CSS styling of highlights
Adding missing APIs related to styling the highlights with CSS:
Adds methods to the RichParagraph.Builder:
/**
* Adds a wavy underline (typically used as a spell checker indicator) with the specified style name(s).
* <p>
* The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
*
* @param start the start offset
* @param length the end offset
* @param css the style name(s)
* @return this {@code Builder} instance
* @since 25
*/
public Builder addWavyUnderline(int start, int length, String ... css) {
/**
* Adds a highlight with the specified style name(s).
* Use translucent colors to enable multiple highlights in the same region of text.
* <p>
* The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
*
* @param start the start offset
* @param length the end offset
* @param css the style name(s)
* @return this {@code Builder} instance
* @since 25
*/
public Builder addHighlight(int start, int length, String ... css) {
Also adding similar methods to the SimpleViewOnlyStyledModel class:
/**
* Adds a highlight of the given color to the specified range within the last paragraph,
* with the specified style name(s).
*
* @param start the start offset
* @param length the length of the highlight
* @param css the highlight style name(s)
* @return this model instance
* @since 25
*/
public SimpleViewOnlyStyledModel highlight(int start, int length, String ... css) {
/**
* Adds a wavy underline (typically used as a spell checker indicator)
* to the specified range within the last paragraph, with the specified style name(s).
*
* @param start the start offset
* @param length the length of the highlight
* @param css the highlight style name(s)
* @return this model instance
* @since 25
*/
public SimpleViewOnlyStyledModel addWavyUnderline(int start, int length, String ... css) {
/reviewers 2 /csr
Progress
- [ ] Change requires a CSR request matching fixVersion jfx25 to be approved (needs to be created)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)
Issue
- JDK-8355774: RichTextArea: provide mechanism for CSS styling of highlights (Enhancement - P4)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1802/head:pull/1802
$ git checkout pull/1802
Update a local copy of the PR:
$ git checkout pull/1802
$ git pull https://git.openjdk.org/jfx.git pull/1802/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1802
View PR using the GUI difftool:
$ git pr show -t 1802
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1802.diff
Using Webrev
:wave: Welcome back angorya! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@andy-goryachev-oracle This change now passes all automated pre-integration checks.
ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.
After integration, the commit message for the final commit will be:
8355774: RichTextArea: provide mechanism for CSS styling of highlights
Reviewed-by: kcr, lkostyra
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.
At the time when this comment was updated there had been 11 new commits pushed to the master branch:
- 2dd90265637dc1c17fa4f5ab36500564b19ce082: 8361379: [macos] Refactor accessibility code to retrieve attribute by name
- 99866ae1f197ae5593b728bedceb00121fe4baca: 8141391: Manual JFXPanel DnD test doesn't work
- 1a2a50b593a1abcb767a3c6b0287996bdfb26973: 8362095: HeaderButtonMetrics should not be used across toolkit boundary
- ... and 8 more: https://git.openjdk.org/jfx/compare/0270847b85ab6d4701abb201ec4b2aeee96129dd...master
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.
@andy-goryachev-oracle The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).
@andy-goryachev-oracle has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@andy-goryachev-oracle please create a CSR request for issue JDK-8355774 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.
Mailing list message from PavelTurk on openjfx-dev:
I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
Mailing list message from Andy Goryachev on openjfx-dev:
Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote: -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250508/47480c84/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { ??? -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { ??? -fx-fill: orange; ??? -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel
On 5/8/25 21:25, Andy Goryachev wrote:
Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean.? We are not adding methods to "style individual properties".? We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Thursday, May 8, 2025 at 11:04 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250508/9adee6b5/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250508/578740c4/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel
On 5/8/25 22:21, Andy Goryachev wrote:
Oh, I finally get it what you want.? Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text).? My first question is - what are the additional properties, beside the background-color?? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Thursday, May 8, 2025 at 11:44 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { ??? -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { ??? -fx-fill: orange; ??? -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel
On 5/8/25 21:25, Andy Goryachev wrote:
Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\.\? We are not adding methods to \"style individual properties\"\.\? We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250508/9a0669ee/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
The only property that makes sense is the background color. The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images. The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 13:13 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel On 5/8/25 22:21, Andy Goryachev wrote: Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250508/a422e24d/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel
On 5/9/25 00:09, Andy Goryachev wrote:
The only property that makes sense is the background color.? The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images.? The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Thursday, May 8, 2025 at 13:13 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel
On 5/8/25 22:21, Andy Goryachev wrote:
Oh\, I finally get it what you want\.\? Thanks\! What you asking is effectively to add support for some additional properties to the class that renders the text segment \(currently\, Text\)\.\? My first question is \- what are the additional properties\, beside the background\-color\?\? If it\'s only the background color\, it\'s probably easy to add\. Anything beyond that\, such as equivalent of full \-fx\-region\-background or \-fx\-region\-border\, would be extremely unlikely\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:44 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you for your reply\. I have already provided some examples\, but I\?ll give one more very simple example that clearly illustrates the problem\. I have a library that uses JFX CodeArea\. Naturally\, all styles are stored in a CSS file\. Users of this library can customize how the code is displayed by modifying the styles in the CSS file\. Let\?s take the search feature as an example\. In the CSS file\, there is a class\: \.search\-match \{ \?\?\? \-fx\-background\-color\: orange\; \} But the user wants to change not the background color\, but the foreground color and font weight\. So they write\: \.search\-match \{ \?\?\? \-fx\-fill\: orange\; \?\?\? \-fx\-font\-weight\: bold\; \} And this should work\. If it doesn\?t\, then it\?s no longer CSS\-based styling\. If\, for some reason\, the \-fx\-background\-color property cannot be used\, an alternative property can be introduced\, such as \-fx\-highlight\-color\. However\, everything else in the example should work as described\. Best regards\, Pavel On 5\/8\/25 21\:25\, Andy Goryachev wrote\: Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\. We are not adding methods to \"style individual properties\"\.\? We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250509/3e43b9e2/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
Pavel:
Underlines and strike-through attributes are available via StyleAttributeMap.STRIKE_THROUGH and StyleAttributeMap.UNDERLINE (using text color). On the other hand, adding this functionality via addHighlight() would allow the application to style the shapes via CSS.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 22:18 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel On 5/9/25 00:09, Andy Goryachev wrote: The only property that makes sense is the background color. The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images. The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 13:13 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel On 5/8/25 22:21, Andy Goryachev wrote: Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/d160f46a/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Andy, thank you very much for your response. But as I?ve said many times, I?m only considering styling through a CSS file.
Best regards, Pavel
On 5/12/25 19:28, Andy Goryachev wrote:
Pavel:
Underlines and strike-through attributes are available via StyleAttributeMap.STRIKE_THROUGH and StyleAttributeMap.UNDERLINE (using text color).? On the other hand, adding this functionality via addHighlight() would allow the application to style the shapes via CSS.
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Thursday, May 8, 2025 at 22:18 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel
On 5/9/25 00:09, Andy Goryachev wrote:
The only property that makes sense is the background color\.\? The wavy and other kinds of underlines\, while they make some sense in the context of the CodeArea\, would fail in general in the context of RichTextArea where the content may include nodes and images\.\? The highlights were designed specifically for the case to highlight the content range regardless of what is in it\. I\'ve reopened https\:\/\/bugs\.openjdk\.org\/browse\/JDK\-8356436 for the background color\. Thank you for your patience and good suggestions\! \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 13\:13 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Since we\?re talking about code styling\, I would highlight the following as the main properties\: \- foreground color \(\+\) \- background color \(\-\) \- font \(weight\, italic\, size\, name\) \(\+\) \- underline \(e\.g\. for links\) \(\?\) \- wavy underline \(e\.g\. for spelling\) \(\-\) I think these properties cover 99\% of all the necessary properties for CodeArea\. I used \+ and \- to show what has already been implemented\. Best regards\, Pavel On 5\/8\/25 22\:21\, Andy Goryachev wrote\: Oh\, I finally get it what you want\.\? Thanks\! What you asking is effectively to add support for some additional properties to the class that renders the text segment \(currently\, Text\)\.\? My first question is \- what are the additional properties\, beside the background\-color\?\? If it\'s only the background color\, it\'s probably easy to add\. Anything beyond that\, such as equivalent of full \-fx\-region\-background or \-fx\-region\-border\, would be extremely unlikely\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:44 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you for your reply\. I have already provided some examples\, but I\?ll give one more very simple example that clearly illustrates the problem\. I have a library that uses JFX CodeArea\. Naturally\, all styles are stored in a CSS file\. Users of this library can customize how the code is displayed by modifying the styles in the CSS file\. Let\?s take the search feature as an example\. In the CSS file\, there is a class\: \.search\-match \{ \?\?\? \-fx\-background\-color\: orange\; \} But the user wants to change not the background color\, but the foreground color and font weight\. So they write\: \.search\-match \{ \?\?\? \-fx\-fill\: orange\; \?\?\? \-fx\-font\-weight\: bold\; \} And this should work\. If it doesn\?t\, then it\?s no longer CSS\-based styling\. If\, for some reason\, the \-fx\-background\-color property cannot be used\, an alternative property can be introduced\, such as \-fx\-highlight\-color\. However\, everything else in the example should work as described\. Best regards\, Pavel On 5\/8\/25 21\:25\, Andy Goryachev wrote\: Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\. We are not adding methods to \"style individual properties\"\.\? We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/c5695c2d/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
Yes, I know. But we must support both options, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet. Our goal is to provide the tools that can be used equally well in either situation. "The most frequent operations must be easy, all other must be possible".
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 09:34 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you very much for your response. But as I?ve said many times, I?m only considering styling through a CSS file.
Best regards, Pavel
On 5/12/25 19:28, Andy Goryachev wrote:
Pavel:
Underlines and strike-through attributes are available via StyleAttributeMap.STRIKE_THROUGH and StyleAttributeMap.UNDERLINE (using text color). On the other hand, adding this functionality via addHighlight() would allow the application to style the shapes via CSS.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 22:18 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel On 5/9/25 00:09, Andy Goryachev wrote: The only property that makes sense is the background color. The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images. The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 13:13 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel On 5/8/25 22:21, Andy Goryachev wrote: Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/3005862f/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Thank you very much for the detailed explanation. Am I right in understanding that JDK-8355774 does not consider the possibility of styling underline/wavy underline via a CSS file (without calling special methods like addHighlight, addWavyUnderline?
If so, should I open another issue?
Best regards, Pavel
On 5/12/25 19:41, Andy Goryachev wrote:
Yes, I know.? But we must support both options, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet.? Our goal is to provide the tools that can be used equally well in either situation.? "The most frequent operations must be easy, all other must be possible".
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Monday, May 12, 2025 at 09:34 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Andy, thank you very much for your response. But as I?ve said many times, I?m only considering styling through a CSS file.
Best regards, Pavel
On 5/12/25 19:28, Andy Goryachev wrote:
Pavel\: Underlines and strike\-through attributes are available via StyleAttributeMap\.STRIKE\_THROUGH and StyleAttributeMap\.UNDERLINE \(using text color\)\. On the other hand\, adding this functionality via addHighlight\(\) would allow the application to style the shapes via CSS\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 22\:18 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, I\'m really glad we figured out the background\-color issue\, and I\'m also very grateful to you\! Regarding wavy lines and other types of underlining \? in my previous message\, I listed the key attributes that are essential for a modern CodeArea\. For example\, underline for links \? I don\'t think it\'s necessary to write that the internet is extremely popular today and that links in code are common practice\, and so on\. Of course\, all of these properties should be set via a CSS file\, since that\'s the most efficient way to use CSS \? when styling is completely separated from logic\. So\, the list contains five properties\. If two of them are not supported\, that means \(to me\) that only 60\% of the core properties are supported\. That\'s just my feedback \? the decision is\, of course\, yours \:\) Best regards\, Pavel On 5\/9\/25 00\:09\, Andy Goryachev wrote\: The only property that makes sense is the background color\.\? The wavy and other kinds of underlines\, while they make some sense in the context of the CodeArea\, would fail in general in the context of RichTextArea where the content may include nodes and images\. The highlights were designed specifically for the case to highlight the content range regardless of what is in it\. I\'ve reopened https\:\/\/bugs\.openjdk\.org\/browse\/JDK\-8356436 for the background color\. Thank you for your patience and good suggestions\! \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 13\:13 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Since we\?re talking about code styling\, I would highlight the following as the main properties\: \- foreground color \(\+\) \- background color \(\-\) \- font \(weight\, italic\, size\, name\) \(\+\) \- underline \(e\.g\. for links\) \(\?\) \- wavy underline \(e\.g\. for spelling\) \(\-\) I think these properties cover 99\% of all the necessary properties for CodeArea\. I used \+ and \- to show what has already been implemented\. Best regards\, Pavel On 5\/8\/25 22\:21\, Andy Goryachev wrote\: Oh\, I finally get it what you want\.\? Thanks\! What you asking is effectively to add support for some additional properties to the class that renders the text segment \(currently\, Text\)\.\? My first question is \- what are the additional properties\, beside the background\-color\? If it\'s only the background color\, it\'s probably easy to add\. Anything beyond that\, such as equivalent of full \-fx\-region\-background or \-fx\-region\-border\, would be extremely unlikely\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:44 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you for your reply\. I have already provided some examples\, but I\?ll give one more very simple example that clearly illustrates the problem\. I have a library that uses JFX CodeArea\. Naturally\, all styles are stored in a CSS file\. Users of this library can customize how the code is displayed by modifying the styles in the CSS file\. Let\?s take the search feature as an example\. In the CSS file\, there is a class\: \.search\-match \{ \-fx\-background\-color\: orange\; \} But the user wants to change not the background color\, but the foreground color and font weight\. So they write\: \.search\-match \{ \?\?\? \-fx\-fill\: orange\; \?\?\? \-fx\-font\-weight\: bold\; \} And this should work\. If it doesn\?t\, then it\?s no longer CSS\-based styling\. If\, for some reason\, the \-fx\-background\-color property cannot be used\, an alternative property can be introduced\, such as \-fx\-highlight\-color\. However\, everything else in the example should work as described\. Best regards\, Pavel On 5\/8\/25 21\:25\, Andy Goryachev wrote\: Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\.\? We are not adding methods to \"style individual properties\"\.\? We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/f7e98dac/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
JDK-8355774 adds methods to style highlights added via addHighlight() with CSS.
What (I think) you want is an ability to style a single text segment with (background | underlines | etc) attributes, which is still debatable - because you already can do all that, albeit with some additional code. The addHighlight() is more flexible, as it allows to style not only the segment being added, but also multiple segments of parts of segments. So, in effect, the existing APIs (plus JDK-8355774) allow you address your requirements.
Or is there something you that is still impossible to do?
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 09:49 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Thank you very much for the detailed explanation. Am I right in understanding that JDK-8355774 does not consider the possibility of styling underline/wavy underline via a CSS file (without calling special methods like addHighlight, addWavyUnderline?
If so, should I open another issue?
Best regards, Pavel On 5/12/25 19:41, Andy Goryachev wrote: Yes, I know. But we must support both options, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet. Our goal is to provide the tools that can be used equally well in either situation. "The most frequent operations must be easy, all other must be possible".
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 09:34 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you very much for your response. But as I?ve said many times, I?m only considering styling through a CSS file.
Best regards, Pavel
On 5/12/25 19:28, Andy Goryachev wrote: Pavel:
Underlines and strike-through attributes are available via StyleAttributeMap.STRIKE_THROUGH and StyleAttributeMap.UNDERLINE (using text color). On the other hand, adding this functionality via addHighlight() would allow the application to style the shapes via CSS.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 22:18 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel On 5/9/25 00:09, Andy Goryachev wrote: The only property that makes sense is the background color. The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images. The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 13:13 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel On 5/8/25 22:21, Andy Goryachev wrote: Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/15d6fc0b/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Andy, thank you for your time and the detailed discussion. I'm sure it was very helpful.
That's why I just opened a new issue with ID: 9078500.
Best regards, Pavel
On 5/12/25 19:58, Andy Goryachev wrote:
JDK-8355774 adds methods to style highlights added via addHighlight() with CSS.
What (I think) you want is an ability to style a single text segment with (background | underlines | etc) attributes, which is still debatable - because you already can do all that, albeit with some additional code.? The addHighlight() is more flexible, as it allows to style not only the segment being added, but also multiple segments of parts of segments.? So, in effect, the existing APIs (plus JDK-8355774) allow you address your requirements.
Or is there something you that is still impossible to do?
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Monday, May 12, 2025 at 09:49 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Thank you very much for the detailed explanation. Am I right in understanding that JDK-8355774 does not consider the possibility of styling underline/wavy underline via a CSS file (without calling special methods like addHighlight, addWavyUnderline?
If so, should I open another issue?
Best regards, Pavel
On 5/12/25 19:41, Andy Goryachev wrote:
Yes\, I know\.\? But we must support both options\, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet\.\? Our goal is to provide the tools that can be used equally well in either situation\. \"The most frequent operations must be easy\, all other must be possible\"\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Monday\, May 12\, 2025 at 09\:34 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you very much for your response\. But as I\?ve said many times\, I\?m only considering styling through a CSS file\. Best regards\, Pavel On 5\/12\/25 19\:28\, Andy Goryachev wrote\: Pavel\: Underlines and strike\-through attributes are available via StyleAttributeMap\.STRIKE\_THROUGH and StyleAttributeMap\.UNDERLINE \(using text color\)\.\? On the other hand\, adding this functionality via addHighlight\(\) would allow the application to style the shapes via CSS\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 22\:18 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, I\'m really glad we figured out the background\-color issue\, and I\'m also very grateful to you\! Regarding wavy lines and other types of underlining \? in my previous message\, I listed the key attributes that are essential for a modern CodeArea\. For example\, underline for links \? I don\'t think it\'s necessary to write that the internet is extremely popular today and that links in code are common practice\, and so on\. Of course\, all of these properties should be set via a CSS file\, since that\'s the most efficient way to use CSS \? when styling is completely separated from logic\. So\, the list contains five properties\. If two of them are not supported\, that means \(to me\) that only 60\% of the core properties are supported\. That\'s just my feedback \? the decision is\, of course\, yours \:\) Best regards\, Pavel On 5\/9\/25 00\:09\, Andy Goryachev wrote\: The only property that makes sense is the background color\.\? The wavy and other kinds of underlines\, while they make some sense in the context of the CodeArea\, would fail in general in the context of RichTextArea where the content may include nodes and images\. The highlights were designed specifically for the case to highlight the content range regardless of what is in it\. I\'ve reopened https\:\/\/bugs\.openjdk\.org\/browse\/JDK\-8356436 for the background color\. Thank you for your patience and good suggestions\! \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 13\:13 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Since we\?re talking about code styling\, I would highlight the following as the main properties\: \- foreground color \(\+\) \- background color \(\-\) \- font \(weight\, italic\, size\, name\) \(\+\) \- underline \(e\.g\. for links\) \(\?\) \- wavy underline \(e\.g\. for spelling\) \(\-\) I think these properties cover 99\% of all the necessary properties for CodeArea\. I used \+ and \- to show what has already been implemented\. Best regards\, Pavel On 5\/8\/25 22\:21\, Andy Goryachev wrote\: Oh\, I finally get it what you want\. Thanks\! What you asking is effectively to add support for some additional properties to the class that renders the text segment \(currently\, Text\)\. My first question is \- what are the additional properties\, beside the background\-color\? If it\'s only the background color\, it\'s probably easy to add\. Anything beyond that\, such as equivalent of full \-fx\-region\-background or \-fx\-region\-border\, would be extremely unlikely\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:44 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you for your reply\. I have already provided some examples\, but I\?ll give one more very simple example that clearly illustrates the problem\. I have a library that uses JFX CodeArea\. Naturally\, all styles are stored in a CSS file\. Users of this library can customize how the code is displayed by modifying the styles in the CSS file\. Let\?s take the search feature as an example\. In the CSS file\, there is a class\: \.search\-match \{ \-fx\-background\-color\: orange\; \} But the user wants to change not the background color\, but the foreground color and font weight\. So they write\: \.search\-match \{ \?\?\? \-fx\-fill\: orange\; \-fx\-font\-weight\: bold\; \} And this should work\. If it doesn\?t\, then it\?s no longer CSS\-based styling\. If\, for some reason\, the \-fx\-background\-color property cannot be used\, an alternative property can be introduced\, such as \-fx\-highlight\-color\. However\, everything else in the example should work as described\. Best regards\, Pavel On 5\/8\/25 21\:25\, Andy Goryachev wrote\: Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\.\? We are not adding methods to \"style individual properties\"\. We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/d6935aff/attachment-0001.htm>
Mailing list message from Andy Goryachev on openjfx-dev:
Pavel:
if you don't mind, could you forward the text from the bug to the mailing list as a new message, so it does not get appended to the PR? The reason is - it'll take some time to percolate the ticket through the webbugs system.
Thanks!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 10:31 To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your time and the detailed discussion. I'm sure it was very helpful.
That's why I just opened a new issue with ID: 9078500.
Best regards, Pavel On 5/12/25 19:58, Andy Goryachev wrote: JDK-8355774 adds methods to style highlights added via addHighlight() with CSS.
What (I think) you want is an ability to style a single text segment with (background | underlines | etc) attributes, which is still debatable - because you already can do all that, albeit with some additional code. The addHighlight() is more flexible, as it allows to style not only the segment being added, but also multiple segments of parts of segments. So, in effect, the existing APIs (plus JDK-8355774) allow you address your requirements.
Or is there something you that is still impossible to do?
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 09:49 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Thank you very much for the detailed explanation. Am I right in understanding that JDK-8355774 does not consider the possibility of styling underline/wavy underline via a CSS file (without calling special methods like addHighlight, addWavyUnderline?
If so, should I open another issue?
Best regards, Pavel On 5/12/25 19:41, Andy Goryachev wrote: Yes, I know. But we must support both options, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet. Our goal is to provide the tools that can be used equally well in either situation. "The most frequent operations must be easy, all other must be possible".
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Monday, May 12, 2025 at 09:34 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you very much for your response. But as I?ve said many times, I?m only considering styling through a CSS file.
Best regards, Pavel
On 5/12/25 19:28, Andy Goryachev wrote: Pavel:
Underlines and strike-through attributes are available via StyleAttributeMap.STRIKE_THROUGH and StyleAttributeMap.UNDERLINE (using text color). On the other hand, adding this functionality via addHighlight() would allow the application to style the shapes via CSS.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 22:18 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, I'm really glad we figured out the background-color issue, and I'm also very grateful to you!
Regarding wavy lines and other types of underlining ? in my previous message, I listed the key attributes that are essential for a modern CodeArea. For example, underline for links ? I don't think it's necessary to write that the internet is extremely popular today and that links in code are common practice, and so on.
Of course, all of these properties should be set via a CSS file, since that's the most efficient way to use CSS ? when styling is completely separated from logic.
So, the list contains five properties. If two of them are not supported, that means (to me) that only 60% of the core properties are supported.
That's just my feedback ? the decision is, of course, yours :)
Best regards, Pavel On 5/9/25 00:09, Andy Goryachev wrote: The only property that makes sense is the background color. The wavy and other kinds of underlines, while they make some sense in the context of the CodeArea, would fail in general in the context of RichTextArea where the content may include nodes and images. The highlights were designed specifically for the case to highlight the content range regardless of what is in it.
I've reopened https://bugs.openjdk.org/browse/JDK-8356436 for the background color.
Thank you for your patience and good suggestions!
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 13:13 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Since we?re talking about code styling, I would highlight the following as the main properties: - foreground color (+) - background color (-) - font (weight, italic, size, name) (+) - underline (e.g. for links) (?) - wavy underline (e.g. for spelling) (-)
I think these properties cover 99% of all the necessary properties for CodeArea. I used + and - to show what has already been implemented.
Best regards, Pavel On 5/8/25 22:21, Andy Goryachev wrote: Oh, I finally get it what you want. Thanks!
What you asking is effectively to add support for some additional properties to the class that renders the text segment (currently, Text). My first question is - what are the additional properties, beside the background-color? If it's only the background color, it's probably easy to add.
Anything beyond that, such as equivalent of full -fx-region-background or -fx-region-border, would be extremely unlikely.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:44 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights Andy, thank you for your reply.
I have already provided some examples, but I?ll give one more very simple example that clearly illustrates the problem.
I have a library that uses JFX CodeArea. Naturally, all styles are stored in a CSS file. Users of this library can customize how the code is displayed by modifying the styles in the CSS file. Let?s take the search feature as an example. In the CSS file, there is a class:
.search-match { -fx-background-color: orange; }
But the user wants to change not the background color, but the foreground color and font weight. So they write:
.search-match { -fx-fill: orange; -fx-font-weight: bold; }
And this should work. If it doesn?t, then it?s no longer CSS-based styling.
If, for some reason, the -fx-background-color property cannot be used, an alternative property can be introduced, such as -fx-highlight-color. However, everything else in the example should work as described.
Best regards, Pavel On 5/8/25 21:25, Andy Goryachev wrote: Pavel:
I think your comments in the ticket are still invisible to me, so I can't comment.
About your recent comment in the PR - I have difficulty understanding what you mean. We are not adding methods to "style individual properties". We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph.
Perhaps if you describe what kind of visual representation you have in mind, we can show how to achieve that in the code.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org><mailto:openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com><mailto:pavelturk2000 at gmail.com> Date: Thursday, May 8, 2025 at 11:04 To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org><mailto:openjfx-dev at openjdk.org> Subject: Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team, but if I may, I?d like to express my opinion. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision.
First, the usefulness of such methods is minimal because when styling is done via CSS, the assumption is that adjusting the CSS file should be sufficient?something that won?t work in this case. For example one user for search result wants to set background color for matches but another one wants to set foreground color + weight. Second, it violates fundamental CSS principles. Third, if these methods are added to the API, they cannot later be removed without breaking backward compatibility.
I wrote about this in detail in the additional information for JDK-8356436, but my comment has not yet been approved by a moderator.
When in doubt, it?s very helpful to see how others are doing it. In RichTextFX, special CSS properties were introduced, which resulted in a consistent standard for applying CSS styles to all properties?fully aligned with established CSS norms.
This is my personal opinion, which, of course, can be wrong.
Best regards, Pavel
On 5/8/25 20:46, Andy Goryachev wrote:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/3d5e4a8e/attachment-0001.htm>
Mailing list message from PavelTurk on openjfx-dev:
Andy, unfortunately, I don't have that text and the link to the issue will come only when the issue is approved. Sorry, we can only wait now.
Best regards. Pavel
On 5/12/25 20:40, Andy Goryachev wrote:
Pavel:
if you don't mind, could you forward the text from the bug to the mailing list as a new message, so it does not get appended to the PR?
The reason is - it'll take some time to percolate the ticket through the webbugs system.
Thanks!
-andy
*From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of PavelTurk <pavelturk2000 at gmail.com> *Date: *Monday, May 12, 2025 at 10:31 *To: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org> *Subject: *Re: RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights
Andy, thank you for your time and the detailed discussion. I'm sure it was very helpful.
That's why I just opened a new issue with ID: 9078500.
Best regards, Pavel
On 5/12/25 19:58, Andy Goryachev wrote:
JDK\-8355774 adds methods to style highlights added via addHighlight\(\) with CSS\. What \(I think\) you want is an ability to style a single text segment with \(background \| underlines \| etc\) attributes\, which is still debatable \- because you already can do all that\, albeit with some additional code\.\? The addHighlight\(\) is more flexible\, as it allows to style not only the segment being added\, but also multiple segments of parts of segments\.\? So\, in effect\, the existing APIs \(plus JDK\-8355774\) allow you address your requirements\. Or is there something you that is still impossible to do\? \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Monday\, May 12\, 2025 at 09\:49 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Thank you very much for the detailed explanation\. Am I right in understanding that JDK\-8355774 does not consider the possibility of styling underline\/wavy underline via a CSS file \(without calling special methods like addHighlight\, addWavyUnderline\? If so\, should I open another issue\? Best regards\, Pavel On 5\/12\/25 19\:41\, Andy Goryachev wrote\: Yes\, I know\.\? But we must support both options\, since the RichTextArea provides models that allow to style programmatically and independently from the stylesheet\.\? Our goal is to provide the tools that can be used equally well in either situation\.\? \"The most frequent operations must be easy\, all other must be possible\"\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Monday\, May 12\, 2025 at 09\:34 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you very much for your response\. But as I\?ve said many times\, I\?m only considering styling through a CSS file\. Best regards\, Pavel On 5\/12\/25 19\:28\, Andy Goryachev wrote\: Pavel\: Underlines and strike\-through attributes are available via StyleAttributeMap\.STRIKE\_THROUGH and StyleAttributeMap\.UNDERLINE \(using text color\)\.\? On the other hand\, adding this functionality via addHighlight\(\) would allow the application to style the shapes via CSS\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 22\:18 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, I\'m really glad we figured out the background\-color issue\, and I\'m also very grateful to you\! Regarding wavy lines and other types of underlining \? in my previous message\, I listed the key attributes that are essential for a modern CodeArea\. For example\, underline for links \? I don\'t think it\'s necessary to write that the internet is extremely popular today and that links in code are common practice\, and so on\. Of course\, all of these properties should be set via a CSS file\, since that\'s the most efficient way to use CSS \? when styling is completely separated from logic\. So\, the list contains five properties\. If two of them are not supported\, that means \(to me\) that only 60\% of the core properties are supported\. That\'s just my feedback \? the decision is\, of course\, yours \:\) Best regards\, Pavel On 5\/9\/25 00\:09\, Andy Goryachev wrote\: The only property that makes sense is the background color\. The wavy and other kinds of underlines\, while they make some sense in the context of the CodeArea\, would fail in general in the context of RichTextArea where the content may include nodes and images\.\? The highlights were designed specifically for the case to highlight the content range regardless of what is in it\. I\'ve reopened https\:\/\/bugs\.openjdk\.org\/browse\/JDK\-8356436 for the background color\. Thank you for your patience and good suggestions\! \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 13\:13 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Since we\?re talking about code styling\, I would highlight the following as the main properties\: \- foreground color \(\+\) \- background color \(\-\) \- font \(weight\, italic\, size\, name\) \(\+\) \- underline \(e\.g\. for links\) \(\?\) \- wavy underline \(e\.g\. for spelling\) \(\-\) I think these properties cover 99\% of all the necessary properties for CodeArea\. I used \+ and \- to show what has already been implemented\. Best regards\, Pavel On 5\/8\/25 22\:21\, Andy Goryachev wrote\: Oh\, I finally get it what you want\.\? Thanks\! What you asking is effectively to add support for some additional properties to the class that renders the text segment \(currently\, Text\)\.\? My first question is \- what are the additional properties\, beside the background\-color\? If it\'s only the background color\, it\'s probably easy to add\. Anything beyond that\, such as equivalent of full \-fx\-region\-background or \-fx\-region\-border\, would be extremely unlikely\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:44 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights Andy\, thank you for your reply\. I have already provided some examples\, but I\?ll give one more very simple example that clearly illustrates the problem\. I have a library that uses JFX CodeArea\. Naturally\, all styles are stored in a CSS file\. Users of this library can customize how the code is displayed by modifying the styles in the CSS file\. Let\?s take the search feature as an example\. In the CSS file\, there is a class\: \.search\-match \{ \-fx\-background\-color\: orange\; \} But the user wants to change not the background color\, but the foreground color and font weight\. So they write\: \.search\-match \{ \?\?\? \-fx\-fill\: orange\; \-fx\-font\-weight\: bold\; \} And this should work\. If it doesn\?t\, then it\?s no longer CSS\-based styling\. If\, for some reason\, the \-fx\-background\-color property cannot be used\, an alternative property can be introduced\, such as \-fx\-highlight\-color\. However\, everything else in the example should work as described\. Best regards\, Pavel On 5\/8\/25 21\:25\, Andy Goryachev wrote\: Pavel\: I think your comments in the ticket are still invisible to me\, so I can\'t comment\. About your recent comment in the PR \- I have difficulty understanding what you mean\.\? We are not adding methods to \"style individual properties\"\. We are adding methods that allow the application to use CSS to style parts of the visual representation of the given RichParagraph\. Perhaps if you describe what kind of visual representation you have in mind\, we can show how to achieve that in the code\. \-andy \*From\: \*openjfx\-dev \<openjfx\-dev\-retn at openjdk\.org> \<mailto\:openjfx\-dev\-retn at openjdk\.org> on behalf of PavelTurk \<pavelturk2000 at gmail\.com> \<mailto\:pavelturk2000 at gmail\.com> \*Date\: \*Thursday\, May 8\, 2025 at 11\:04 \*To\: \*openjfx\-dev at openjdk\.org \<openjfx\-dev at openjdk\.org> \<mailto\:openjfx\-dev at openjdk\.org> \*Subject\: \*Re\: RFR\: 8355774\: RichTextArea\: provide mechanism for CSS styling of highlights I am not a member of the JavaFX team\, but if I may\, I\?d like to express my opinion\. I believe that creating separate methods for styling individual properties is a very problematic and dangerous decision\. First\, the usefulness of such methods is minimal because when styling is done via CSS\, the assumption is that adjusting the CSS file should be sufficient\?something that won\?t work in this case\. For example one user for search result wants to set background color for matches but another one wants to set foreground color \+ weight\. Second\, it violates fundamental CSS principles\. Third\, if these methods are added to the API\, they cannot later be removed without breaking backward compatibility\. I wrote about this in detail in the additional information for JDK\-8356436\, but my comment has not yet been approved by a moderator\. When in doubt\, it\?s very helpful to see how others are doing it\. In RichTextFX\, special CSS properties were introduced\, which resulted in a consistent standard for applying CSS styles to all properties\?fully aligned with established CSS norms\. This is my personal opinion\, which\, of course\, can be wrong\. Best regards\, Pavel On 5\/8\/25 20\:46\, Andy Goryachev wrote\:
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250512/02541592/attachment-0001.htm>
@andy-goryachev-oracle This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
/touch
@andy-goryachev-oracle The pull request is being re-evaluated and the inactivity timeout has been reset.
@andy-goryachev-oracle This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
/touch
@andy-goryachev-oracle The pull request is being re-evaluated and the inactivity timeout has been reset.
created the CSR.
@Ziad-Mid could you review this PR please?
@lukostyra will be the second reviewer.
/integrate