Or orFilter = new Or();
for (FilterSet : filter filterSet) {
if (filter.isEnabled())
orFilter.add(filter.getFilter());
}
Because I got checkboxes, so a user can filter the table, but creating Or-Filters for every possibility is an ugly and long task.
Perhaps you can create the filters you need (one per checkbox?), and just instantiate a new Or filter when the filtering changes (using the Or(Filters… filters) constructor)?
You could reset the Or filter (via instantiation) each time, unless you want to go the custom route of course. If you check the implementation you’ll see that the member field filters is an unmodifiable list. You can of course call getFilters, make a copy, add/remove filters as you please, and then reset/create a new Or filter.
Thank you for your help, it worked but it’s quite an odd task …
containerSubsequent.removeContainerFilter(or);
Collection<Container.Filter> f1 = new ArrayList<Container.Filter>(or.getFilters());
f1.add(filter1); // .remove(filter1);
or = new Or(f1.toArray(new Container.Filter[0]
));
containerSubsequent.addContainerFilter(or);