RFR: 8314482: TextFlow: TabStopPolicy [v2]
Kevin Rushforth
kcr at openjdk.org
Wed Jun 18 17:24:39 UTC 2025
On Wed, 18 Jun 2025 14:59:02 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/text/TabStop.java line 35:
>>
>>> 33: * @since 999 TODO
>>> 34: */
>>> 35: public class TabStop {
>>
>> Should this be a record? If not, it should at least be a final class.
>
> No and no. The application code or the custom component should be able to extend the TabStop class to supply additional options.
How would such extensibility work? What would the implementation do with additional options? Or is the intention that something other than TextFlow (e.g., RichTextArea or some third-party component would use that information, but TextFlow would ignore it? If so, that seems OK.
>> modules/javafx.graphics/src/main/java/javafx/scene/text/TabStop.java line 41:
>>
>>> 39: * Constructs a new tab stop with the specified position.
>>> 40: *
>>> 41: * @param position the position in pixels
>>
>> Is pixels the right unit here? Should it be points instead? Or should it allow for the specification of units so that you could specify it in "em"s?
>>
>> @prrace might want to weigh in on this.
>
> Using the same units used everywhere else (text layout, padding, border, etc.)
> I think any conversion should be the responsibility of the application code.
That seems fine then, as long as this has been thought through.
A loosely related question: what about setting the tab stop policy via CSS? I can see apps that would want to do this. It could be added later if you don't see it as a primary use case.
>> modules/javafx.graphics/src/main/java/javafx/scene/text/TabStopPolicy.java line 60:
>>
>>> 58:
>>> 59: /**
>>> 60: * Provides default tab stops (beyond the last tab stop specified by {@code #tabStops()},
>>
>> Having this be a plural when it is a single value (a double) is awkward. I would name the property `defaultStop` and document that the default is used for all stops beyond the last stop.
>
> This terminology is borrowed from a well known software product. I think it is apt as it describes the spacing (and the positions) of multiple tab stops, and also the users might be familiar with the term.
Hmm. OK then.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1744#discussion_r2155098866
PR Review Comment: https://git.openjdk.org/jfx/pull/1744#discussion_r2155102659
PR Review Comment: https://git.openjdk.org/jfx/pull/1744#discussion_r2155105813
More information about the openjfx-dev
mailing list