-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non responsive UI related to big JTable vs selection #654
Comments
I took another look at the cell border logic, and I don't understand the intent... Here is a modified test case with full row selection and 2 editable cells (this test case is NOT to show the original problem): Here is what I get when I change selection. Orange point shows which cell has the focus, red outline in image 8 shows the 2 cells that are editable: Questions:
More generally, what is the cell border class trying to achieve by checking the editable cells in selection? |
- was black - now derived from selection color (usually accent color) - darker in light themes - lighter in dark themes (issue #654)
Thanks for reporting. That was not my best work 😞
The idea for this logic was to hide the focus indicator border (the black rectangle) when it is not needed, This black rectangle looks simply ugly and in most cases, if table is not editable, it is useless IMHO.
Because none of the selected cells in first row are editable.
Because cell 2_2 is selected and editable.
Because in image 7, there is a selected editable cell in row 3. Anyway, I agree that this is very confusing. Made some changes in commit d27a246 to hopefully make it less confusing and to fix the performance issue:
So editable checking is now limited to a single row and to maximum 50 cells. |
Thanks, the performance issue is solved! As for the logic of cell focus, I am still confused. In the test case As a workaround, we activated Perhaps the behavior of cell selection mode should be different from row or column selection mode. In cell selection mode, focus should be shown only when there is more that one cell that is selected (which internally means >= 2 rows, or >= 2 columns). |
There is another reason that focus border is always shown in last column, which is of type boolean.
But
And the FlatLaf code to hide focus border is in Fixed this in commit 2e878b6 |
That's what the current implementation does (but only for rows). In the meantime I think that it would be better to never show focus in cell selection mode. In row selection mode it is different because always all cells of a row are selected. Here it makes sense to show focus if there is an editable cell in that row. |
- never for cell selection mode - for single selected column if contains editable cell
Have reworked the code again in commit d530624 (hopefully the last time). The cell focus is now shown under following conditions:
To avoid possible performance issues, checking for editable cells is limited to 50. If there are more cells to check, the focus indicator is always shown. |
This is perfect! Great job ! 😉 |
We have a complex component that is a table with a tree structure and some frozen columns. We now need to display lots of data. With FlatLaf, the UI is unresponsive when there is an active selection. This does not happen with the system look and feel.
Try it with this test case, click to select a cell and use page up/down to navigate:
BigSelectableTableTest.zip
The reason is that in our complex component, there is cell remapping taking place between tree nodes and on screen rows. It is not a free operation. I found that this line triggers remapping for each row:
FlatLaf/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableCellBorder.java
Line 138 in 875083a
I guess one first optimization would be to not run the second part of the algorithm if the first part returned false and both row and column selections are turned on. Still, I wonder if this can be improved altogether... Imagine the above sample with millions of rows! 😉
Let me know what you think and do let me know if I can be of any help...
And keep up the good work! 😃
The text was updated successfully, but these errors were encountered: