This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 240958

Summary: Focused cell reset to [0,0] in dataview after cell edit
Product: db Reporter: matthias42
Component: Show DataAssignee: Libor Fischmeistr <lfischmeistr>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH_AVAILABLE
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: proposed patch v1

Description matthias42 2014-01-25 18:40:01 UTC
Hey,

last week @work I had to edit some data in our databases and was annoyed, by the fact, that I could not just use my keyboard efficiently:

1. I selected the relevant data
2. I opened the first column to edit by clicking on it
3. I wanted to change the following values in the same column by pressing "enter" to go to the next row, same column.

This would be the normal behaviour of a JTable, but the focus return to cell at [0,0] after editing a cell. This can be tracked back to:

JXTableRowHeader.CountingTableModel#setCount

That method is invoked via JXTableRowHeader#tableModelListener on every change to the underlying table.

setCount now propagates that event as a TableModelEvent to all listeners.

This causes JTable#sortedTableChanged to be called. That determines, that the whole table changed (no row indices are provided in the call described above) and this causes JTable to clear the selection. The selectionModel of the headerTable and the mainTable are connected (JXTableRowHeader -> construtor -> headerTable.setSelectionModel).

The fix just makes sure, that in setCount the update and event generation are only done, if the count really differs.
Comment 1 matthias42 2014-01-25 18:41:24 UTC
Created attachment 144367 [details]
proposed patch v1
Comment 2 Libor Fischmeistr 2014-01-27 10:02:47 UTC
Patch applied: http://hg.netbeans.org/core-main/rev/311361e0bfe6

Thank you
Comment 3 Quality Engineering 2014-01-28 03:04:59 UTC
Integrated into 'main-silver', will be available in build *201401280001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/311361e0bfe6
User: Libor Fischmeistr <lfischmeistr@netbeans.org>
Log: #240958: Focused cell reset to [0,0] in dataview after cell edit