On Tue, 16 Jun 2026 22:27:13 GMT, Andy Goryachev <[email protected]> wrote:
>> ### Summary >> >> This PR adds support for controlling tab stops: the `TAB_STOPS` paragraph >> attribute and the `defaultTabStops` property in the `RichTextModel`. >> >> While adding the paragraph attribute is a trivial process, adding a >> model-wide property requires adding of a mechanism to support document >> properties (something that was originally omitted in the first incubating >> release). Using the document properties, we can now persist not only the >> default tab stops, but also provide the version umber for the storage format >> provided by the `RichTextFormatHandler`, which will enable support the >> format evolution in the future [0]. >> >> To showcase the feature, the `RichEditorDemoApp` gains a visual ruler and >> additional dialogs and menus. >> >> <img width="822" height="381" alt="Screenshot 2026-03-04 at 14 00 30" >> src="https://github.com/user-attachments/assets/32251846-f11a-4e87-b74a-44c21d629550" >> /> >> >> >> ### Paragraph Attribute >> >> Paragraph-specific tab stops are enabled by: >> >> - `StyleAttributeMap.TAB_STOPS` constant >> - `StyleAttributeMap.Builder.setTabStops(double ... positions)` >> >> The tab stops are represented by the `TabStops` class which is basically an >> immutable list (we can't use List<TabStops> because it makes it impossible >> to offer compile-time type safety of `StyleAttribute`). >> >> ### Default Tab Stops >> >> After the last paragraph tab stop, or when no paragraph tab stops is set, >> the document provides a way to set default tab stops via the model's >> `defaultTabStops` property: >> >> These changes support the new property and other document properties: >> >> - document-wide properties support in the `StyledTextModel` base class >> - `defaultTabStops` property in the `RichTextModel` and >> `RichTextFormatHandler` >> - document properties `VERSION` and `DEFAULT_TAB_STOPS` >> - `StyledSegment`: `ofDocumentProperties()` factory, >> `getDocumentProperties()` >> >> ### Other Improvements >> >> A number of other improvements were made along with the tab stop related >> changes: >> >> - `character()`, `paragraph()`, and `document()` factory methods in the >> `StyleAttribute` class >> - `isCharacterAttribute()`, `isParagraphAttribute()`, and >> `isDocumentAttribute()` methods in the `StyleAttribute` class >> - `RichTextArea`: `documentArea` read-only property >> >> >> ### Testing >> >> In addition to the `RichEditorDemoApp`, the standalone Monkey Tester [1] >> provides additional options via context menu in the `CodeArea` and >> `RichTextArea` pages. >> >> >> >> ### References >> ... > > Andy Goryachev has updated the pull request incrementally with one additional > commit since the last revision: > > review comments A few more doc comments, and one more issue to add to the follow-up issue around the version string. Go ahead and update the CSR and move it to "Proposed". doc-files/controls/RichTextArea/RichTextArea_DataFormat_Incubator.md line 70: > 68: There is only one document properties segment per file. > 69: > 70: Example: Minor: trailing whitespace doc-files/controls/RichTextArea/RichTextArea_DataFormat_Incubator.md line 184: > 182: ``` > 183: > 184: where `number` is the index of the duplicate attribute map in the > document. Minor: trailing whitespace modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/model/StyledTextModel.java line 554: > 552: * @since 27 > 553: */ > 554: protected String versionString() { I don't understand why this is declared here in StyledTextModel, but not actually defined as a useful (non-null) value except in the RichTextModel subclass. This is another thing to add to the follow-up to figure out how version should be exposed in the API. modules/jfx.incubator.richtext/src/main/java/jfx/incubator/scene/control/richtext/model/TabStops.java line 36: > 34: > 35: /** > 36: * Encapsulates the tab stop positions within a paragraph. Can you add a sentence about the list of stops being unmodifiable after construction? I recommend linking to `List#unmodifiable`. You might also copy the part about "calling any mutator method on the List will always cause UnsupportedOperationException to be thrown". That way it is clear what to expect if an app calls such a method. ------------- PR Review: https://git.openjdk.org/jfx/pull/1800#pullrequestreview-4510879388 PR Review Comment: https://git.openjdk.org/jfx/pull/1800#discussion_r3424503861 PR Review Comment: https://git.openjdk.org/jfx/pull/1800#discussion_r3424505244 PR Review Comment: https://git.openjdk.org/jfx/pull/1800#discussion_r3424572292 PR Review Comment: https://git.openjdk.org/jfx/pull/1800#discussion_r3424485573
