8387267: Editor for the last column in JTable is hard to activate after AUTO_RESIZE_LAST_COLUMN was configured#31704
Open
prsadhuk wants to merge 1 commit into
Open
8387267: Editor for the last column in JTable is hard to activate after AUTO_RESIZE_LAST_COLUMN was configured#31704prsadhuk wants to merge 1 commit into
prsadhuk wants to merge 1 commit into
Conversation
…er AUTO_RESIZE_LAST_COLUMN was configured
|
👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When JTable.setAutoResizeMode is called with JTable.AUTO_RESIZE_LAST_COLUMN,
it is supposed to adjust the delta width to the last column only when table itself changes width
but before JDK-8234071 fix, AUTO_RESIZE_LAST_COLUMN, was behaving exactly as if user specified AUTO_RESIZE_ALL_COLUMNS
so width of all columns of table gets adjusted.
JDK-8234071 fixes this issue by setting "resizingColumn" to last column when AUTO_RESIZE_LAST_COLUMN is specified so that only last column gets resized
but the fix was wrongly instructing the JTable that the user is currently resizing the last column with the mouse
so JTable started believing a header resize was active even during normal layout, window resizing or cell editing
thus it caused side-effects like initial preferred column widths was ignored as seen in JDK-8375573
and real mouse resizing of another column was conflicting with the “last column is resizing” state as mousePressed/Released uses "resizingColumn" to ensure a certain column is getting resized
and editing is disturbed because JTable thought column resizing/layout activity is happening as seen in this particular issue.
The issue is that a left click on an editable cell starts editing and then selects the cell.
Selecting the cell scrolls it into view, which revalidates the table and runs doLayout().
Because the header now permanently reports a resizing column, the layout pass adjusts a column's preferred width
and fires TableColumnModelListener.columnMarginChanged(). JTable.columnMarginChanged() stops the active cell editor.
Also, after a user drags the first column header divider, resizingColumn is reset to null in
BasicTableHeaderUI.mouseReleasedandJTable then syncs preferred widths from actual widths using
setWidthsFromPreferredWidths(true).Later, when the dialog is resized,
setWidthsFromPreferredWidths(false)runs again and all columns are recalculated so AUTO_RESIZE_LAST_COLUMN was not honouredFix is made to handle AUTO_RESIZE_LAST_COLUMN in the layout code
so the width distribution logic ensures that
During normal window/dialog resize: change is made only to the last column.
During initial layout: honors the user’s preferred widths, then let the last column absorbs extra space.
During real header drag: allows the dragged column to resize, and uses the last column to compensate.
and it doesn't hamper editing of any cell in last column when double-clicked
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31704/head:pull/31704$ git checkout pull/31704Update a local copy of the PR:
$ git checkout pull/31704$ git pull https://git.openjdk.org/jdk.git pull/31704/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31704View PR using the GUI difftool:
$ git pr show -t 31704Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31704.diff
Using Webrev
Link to Webrev Comment