On Fri, 2 Feb 2024 16:00:28 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
> There is one other method used by SceneBuilder's `CssInternal` class, > `CompoundSelector::getSelectors`. I think you need to add a method to the > `Selector` base class that returns a `List<Selector>` instead of the > `List<SimpleSelector>` returned by the existing `CompoundSelector` method. > Maybe `getChildSelectors` or similar? That method would be overridden in the > subclasses with `CompoundSelector` wrapping the existing selectors list in an > unmodifiable list and `SimpleSelectors` returning an empty List. @kevinrushforth if I'm correct, SceneBuilder won't need that anymore. Since it shouldn't need to do an `instanceof` check (which will break once they're moved to internal packages), the fragment that gets all the selectors should be changed to: for (Rule r : s.getRules()) { for (Selector ss : r.getSelectors()) { styleClasses.addAll(ss.getClasses()); // provisional name getClasses } } Old SceneBuilder code fragment: for (Rule r : s.getRules()) { for (Selector ss : r.getSelectors()) { if (ss instanceof SimpleSelector) { SimpleSelector simple = (SimpleSelector) ss; styleClasses.addAll(simple.getStyleClasses()); } else { if (ss instanceof CompoundSelector) { CompoundSelector cs = (CompoundSelector) ss; for (Selector selector : cs.getSelectors()) { if (selector instanceof SimpleSelector) { SimpleSelector simple = (SimpleSelector) selector; styleClasses.addAll(simple.getStyleClasses()); } } } } } } ------------- PR Comment: https://git.openjdk.org/jfx/pull/1340#issuecomment-1924508539