Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 187789 - TableCellEditor.isCellEditable() is not called.
TableCellEditor.isCellEditable() is not called.
Status: VERIFIED FIXED
Product: debugger
Classification: Unclassified
Component: Code
6.x
PC Linux
: P3 (vote)
: 6.x
Assigned To: Martin Entlicher
issues@debugger
69patch1-verified
:
Depends on: 186672
Blocks:
  Show dependency treegraph
 
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
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo