| Author |
Applying a range filter to RowFilter
|
Matthew Tilic
Ranch Hand
Joined: Apr 07, 2011
Posts: 41
|
|
Hi,
I have a JTable with some delightful information that needs to be filtered. I have applied a row filter successfully to a single column and filtered it to search for a value e.g. 205, however, I would like to search a range of data 205-250 and find all the values in this column that are anywhere in-between.
secondly I will then want to apply extra filters on top later. e.g. search a range of data in column 1 with that data being successfully found re-filter that with another set of parameters based on column2.
Thanks
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
Matthew Tilic wrote:I would like to search a range of data 205-250 and find all the values in this column that are anywhere in-between.
secondly I will then want to apply extra filters on top later.
You can find the answers to both parts of your question in the documentation for RowFilter.
|
 |
Matthew Tilic
Ranch Hand
Joined: Apr 07, 2011
Posts: 41
|
|
|
So I have to override the include method! Is their a way so that I do not have to do this
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
Matthew Tilic wrote:Is their a way so that I do not have to do this
Don't know, and to be honest I don't care. The RowFilter API provides a clean, adequately documented way to achieve the goal; why look for anything else?
|
 |
Matthew Tilic
Ranch Hand
Joined: Apr 07, 2011
Posts: 41
|
|
|
Because I still think it looks ugly when applying multiple filters as its to much code for someone when they come to edit it at a later date
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
Matthew Tilic wrote:Because I still think it looks ugly when applying multiple filters as its to much code for someone when they come to edit it at a later date
Not if you break it up into separate classes, each well documented, and use RowFilter#andFilter(...).
Any other approach, if you can find one, is IMHO going to be even less readable.
|
 |
 |
|
|
subject: Applying a range filter to RowFilter
|
|
|