RFR: JDK-6998249: Wrong behavior/Javadoc of JTable.tableChanged(TableModelEvent e)

Harshitha Onkar duke at openjdk.java.net
Fri Jan 28 20:07:07 UTC 2022


On Fri, 28 Jan 2022 03:17:42 GMT, Phil Race <prr at openjdk.org> wrote:

>> @prrace Should all instances of "code tags" (entire JTable) changed to {@code...} or for the tableChanged method only?
>> I was not able to understand the last point clearly. Can you please elaborate?
>
> I said most of the doc is changing which is clearly not most of the doc for JTable so it means just this method.
> 
> To the latter point the doc you are proposing is asserting that it does not apply to rows.
> Now since we also know this is all supposed to be code called ny the implementation and responded to by the implementation and even so we are NOT going to change anything because some code somewhere would break, nontheless we want to be sure the new code is what actually happens and not just what someone wrote in a  bug report several years ago. So go find the code that calls "new TableModelEvent" and point in this PR to how it guarantees the rows are in view order.

@prrace After going through the code, I see that the `new TableModelEvent()` is called in setModel of JTable but I wasn't able to locate the code that does model-to-view coordinate mapping for rows from here. Within the `tableChanged` method I see `sortedTableChanged` method being called if ` sortManager != null ` which in turn calls `convertRowIndexToView` method (which is called when either sorter or model changes and sorting is enabled). I think this is the method that is responsible for mapping coordinate system from model to view for the rows.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7253



More information about the client-libs-dev mailing list