coderazzi / tablefilter-swing

TableFilter is a set of Swing components to support user-driven filtering on table.
https://coderazzi.net/tablefilter
MIT License
7 stars 2 forks source link

Wrong filter value when AutoChoices is enabled #39

Closed coderazzi closed 9 years ago

coderazzi commented 9 years ago

Original report by Antoine Guillou (Bitbucket: [Antoine Guillou](https://bitbucket.org/Antoine Guillou), ).


Hey Luis, Thanks for your great filter!

I noticed a problem when filtering a column which has:

In the example above, filtered the column "Double" with ">=3" and click anywhere in the table. Then the filter value become "5"....

#!java

    public static void main(String args[]) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Object rowData[][] = { { "Str1" , true, new Double(1) },
                { "Str2" , true, new Double(2) },
                { "Str3" , false, new Double(3) },
                { "Str4" , true, new Double(4) },
                { "Str5" , false, new Double(5) } };
        Object columnNames[] = { "String", "BOO", "Double" };

        DefaultTableModel model = new DefaultTableModel(rowData, columnNames);

        JTable table = new JTable(model);

        ExtendedCoderazziFilter jFilter_RunsTable = new com.meta.coderazziextension.ExtendedCoderazziFilter( table, net.coderazzi.filters.gui.AutoChoices.DISABLED);

        jFilter_RunsTable.getFilterEditor( 2 ).setAutoChoices( net.coderazzi.filters.gui.AutoChoices.ENABLED );

        JScrollPane scrollPane = new JScrollPane(table);
        frame.add(scrollPane, BorderLayout.CENTER);
        frame.setSize(300, 150);
        frame.setVisible(true);

    }
coderazzi commented 9 years ago

Original comment by coderazzi coderazzi (Bitbucket: coderazzi, GitHub: coderazzi).


Confirmed the issue. Checking the problem....

coderazzi commented 9 years ago

Original comment by coderazzi coderazzi (Bitbucket: coderazzi, GitHub: coderazzi).


Hi, Antoine, thanks for submitting the issue; I am using a slightly different code that makes no usage of your ExtendedCoderazziFilter.

#!java

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import net.coderazzi.filters.*;
import net.coderazzi.filters.gui.*;

public class Issue_39 {
    public static void main(String args[]) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Object rowData[][] = { { "Str1" , true, new Double(1) },
                { "Str2" , true, new Double(2) },
                { "Str3" , false, new Double(3) },
                { "Str4" , true, new Double(4) },
                { "Str5" , false, new Double(5) } };
        Object columnNames[] = { "String", "BOO", "Double" };

        DefaultTableModel model = new DefaultTableModel(rowData, columnNames);

        JTable table = new JTable(model);

        TableFilterHeader jFilter_RunsTable = new TableFilterHeader( table, net.coderazzi.filters.gui.AutoChoices.DISABLED);

        jFilter_RunsTable.getFilterEditor( 2 ).setAutoChoices( net.coderazzi.filters.gui.AutoChoices.ENABLED );

        JScrollPane scrollPane = new JScrollPane(table);
        frame.add(scrollPane, BorderLayout.CENTER);
        frame.setSize(300, 150);
        frame.setVisible(true);

    }
}

It still shows the same error you report...

coderazzi commented 9 years ago

Original comment by coderazzi coderazzi (Bitbucket: coderazzi, GitHub: coderazzi).


It is now solved on the last commited version. I will upload it to Maven asap...

coderazzi commented 9 years ago

Original comment by coderazzi coderazzi (Bitbucket: coderazzi, GitHub: coderazzi).


Version 5.1.5 is now available on Maven central repositories

coderazzi commented 9 years ago

Original comment by Antoine Guillou (Bitbucket: [Antoine Guillou](https://bitbucket.org/Antoine Guillou), ).


I confirmed that the problem is solved. Thanks :+1: