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 187789 - TableCellEditor.isCellEditable() is not called.
Summary: TableCellEditor.isCellEditable() is not called.
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on: 186672
Blocks:
  Show dependency tree
 
Reported: 2010-06-18 13:58 UTC by Martin Entlicher
Modified: 2010-07-16 07:42 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2010-06-18 13:58:52 UTC
When TableRendererModel provides TableCellEditor, it's isCellEditable() is not called, because it's replaced with TableRendererModel.canEditCell() by the implementation.
There are cases when TableCellEditor needs to decide whether it will actually edit the cell or not based on the event and therefore TableRendererModel.canEditCell() is not sufficient.
Comment 1 Martin Entlicher 2010-06-18 15:16:45 UTC
Fixed in changeset:   173233:84ca576c42f5
http://hg.netbeans.org/main/rev/84ca576c42f5

Also the test demonstrates how can the event be used to make the cell conditionally editable based of the click location:
        @Override
        public boolean isCellEditable(EventObject anEvent) {
            if (anEvent.getSource() instanceof JTable) {
                JTable table = (JTable) anEvent.getSource();
                if (anEvent instanceof MouseEvent) {
                    MouseEvent event = (MouseEvent) anEvent;
                    Point p = event.getPoint();
                    int row = table.rowAtPoint(p);
                    int col = table.columnAtPoint(p);
                    Rectangle rect = table.getCellRect(row, col, true);
                    p.translate(-rect.x, -rect.y);
                    System.out.println("isCellEditable("+anEvent+")");
                    System.out.println("Point "+p+"in rectangle "+rect);
                    if (p.x > rect.width - 24) {
                        // last 24 points not editable
                        return false;
                    }
                }
            }
            return true;
        }
Comment 2 Quality Engineering 2010-06-19 03:38:08 UTC
Integrated into 'main-golden', will be available in build *201006190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/84ca576c42f5
User: mentlicher@netbeans.org
Log: #187789 Call TableCellEditor.isCellEditable() and in the test we demonstrate how the cell can be made conditionally editable.
Comment 3 rbalada 2010-06-21 16:01:19 UTC
Please verify bugfix for this bug, so it can be integrated into release691 repository.

Thanks,
-R
Comment 4 Marian Mirilovic 2010-06-22 07:55:51 UTC
Do not see any regression in 201006220001 - verified
Comment 5 rbalada 2010-06-22 15:40:56 UTC
I've prepared combined change in branch debugger_ports in release691 repository.
Comment 6 rbalada 2010-06-24 21:59:45 UTC
Integrated into release691 repository

changeset:   171826:8890faf51fd3
branch:      debugger_ports
parent:      171804:c30febb9fe6d
user:        mentlicher@netbeans.org
date:        Fri Jun 18 16:37:35 2010 +0200
summary:     #187789 Call TableCellEditor.isCellEditable() and in the test we demonstrate how the cell can be made conditionally editable.
Comment 7 Marian Mirilovic 2010-07-16 07:42:01 UTC
verified in the source code