Skip to main content

JXTable: compile problem (generics) when using RowFilter

4 replies [Last post]
ana
Offline
Joined: 2004-05-04
Points: 0

Hi,

I've switched to java 1.6 and swingx 1.6.2 and I'm trying to get fitlering to work the 1.6 way. And I'm not even getting it to compile.

Following code

JXTable table = new JXTable(new DefaultTableModel());
RowFilter<DefaultTableModel,Integer> rowFilter = new RowFilter<DefaultTableModel, Integer>()
{
@Override
public boolean include(Entry<? extends DefaultTableModel, ? extends Integer> entry)
{
return true;
}
};
table.setRowFilter(rowFilter);

produces a compile error:

setRowFilter(javax.swing.RowFilter<? super javax.swing.table.TableModel,? super java.lang.Integer>) in org.jdesktop.swingx.JXTable cannot be applied to (javax.swing.RowFilter<javax.swing.table.DefaultTableModel,java.lang.Integer>)
[javac] table.setRowFilter(rowFilter);

However

TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<DefaultTableModel>();
table.setRowSorter(sorter);
sorter.setRowFilter(rowFilter);

works. But surely this interferes with JXtable's SortController or something.

What is please the correct way to do it?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

I am not getting a compiler error.  I am building with Eclipse using the latest JDK 1.6.0_20 on Windows XP.

Karl

ana
Offline
Joined: 2004-05-04
Points: 0

Hi,

after reading your answer (and switching jdks with no change in behaviour) I pulled the latest code from svn and that fixed the compile problem. Looking at the JXTable history, it's been working correctly since version 3826 of the file (Issue 1349-swingx: JXTable/JXList fix generics in setRowFilter).

But this fix is definitely not in release 1.6.2. Is there a newer release that I've missed? If not. when is the next release planned?

Ana

kleopatra
Offline
Joined: 2003-06-11
Points: 0

1.6.2 is the most recent release, no idea when there will be the next - javaone, maybe?

Cheers
Jeanette

kschaefe
Offline
Joined: 2006-06-08
Points: 0

There are a few more Mavenization issues, I'd like to clean up before the next release. This is the main reason that it is taking so long. Once we have properly partitioned via Maven we shouldn't have to do it again.

We could make a release sooner, but then we'd have more class migrations to different Maven modules for the next release too.  I really want to limit that, but it may be better to just release, as we have had a lot of fixes since 1.6.2.

Karl