我有一个名为newFilter
的rowfilter的以下代码private void newFilter()
{
RowFilter rfb = null;
try //try catch block
{
List<RowFilter<Object,Object>> filtersb = new ArrayList<RowFilter<Object,Object>>(3);
filtersb.add(RowFilter.regexFilter("(?i)"+filterAthID.getText(), 0));
filtersb.add(RowFilter.regexFilter("(?i)"+filterForeName.getText(), 1));
filtersb.add(RowFilter.regexFilter("(?i)"+filterDate.getText(), 2));
rfb = RowFilter.andFilter(filtersb);
if(Blank.isShowing()==true)
{
List<RowFilter<Object,Object>> filters = new ArrayList<RowFilter<Object,Object>>(2);
filters.add(RowFilter.regexFilter("(?i)"+filterForeName.getText(), 1));
filters.add(RowFilter.regexFilter("(?i)"+filterForeName.getText(), 2));
rfb = RowFilter.orFilter(filters);
}
}
catch (java.util.regex.PatternSyntaxException e)
{
return;
}
sorter.setRowFilter(rfb);
}
我尝试组合两个过滤器,以便在显示Blank
时,它将使用andFilter以及orFilter。但是这不起作用,因为rfb一次只能连接一个过滤器。这引出了一个问题,我如何组合两个行过滤器,以便在显示Blank
时系统使用filterAthID
来搜索第0列和 {{1}搜索第1列或 2?