[REVIEW REQUEST] Disabling TableView column reordering

Jonathan Giles jonathan.giles at oracle.com
Wed Jan 2 18:12:49 PST 2013

This is an interesting point, and it actually reminds me of another 
issue I discussed with people at Devoxx, which is what to do when we 
eventually support cell spanning (despite being implemented in the 8.0 
repos I plan to disable this before we ship 8.0 - unless I can find time 
to sort all of this out).

In the case of column spanning, you want the columns with spanned cells 
to be locked together, so that they form one unit when moved and can 
also be reordered within themselves as well (if that makes sense!). What 
I mean to say is that if cells are spanning columns 2-3 it should be 
possible to move column 3 before column 2, but you can't put column 4 
between columns 2 and 3 as that would separate the spanned cells.

So, in short, we have the following use cases that need to be supported:

1) Disabling all column reordering (easy with a boolean property on 
TableView / TreeTableView)
2) Specifying a column ordering, e.g. that column 1 must always come 
before column 2.
3) Specifying a column grouping, e.g. that columns 2 and 3 must always 
be adjacent.
4) Specifying a fixed column, e.g. that column 5 must always be in the 
fifth position (and therefore can never be moved). This could possibly 
be done simply by having a boolean property on TableColumn / 
TreeTableColumn that states whether the column allows for reordering, 
but I have a feeling we may run into issues with this so it will need 
some more thought. It is also possible that this use case is a 
degenerate case of the second use case, but I'd need to think through 
the API further before that becomes clear.

Of course, having written this all out I should end by saying that the 
only way to properly implement this API would be to not use column 
indices at all (instead we should be using references to the TableColumn 
/ TreeTableColumn instances). I will need to give this API some thought. 
It's not immediately clear to me how best to represent these 
constraints, so if anyone has some suggestions for a lightweight API 
that captures these requirements, let me know :-)

-- Jonathan

On 3/01/2013 2:55 p.m., Scott Palmer wrote:
> What if I want one column fixed, e.g. column 1, but the remaining columns reorder-able?
> Could there be a way to specify ordering constraints on the columns?
> E.g. columns 1-3 can be in any order but must be before columns 4-6, which can also be in any order.
> Scott
> On 2013-01-02, at 6:31 PM, Jonathan Giles <jonathan.giles at oracle.com> wrote:
>> Hi all,
>> Just a quick post to discuss RT-24669 [1], which is a request to disable all column reordering functionality in TableView. I would like to support this use case in both TableView and TreeTableView by way of a 'columnReorderingEnabled' property (so, columnReorderingEnabledProperty(), setColumnReorderingEnabled(boolean) and isColumnReorderingEnabled()).
>> Are there any comments or API naming suggestions? I would love to have the naming be shorter, but I can't think of a better name that retains the clarity as to what the API does.
>> [1] http://javafx-jira.kenai.com/browse/RT-24669
>> Thanks,
>> -- Jonathan

More information about the openjfx-dev mailing list