-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8234071: JTable.AUTO_RESIZE_LAST_COLUMN acts like AUTO_RESIZE_ALL_COLUMNS #20107
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
Conversation
👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into |
@prsadhuk This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 138 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't LAST_COLUMN is meant to be different than specifying a particular column ?
Suppose the app specified the resizing column and expects it to be unchanged after changing mode back to a previous mode ?
If the app changes the mode would it really expect now a particular column to be specified ?
Is a specific test going to be hard ?
No one actually routinely manually tests this in SwingSet, and we don't do integration testing any more.
Webrevs
|
As per the Regarding test, I am not able to think of any automated way to test this, so if it can be manual, then I thought it will be as good to test it out through SwingSet2 since manual tests also is run only during ATR... |
I have a doubt for auto resize property, similar behavior is holding true for Is it the correct behavior ? If not, shouldn't Otherwise current fix is working as expected for |
if (columnModel.getColumnCount() > 0) { | ||
tableHeader.setResizingColumn( | ||
columnModel.getColumn(columnModel.getColumnCount() - 1)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check added to guard against the possibility of DefaultTableColumnModel.getColumn
, which according to spec, can throw AIOBE
if columnIndex is out of range: (columnIndex < 0 || columnIndex >= getColumnCount())
Not sure about the spec you are referring to? It seems to behave similarly with and without this fix, although it may not be what the spec is demanding..It is not similar to LAST_COLUMN spec so cannot be handled along with it..I guess it's a separate issue, if it is one... |
I was referring to the description of
Yeah, that's what I was trying to say that changes may be required for It is not similar to LAST_COLUMN spec so cannot be handled along with it..I guess it's a separate issue, if it is one... |
if (mode == JTable.AUTO_RESIZE_LAST_COLUMN) { | ||
if (columnModel.getColumnCount() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditions can be combined
if (mode == JTable.AUTO_RESIZE_LAST_COLUMN && columnModel.getColumnCount() > 0) {
"boundary" or divider between adjacent cells being independently adjustable |
@prrace Need your re-review please..I guess skara is modified to ask for reapproval after PR change (added AIOBE check) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
/integrate |
Going to push as commit 902bada.
Your commit was automatically rebased without conflicts. |
When a JTable is resized with
JTable.setAutoResizeMode
set toAUTO_RESIZE_LAST_COLUMN
then it behaves exactly as if I specifiedAUTO_RESIZE_ALL_COLUMNS
.This is because when
JTable.doLayout
tries to resize the columns, it checks which column to resize by callinggetResizingColumn
and in absence of any column info, it resizes all, so duringsetAutoResizeMode
the resizing column needs to be set, which is being done for AUTO_RESIZE_LAST_COLUMN in this fix.No regression test is provided as it can be easily checked with SwingSet2->JTable(demo)->Autoresize mode (set to "Last Column")
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20107/head:pull/20107
$ git checkout pull/20107
Update a local copy of the PR:
$ git checkout pull/20107
$ git pull https://git.openjdk.org/jdk.git pull/20107/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20107
View PR using the GUI difftool:
$ git pr show -t 20107
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20107.diff
Webrev
Link to Webrev Comment