TableView enhancements for JavaFX 2.2
jonathan.giles at oracle.com
Wed Mar 7 12:40:40 PST 2012
I'm in the very early stages of planning improvements to TableView for
JavaFX 2.2, particularly centred around the following three Jira issues.
Basically, I am wanting to make it easier to style and customise
TableView. The two main use cases are:
1) allowing for CSS styling to, for example, change the background
colour of a given column. This requires that we provide an easy way to
expose each column via CSS. As mentioned in RT-19450, the best
approaches I can think of right now are to add two style classes per
column: column-x (where x is the column index), and also a styleclass of
the TableColumn.text property (although I'm not sure this second
styleclass is really necessary or useful, as the id property can be used
to achieve the same thing, and we don't overuse the styleclass list). To
achieve this, I'd need to add more API to the TableColumn class for
2) allowing for developers to customise the TableColumn header area, for
example, to allow for people to put filter buttons in, hide the sort
arrows, add a media player control, etc.
The general approach I want to take is to have TableColumn copy (not
extend from) a number of the Labeled APIs, as well as the
id/style/styleclass properties. My justification for wanting to take
this approach is to prevent TableColumn becoming a Control. A similar
discussion will need to be had about Tab, which has much the same
requirements. Perhaps there is a need for some kind of abstract
interface / class that sits above Labeled, but I think this may be
taking things too far (for possibly no perceivable gain, except perhaps
ensuring API consistency). Another option is to have a 'label' property
that people can interact with directly.
With the addition of the Labeled API, I can then easily add listeners to
maintain the relevant id/style/styleclass on each TableColumn skin, and
add API to allow for customisation of the header area (refer to RT-14909
for a example of the API I have in mind).
If you have any concerns, questions or feature requests related to this
topic, please put them forward in this thread.
More information about the openjfx-dev