Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with JavaFX 8 not clearing tableview

2689049Jun 7 2014 — edited Jun 8 2014

Hi,

Got a number of JavaFX programs that I am converting across to JavaFX 8.0 on a Windows 8.1 VM

The programs heavily use TableViews to display summary data and refreshes them either automatically or on request via selection of different parameters.

The typical lines of code that do this work are as follows (extracted from a typical program):

    @FXML

    private TableView<QASL2TrendsData> eventTable = new TableView<>();

...do stuff

        final ObservableList<QASL2TrendsData> eventData = FXCollections.observableArrayList();

        eventData.removeAll(eventData);

        eventData.clear();


...do stuff via a task including

        eventData.add(new QASL2TrendsData(year, janEvents, febEvents, marEvents, aprEvents, mayEvents, junEvents, julEvents, augEvents, sepEvents, octEvents,

             novEvents, decEvents, minEvents, maxEvents, meanEvents, medianEvents, stdDevEvents, predictEvents, slopeEvents, minMagnitude, maxMagnitude,

             meanMagnitude, medianMagnitude, stdDevMagnitude, predictMagnitude, slopeMagnitude));

...do more stuff including the following on successful completion of the task (i.e. in searchTask.setOnSucceeded)

        eventTable.setItems(eventData);

Under JavaFX 2.2.60 the behaviour of the code would result in the TableView being nicely refreshed with updated data from the ObservableList.  This would handle the situation where the number of rows to display was greater than or equal to what could be displayed in the TableView (with scroll bar where required) and also when the number of rows to display was less than what could be displayed in the TableView.  In the case of the latter a series of blank rows would be displayed below the actual data.

What I have found with with the JDK 8u5 release of JavaFX that this no longer does what is happening.  In the case of where the number of rows to display is >= what can fit in the TableView all things are fine and they display correctly.  The scroll bar adjusts accordingly and allow the data to be viewed as per JavaFX 2.2.60 functionality.

BUT....

In the case where the number of rows to display is less than what would fit in the TableView, previous row data from other refreshes remain and fills up the TableView content to the max height.  If I run the program and select the parameters to display a set of data that does not fill the TableView that is all fine.  But if a previous set of parameters had filled the TableView then when I run the program again the subset rows of data are displayed and then any previous data fills the remainder of the TableView size.  It should have displayed blank rows below the actuals data like in the case of JavaFX 2.2.60

I have googled my little heart out and tried many approaches but to no avail. Even starting writing some code to write blank lines into the TableView (up to the max number that could fit) to force the remaining data to be erased.  Then thought this is crazy the thing should work as before......

Does anyone out there please have a solution / work around that I can apply so I can complete my migration across to Java 8u5 and the new JavaFX?

Hope you can help!

Thanks

Peter

This post has been answered by 2689049 on Jun 8 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2014
Added on Jun 7 2014
7 comments
5,813 views