[ xframe-Bugs-1178013 ] Wrong isCellEditable concept

"SourceForge.net" <[email protected]> Wed, 18 May 2005 17:12:23 -0700
Newsgroups gmane.text.xml.xframe.xsddoc
Message-ID <[email protected]>
Bugs item #1178013, was opened at 2005-04-06 21:05
Message generated for change (Settings changed) made by kriede
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1178013&group_id=48863

Category: JXTable
Group: swing
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Iñaqui Medina (inaquimj)
Assigned to: Iñaqui Medina (inaquimj)
Summary: Wrong isCellEditable concept

Initial Comment:
Another one... (You need to include me in your project, 
at least as tester :)

Right now JXTable's isCellEditable is implemented as:

public boolean isCellEditable(final int row, final int 
column) {
    if (column < frozenColumns) {
        return lockedTable.isCellEditable(row, column);
    } else {
        return scrollTable.isCellEditable(row, column - 
frozenColumns);
    }
}

Which would make sence except for one thing: normally 
to make cells editable in a table you override this 
function and return true.

The problem is that no one calls isCellEditable (the 
KTables' methods are being called by swing instead).

So we need to:

1. Change JXTable's to:

public boolean isCellEditable(final int row, final int 
column) {
    return false;
}

2. We need to give more information to the KTables. I 
find it easier than to change te constructors to create a 
method:

public void init(final JXTable table, final boolean 
isScrollTable)
{
    this.table = table;
    this.isScrollTable = isScrollTable;
}

3. In JXTable call it right after creating them:

lockedTable = new KTable(model, cm1, sm);
((KTable)lockedTable).init(this, false);
scrollTable = new KTable(model, cm2, sm);
((KTable)scrollTable).init(this, true);

4. Modify KTable's method:

public boolean isCellEditable(int row, int column)
{
    return table.isCellEditable(row, isScrollTable ? 
column + table.getFrozenColumns() : column);
}

I have done this changes and it works on children of 
JXTable that override the method.

I don't have comments and you may want to do this in a 
different way so I'm posting the bug. If you want I can 
become part of the project, comment and commit :)


----------------------------------------------------------------------

Comment By: Kurt Riede (kriede)
Date: 2005-04-09 14:48

Message:
Logged In: YES 
user_id=484961

Your solution is now checked-in and available in CVS.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1178013&group_id=48863


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click