RFR: 8089913: CSS pseudo classes missing by default for some controls

Kevin Rushforth kcr at openjdk.java.net
Fri Mar 5 16:08:44 UTC 2021


On Fri, 5 Mar 2021 13:33:41 GMT, mstr2 <github.com+43553916+mstr2 at openjdk.org> wrote:

>>> The changes to ListView and TableView look correct to me.
>> 
>> And also `TreeTableView`.
>
> I guess that depends on whether a `TreeCell` or `TreeTableRow` that is not expanded should be considered collapsed.
> 
> Unless there are compelling reasons to have cells that are neither expanded nor collapsed, I think it is sensible to default to treating non-existing items as collapsed.
> 
> Currently, once `:expanded` or `:collapsed` has been set, it will not be removed even if the item is set to `null`. This should probably be changed to either:
> 1. remove any pseudoclass when the item is set to `null`, or
> 2. set the `:collapsed` pseudoclass and remove the `:expanded` pseudoclass when the item is set to null.

It does seems like there is a possible inconsistency for `TreeCell` and `TreeTableRow`. I'm not sure it matters in practice, since an application doesn't directly manage the creation of the cells (other than by providing a cell factory) or setting the item. The pseudo-class state of the cell is a proxy for the item it points to. Ideally, it would only contain the "empty" state if the item is null, but given that such a cell would never be rendered it would be hard to point to something that doesn't work as a result.

In any case, since there are larger issues than just setting the default state for `TreeCell` and `TreeTableRow` I'd prefer to decouple them from this issue and file a follow-up issue (which doesn't need to be looked at any time soon).

-------------

PR: https://git.openjdk.java.net/jfx/pull/413


More information about the openjfx-dev mailing list