TableView Scrolling with Large Amount of Columns is Unresponsive - java

I'm transitioning some tables from Swing to FX.
I am trying to create a custom horizontal oriented TableView kind of like what is asked about here.
I utilized this method to wrap and display my column of data. I did a bind between two table scrollbars to get a "row header". Here is what the entire thing looks like:
Then I checked how well TableView handled loading a large amount of data. I created a basic multiplication table with 10 columns and 100,000 rows. After the initial load-in, the table was incredibly responsive and the vertical scrollbar movement and had no issue.
My issue came when I add more columns. I believe because of the way that TableView expects data to be in rows instead of columns that when I add 10,000 columns and 50 rows the entire TableView component was unresponsive. It also took significantly longer to load-in than the 10 columns, 100k rows.
At ~4k columns and 50 rows, the table responded well to the horizontal scroll, but the vertical was very slow to respond, which is why (apart from the inherent structure) I was lead to believe TableView prefers row data to column.
Is there a way around the unresponsiveness that preferably:
Keeps the columns as the dataset
Doesn't involve going back to JTables
Avoids pagination
I found this post, but it did not seem helpful and the OP went back to JTables in the end. On the other hand, this was 4 years ago and a slightly different case.
Please note I am new to posting so let me know if more info is needed.

Related

Java JFace TableViewer fix/freeze row

I've build an application in Java with the help of JFace/SWT. I am using mainly the TableViewer of JFace and sometime the SWT table behind with myTableViewer.getTable().
My table has a header (filled with the column names) and the first row is rendered with CCombos in CellEditors (drop down menus for filters).
Now I want to fix this first row ("filter-row") in the table, so it is always shown, independently if I am scrolling down or not..
Do you know any opportunity to do this (instead of splitting one table in two tables, as I found it in the internet)?
The SWT Table does not support fixed rows or columns.
If the combos were inteded to hold a limited number of choices you may use context menus on the column headers instead.
There are also alternative Table-like implementations in varying degrees of maturity that you may consider:
Nebula Grid
XViewer
NatTable
If non of the above fits your requirements you will have to either use a distinct table that holds the combo widgets or implement a custom 'header' control.

How to make table with multiple lines per row?

I'm trying to find a way to make a Java table (Swing component) that can wrap the list of columns into multiple lines per row.
/[ Column Hdr A ][ Column Hdr B ]
Hdr |[ Column Hdr C ][columnHdr D ][ColumnHdr E ]
\[ column Hdr F ][COlhdr G][colhdr H][CH I]
/[ Cell 1 A ][ Cell 1 B ]
Row 1|[ Cell 1 C ][cell 1 D ][Cell 1 E ]
\[ Cell 1 F ][Cell 1 G][Cell 1 H][C 1I]
...
Where each column size is independent of any other. IE: I'm not doing spanning or column header grouping. It should retain the column resizing, hiding and sorting features. Drag and drop re-ordering would be nice but isn't necessary.
So I've searched everywhere for something like this. All I've found are various schemes for spanning cells or using fixed width sub-columns. There was one person who claimed to have done it by overriding getRect, but there was no code to look at, so I'm not sure how that would work wrt to resizing or hiding columns, and how would you specify which columns went where?
I've considered just extending TableColumn to include a "sub-row" property but that means also having custom TableColumnModel, JTableHeader and Jtable, AND Jpanel. And I suspect that the renderer and all the LookandFeel UIs would also have to be modified.
An ugly hack that occurred to me is to create one table per sub-row of columns, and then use some form of mutant jpanel to expose the rendered rows interleaved down the y axis. I'm not sure that would work with scroll bars though.
So, does anyone have a neat, concise way to implement this? Any suggestions about how to proceed?
I would hope that you would re-organize the output to be more human readable. While this does fit the data onto the page, a human reading it would have a great deal of problems trying to understand what table cell belonged to what header and which row was which.
Can you create rows with only the 'important' data visible first, then the user could click (or some gesture) to open the more detailed results? Or include multiple cell values together in a multi-line cell to reduce the data to a single row per record?
This gives you two great benefits. First the data will be understandable at a glance, and second, you can use the existing table implementations and save yourself the significant development work.
Finally, have you tried using an HTML widget to display the data? You could create the table as divs in HTML and have the widget wrap the rows. Then you could style the cells for each column to be a fixed width.
I can't offer you any code, but you could look into customizing the table model (class MyTableModel extends AbstractTableModel {...}).
The approach could be to overload the SetValueAt(Object value, int row, int col) method so that writing row 1, col 3 for example would actually write row 2 , col 1 and so on to display multiple lines for 1 line of you data table
Do you indeed need the behaviour which prevents some columns from scrolling?
It is a quite standard usability solution. I would recommend you to come up with a dialog allowing to hide and freeze columns. In this case users could organize the viewport the way they feel best at the moment. Here is an example of scroll freezing.
The second option may well be HTML. You can generate whatever you want this way. Though this solution may have a limitation if you need to edit your data.
Ergonomics uggestions:
Is it acceptable to present headers or data vertically? Sometimes it is better readable.
Basically JTable supports adding swing components including nested tables or cells. please refer to the ff links
com.lang.java.gui discussion
a similar thread

SmartGWT ListGrid large dataset problems

I have a SmartGWT ListGrid with 16 fields each containing Strings. The grid is attached to a data source provided via REST. I am facing issues though when the amount of data in the datasource is large.
When dealing with very small numbers there are no problems, even when dealing with 200,000 records there are still no problems. However when it comes to much larger datasets, for example one I tried earlier had 2.6 million records the grid only displays the first 850,000 (approximatley) records then refuses to page any further. Even more oddly, when my datasource has about 20 million records the grid only displays the first 20 then refuses to page at all.
Strangley I can see the data coming back in my RPC response using the isc.showConsole(); and can see that it is returning the correct data, in fact even when it returns 64 valid records it only displays the first 20. The totalRecords is properly returned as 20 million but it just will not page.
My grid is setup as follows
ListGrid grid = new ListGrid();
DataSource ds = Application.getMyDataSource();
grid.setCriteria(new Criteria("someid", 627263));
grid.setDataSource(ds);
grid.setAutoFetchData(true);
My Datasource is setup correctly as it works perfectly on smaller datasets, each field is created as a DataSourceTextField.
The server side accepts the incomming request, looks for the someid coming in, checks the _startRow, _endRow parameters finds those rows (I'm not using a database for this) and manually sets the startRow, endRow and totalRow fields.
When I inspect the data coming back the data is correct yet the grid refuses to display it correctly.
What am I missing? Is there a maximum size for list grids? From what I've seen they should handle millions of records, yet mine seems to fail completely.
EDIT
Upon further inspection it seems it is an error with the way SmartGWT handles the sizing of the scrollbar. I have no idea how to fix this at the moment.
When scrolling to the bottom of the table on what should be a 2.3 million row table, the last row displayed is 894,785. This is well short of the number of rows expected.
All data coming back from the data source is correct at this point. Interestingly clicking on the last row and scrolling with the down arrow on keyboard works fine, this to me re-enforces the point that it is a scroll bar issue.
In order for progressive loading to work, grid has to be tricked in a way to indicate there's more data.
Since we don't want to draw 1000 empty records (actual totalRows) when only 150 is fetched with data, we need to set totalRows = 160 or something to generate a close enough scroll thumb size, as well as allow scrolling below 150 records, to trigger progressive loading of next page.
Check:
Paging and total dataset length in ResultSet
http://forums.smartclient.com/showthread.php?t=516
http://forums.smartclient.com/showthread.php?t=2750
When you drag the scroll thumb too fast towards the bottom, grid might 'intelligently' skip loading intermediate rows.
ListGrid.showAllRecords might be what you need to check based on http://forums.smartclient.com/showthread.php?t=23638.
That last thread also indicates issues with browsers and large datasets.

set scroll bar position in JTable/SWT Table

I would like to ask question that is not directly related to any technology but it’s a logic level question. Forgive me if I am wrong.
I am trying to solve this issue in Java side.
We have a list view (may be JTable or SWT Table). We are displaying records from a table in to that list. The table may have millions of records. And the table size is keeps increasing. As the table size is huge and it keeps increasing we are keeping a cache of 3000 records and displaying the cache in the table. So at a single point only 3000 records will be there in the view. At this time, the scroll bar of the view (JTable or SWT Table) shall be set based on the cache only (in this case 3000 records).
And based on the user events like, PgUP, PgDwn, DownKey, UpKey, Mouse Scroll etc we are refreshing the cache so that the view will be refreshed.
But we need to give users an actual feel that the scroll position based on the records in the table. I think it is not possible as the scroll position is set by the OS based on the number records in the display. Can somebody can assist me with an alternate method. If I am not explained my question correctly, I will explain this in details. Please help.
Usually a scrollbar is set at the top of the list, or at the bottom, depending on if the property "AutoScroll" is set to true or false.
I believe there IS a method where you can set the scrollbar at a specific point, but last time I tried using it, it was kinda clunky.
It sounds like you're trying to make the scroll bar do two things at once, and that can be confusing. You could use a separate control to the do the paging. A row of buttons in a JToolBar looks nice, but a JComboBox will take up less room. There's some good answers about this here.

Connecting/linking JTable UIs

I have four JTables arranged in a 2x2 square. I want the columns and rows to be connected: when a column on one table is rearranged or resized (by the user or otherwise), I want the same things to happen to the table above or below (in real time); when rows or columns are sorted or highlighted, I want the highlighting to happen in the adjacent table, forming a continuous line of selection.
To the right, the numbered columns are the start of new tables (four tables in all)
To synchronize scrolling, the vertical scroll bars of separate scroll panes can share a common BoundedRangeModel. To synchronize selection, separate tables can share a common ListSelectionModel. The table models must be commensurate. There's an example showing two tables in this Q&A.

Categories

Resources