Re: Converting a Color object to its string representation
I think this is too niche to have Color provide. Just make a utility method for whatever format you desire, instead of making Color responsible for half a dozen ways of formatting colors, and then probably still missing some format that someone needs. Ticket should be closed as won't fix. --John On 09/12/2023 22:06, Michael Strauß wrote: I obviously meant to write withPrefix("#"), not withDelimiter("#")... On Sat, Dec 9, 2023 at 9:57 PM Michael Strauß wrote: How would HexFormat work with Color, other than using an extremely unwieldy syntax? String formatted = HexFormat.of() .withDelimiter("#") .formatHex(new byte[] { (byte)(color.getRed() * 255.0f), (byte)(color.getGreen() * 255.0f), (byte)(color.getBlue() * 255.0f), (byte)(color.getOpacity() * 255.0f) }); On Sat, Dec 9, 2023 at 9:40 PM David Alayachew wrote: Apologies - java.util.HexFormat That's what I get for firing from the hip, then looking afterwards.
Re: Converting a Color object to its string representation
I obviously meant to write withPrefix("#"), not withDelimiter("#")... On Sat, Dec 9, 2023 at 9:57 PM Michael Strauß wrote: > > How would HexFormat work with Color, other than using an extremely > unwieldy syntax? > > String formatted = HexFormat.of() > .withDelimiter("#") > .formatHex(new byte[] { > (byte)(color.getRed() * 255.0f), > (byte)(color.getGreen() * 255.0f), > (byte)(color.getBlue() * 255.0f), > (byte)(color.getOpacity() * 255.0f) > }); > > > > On Sat, Dec 9, 2023 at 9:40 PM David Alayachew > wrote: > > > > Apologies - java.util.HexFormat > > > > That's what I get for firing from the hip, then looking afterwards.
Re: Converting a Color object to its string representation
How would HexFormat work with Color, other than using an extremely unwieldy syntax? String formatted = HexFormat.of() .withDelimiter("#") .formatHex(new byte[] { (byte)(color.getRed() * 255.0f), (byte)(color.getGreen() * 255.0f), (byte)(color.getBlue() * 255.0f), (byte)(color.getOpacity() * 255.0f) }); On Sat, Dec 9, 2023 at 9:40 PM David Alayachew wrote: > > Apologies - java.util.HexFormat > > That's what I get for firing from the hip, then looking afterwards.
Re: Converting a Color object to its string representation
Apologies - java.util.HexFormat That's what I get for firing from the hip, then looking afterwards. On Sat, Dec 9, 2023, 3:38 PM David Alayachew wrote: > Doesn't HexDigits cover 3/4 of these cases? > > On Sat, Dec 9, 2023, 1:20 PM Michael Strauß > wrote: > >> If we are going to revisit the `Color` class, maybe we want to provide >> a more comprehensive string formatting API, for example: >> - full-length web strings (e.g. "#ffad341c") >> - compact web strings (e.g. "#ccc") >> - with/without the leading # >> - nearest named color ("darkgoldenrod") >> >> >> On Sat, Dec 9, 2023 at 3:44 PM Eran Leshem wrote: >> > >> > Hello, >> > >> > >> > >> > Can I contribute an implementation for >> https://bugs.openjdk.org/browse/JDK-8090778? >> > >> > >> > >> > Eran >> > >> > >> >
Re: Converting a Color object to its string representation
Doesn't HexDigits cover 3/4 of these cases? On Sat, Dec 9, 2023, 1:20 PM Michael Strauß wrote: > If we are going to revisit the `Color` class, maybe we want to provide > a more comprehensive string formatting API, for example: > - full-length web strings (e.g. "#ffad341c") > - compact web strings (e.g. "#ccc") > - with/without the leading # > - nearest named color ("darkgoldenrod") > > > On Sat, Dec 9, 2023 at 3:44 PM Eran Leshem wrote: > > > > Hello, > > > > > > > > Can I contribute an implementation for > https://bugs.openjdk.org/browse/JDK-8090778? > > > > > > > > Eran > > > > >
Re: Converting a Color object to its string representation
If we are going to revisit the `Color` class, maybe we want to provide a more comprehensive string formatting API, for example: - full-length web strings (e.g. "#ffad341c") - compact web strings (e.g. "#ccc") - with/without the leading # - nearest named color ("darkgoldenrod") On Sat, Dec 9, 2023 at 3:44 PM Eran Leshem wrote: > > Hello, > > > > Can I contribute an implementation for > https://bugs.openjdk.org/browse/JDK-8090778? > > > > Eran > >
Re: RFR: 8321573: Improve Platform.Preferences documentation [v3]
> This PR enhances the documentation of `Platform.Preferences.accentColor`: > > >/** > - * The accent color. > + * The accent color, which can be used to highlight the active or > important part of a > + * control and make it stand out from the rest of the user interface. It > is usually a > + * vivid color that contrasts with the foreground and background colors. > > > Additional changes include alternating row colors for tables. Michael Strauß has updated the pull request incrementally with one additional commit since the last revision: review comments - Changes: - all: https://git.openjdk.org/jfx/pull/1301/files - new: https://git.openjdk.org/jfx/pull/1301/files/c1e78a04..24e3e1bd Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx=1301=02 - incr: https://webrevs.openjdk.org/?repo=jfx=1301=01-02 Stats: 9 lines in 1 file changed: 2 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jfx/pull/1301.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1301/head:pull/1301 PR: https://git.openjdk.org/jfx/pull/1301
Re: RFR: 8321573: Improve Platform.Preferences documentation [v2]
On Sat, 9 Dec 2023 09:33:13 GMT, Nir Lisker wrote: >> Michael Strauß has updated the pull request incrementally with one >> additional commit since the last revision: >> >> wording, table styling > > modules/javafx.graphics/src/main/java/javafx/application/Platform.java line > 596: > >> 594: * The color used for background regions. >> 595: * >> 596: * If the platform does not report a background color, this >> property defaults to {@link Color#WHITE}. > > Minor: I don't think you need a link here because it's linked in the default > value tag. Agreed. Only one one of them needs the link (and yes, it's minor). - PR Review Comment: https://git.openjdk.org/jfx/pull/1301#discussion_r1421441931
Re: RFR: 8321573: Improve Platform.Preferences documentation [v2]
On Sat, 9 Dec 2023 16:20:30 GMT, Kevin Rushforth wrote: >> Michael Strauß has updated the pull request incrementally with one >> additional commit since the last revision: >> >> wording, table styling > > modules/javafx.graphics/src/main/java/javafx/application/Platform.java line > 473: > >> 471: * >> 472: * The following preferences are potentially available on the >> specified platforms: >> 473: * > > I recommend changing the ID to `id="preferences-table-windows"` and adding > `id="preferences-table-macos"` and `id="preferences-table-linux"` to the > other two. And if you do that, you will need to change the link on line 448 of this file. - PR Review Comment: https://git.openjdk.org/jfx/pull/1301#discussion_r1421442350
Converting a Color object to its string representation
Hello, Can I contribute an implementation for https://bugs.openjdk.org/browse/JDK-8090778? Eran
Re: RFR: 8299753: Tree/TableView: Column Resizing With Fractional Scale [v7]
On Thu, 2 Nov 2023 15:31:40 GMT, Andy Goryachev wrote: >> Modified the resize algorithm to work well with fractional scale, thanks for >> deeper understanding of the problem thanks to @hjohn and @mstr2 . >> >> It is important to note that even though the constraints are given by the >> user in unsnapped coordinates, they are converted to snapped values, since >> the snapped values correspond to the actual pixels on the display. This >> means the tests that validate honoring constraints should, in all the cases >> where (scale != 1.0), assume possibly error not exceeding (1.0 / scale) (I >> think). > > Andy Goryachev has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains 26 additional > commits since the last revision: > > - Merge remote-tracking branch 'origin/master' into 8299753.resize > - tolerance > - Merge remote-tracking branch 'origin/master' into 8299753.resize > - undo merge > - no new api > - Merge remote-tracking branch 'origin/master' into 8299753.resize > - cleanup > - using snap inner space api > - Merge remote-tracking branch 'origin/master' into 8299753.resize > - Merge branch 'ag.8311527.snap.inner' into 8299753.resize > - ... and 16 more: https://git.openjdk.org/jfx/compare/b4cdf7d6...5e855022 Tested the changes in Windows 11 with different scale values. The fix works as expected. I will review the code soon and complete the review. - PR Comment: https://git.openjdk.org/jfx/pull/1156#issuecomment-1848411826
Re: RFR: 8321573: Improve Platform.Preferences documentation [v2]
On Sat, 9 Dec 2023 08:40:31 GMT, Michael Strauß wrote: >> This PR enhances the documentation of `Platform.Preferences.accentColor`: >> >> >>/** >> - * The accent color. >> + * The accent color, which can be used to highlight the active or >> important part of a >> + * control and make it stand out from the rest of the user interface. It >> is usually a >> + * vivid color that contrasts with the foreground and background colors. >> >> >> Additional changes include alternating row colors for tables. > > Michael Strauß has updated the pull request incrementally with one additional > commit since the last revision: > > wording, table styling Looks good. Let's keep it open until Monday to give others a chance to review. modules/javafx.graphics/src/main/java/javafx/application/Platform.java line 596: > 594: * The color used for background regions. > 595: * > 596: * If the platform does not report a background color, this > property defaults to {@link Color#WHITE}. Minor: I don't think you need a link here because it's linked in the default value tag. - Marked as reviewed by nlisker (Reviewer). PR Review: https://git.openjdk.org/jfx/pull/1301#pullrequestreview-1773646552 PR Review Comment: https://git.openjdk.org/jfx/pull/1301#discussion_r1421378662
Re: RFR: 8321573: Improve Platform.Preferences documentation [v2]
On Sat, 9 Dec 2023 07:25:17 GMT, Nir Lisker wrote: >> Michael Strauß has updated the pull request incrementally with one >> additional commit since the last revision: >> >> wording, table styling > > modules/javafx.graphics/src/main/java/javafx/application/Platform.java line > 612: > >> 610: * The accent color, which is usually a vivid color that >> contrasts with the foreground >> 611: * and background colors. It can be used to highlight the >> active or important part of a >> 612: * control and make it stand out from the rest of the user >> interface. > > I think it's more important to say what it's used for than what value is > should have, so I would switch the order: > > The accent color, which can be used to highlight the active or important part > of a > control and make it stand out from the rest of the user interface. It is > usually a vivid > color that contrasts with the foreground and background colors. Yes, that's better. - PR Review Comment: https://git.openjdk.org/jfx/pull/1301#discussion_r1421359899
Re: RFR: 8321573: Improve Platform.Preferences documentation [v2]
> This PR enhances the documentation of `Platform.Preferences.accentColor`: > > >/** > - * The accent color. > + * The accent color, which can be used to highlight the active or > important part of a > + * control and make it stand out from the rest of the user interface. It > is usually a > + * vivid color that contrasts with the foreground and background colors. > > > Additional changes include alternating row colors for tables. Michael Strauß has updated the pull request incrementally with one additional commit since the last revision: wording, table styling - Changes: - all: https://git.openjdk.org/jfx/pull/1301/files - new: https://git.openjdk.org/jfx/pull/1301/files/89858a90..c1e78a04 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx=1301=01 - incr: https://webrevs.openjdk.org/?repo=jfx=1301=00-01 Stats: 22 lines in 1 file changed: 9 ins; 1 del; 12 mod Patch: https://git.openjdk.org/jfx/pull/1301.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1301/head:pull/1301 PR: https://git.openjdk.org/jfx/pull/1301