list digest

Scott Palmer swpalmer at gmail.com
Tue Dec 22 20:22:15 UTC 2020


You might consider supplying your own sortPolicy (see sortPolicyProperty
<https://openjfx.io/javadoc/15/javafx.controls/javafx/scene/control/TableView.html#sortPolicyProperty>).
It could remove your "total" object, call the DEFAULT_SORT_POLICY
<https://openjfx.io/javadoc/15/javafx.controls/javafx/scene/control/TableView.html#DEFAULT_SORT_POLICY>
and
then add your total object back.

Scott

On Sun, Dec 20, 2020 at 4:50 PM Chuck Davis <cjgunzel at gmail.com> wrote:

> Thanks guys for the link to the digest.
>
> I've looked through a couple of years and find nothing that addresses my
> interest.  As background, I write financial applications and usually when a
> user selects something to display in a table it's because they're
> interested in the total amount.  And it is easy to provide that information
> to them on the initial display.
>
> The rub comes when they select a column header or otherwise sort the
> table.  I need, first of all, to eliminate the total object from the model
> (this is done easily by listening to the onSort property).  Then, after the
> sort is complete I need to add the total object back to the model.  If I
> don't eliminate the total object from the model the sort puts it in very
> strange places.....  What I need to know is when the sort is complete so
> that I can add the total object back into the model and get it displayed.
>
> I've been looking at the TableView source and find the following code near
> the start of the sort() method:
>         SortEvent<TableView<S>> sortEvent = new SortEvent<>(TableView.this,
> TableView.this);
>         fireEvent(sortEvent);
>
> It seems to me it would be trivial to invent another event type
> SORT_COMPLETE and emit it at the end of the sort() method to notify the
> program that the sort has been completed.  And that would certainly solve a
> major headache with showing a total amount for financial tables.  What I
> don't know is whether the sort is done on another thread in which case a
> Future would probably be required to detect the sort completion.
>
> If this were implemented we programmers would be able to detect both the
> start and completion of a sort of the table and proceed accordingly.  It
> would be VERY helpful.
>
> Thanks for reading.
>


More information about the openjfx-dev mailing list