On Tue, 5 Nov 2024 21:48:04 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> I understand that, but could you give a **specific** example? >> >> There is nothing in HB that prevents it from being used in all the scenarios >> I can think of. It's like BorderPane - it can be used with a single center >> component, top and center, etc. I just don't think we need a separate base >> class in this particular case, unless something in the HB **_prevents_** it. > > `BorderPane` is a good example. It's a customized API on top of `Pane`, which > is basically just defined as a "collection of children": >> Base class for layout panes which need to expose the children list as public >> so that users of the subclass can freely add/remove children. > > You're arguing that you wouldn't need `Pane` as a base class, because you can > just as easily build a `VBox` on top of a `BorderPane` if you only use the > center area and ignore all of the rest. While that's true, it's not a good > user model. > > I already gave you a specific example (Spotify) where an alternative > implementation would dynamically change alignments, and presumably have a > different API because of that. > > As another example, take a look at what our WinUI friends are doing with > their [TitleBar](https://github.com/microsoft/microsoft-ui-xaml/issues/9700). > They have more API elements than our implementation (a back button, pane > toggle button, icon, title, subtitle, and so on). The point of this example > is _not_ to argue whether JavaFX developers could recreate this specific API > by subclassing `HeaderBar`, it is to argue that custom APIs are relevant, and > only `HeaderBarBase` gives developers a clean slate to create their own API. Perhaps I am not entirely clear. But having these examples helped, thanks. My point is that, in my opinion, we don't need two classes. We only need one, with a single `'center'` property. If the app needs leading/tailing/upper/lower/anythingElse, the app is free to use any container suitable for their need. This way the platform provides the basis, which only the platform can provide. So my suggestion would be to combine two classes into one with a single `'center'` property. What do you think? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1830057763