Change existing controls or create new ones?
phdoerfler at gmail.com
Wed Mar 13 16:35:37 PDT 2013
the question might benefit from a short example:
Some days ago I created a prototype of a TabPane  and then tried to achieve the same look by styling the already existing TabPane with CSS. The latter was not quite as successful, though  but I did not have the time to investigate much further. I know that it is possible to adjust the .tab-header-area's dimensions with CSS but as the dimensions of that header does not seem to obey the boundaries of the rotated tab, I would have to manage the tab-header-area's height (or width that is) manually.
The underlying problem here is that the JavaFX layout managers do in general not account for transforms, so scaling, rotations and translations result in the node crossing the container's boundaries.
I do not want to question whether this is "expected behavior" or not - I assume there are good reasons for the way it is implemented right now (and be it only the possibility of 3D transformations - and how should those be handled by container panes?).
No, my actual question is:
What is the preferred way to achieve a reusable TabPane which looks like ? Should one try to style the existing one using CSS and Skins or is it better to create a control like this from scratch? Just assuming the first were possible in this example (and it probably is), here are some quick pros and cons. I'd be happy if you could contribute some of your own:
Style existing controls:
- Better support for assistive technologies, screen readers (it's a TabPane, we already know how it works)
- => more semantical information
- already implemented functionality
Start from scratch:
- Greater flexibility in creating the visuals (wild guess - I have not bothered trying Skin myself, yet)
- no functionality implemented - you have to do every single thing yourself
- less semantical information (the screen reader or automation software does not know how a CustomFancyTabPane works)
Might someone who has a deeper understanding of controls shed some light on these questions, please?
Oh and - those reasons for not taking transformations into account... I'd be interested in them, too.
More information about the openjfx-dev