Java Code Examples for javax.swing.RowFilter#andFilter()

The following examples show how to use javax.swing.RowFilter#andFilter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableDemo.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected void configureFilters() {
    if (showOnlyWinners && hasFilterString()) {
        List<RowFilter<OscarTableModel, Integer>> filters =
                new ArrayList<RowFilter<OscarTableModel, Integer>>(2);
        filters.add(winnerFilter);
        filters.add(searchFilter);
        RowFilter<OscarTableModel, Integer> comboFilter = RowFilter.andFilter(filters);
        sorter.setRowFilter(comboFilter);
    } else if (showOnlyWinners) {
        sorter.setRowFilter(winnerFilter);
    } else if (hasFilterString()) {
        sorter.setRowFilter(searchFilter);
    } else {
        sorter.setRowFilter(null);
    }
    tableStatus.setText((hasFilterString() ? searchLabelString : statusLabelString)
            + oscarTable.getRowCount());

}
 
Example 2
Source File: TableDemo.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
protected void configureFilters() {
	if (showOnlyWinners && hasFilterString()) {
		List<RowFilter<OscarTableModel, Integer>> filters = new ArrayList<RowFilter<OscarTableModel, Integer>>(
				2);
		filters.add(winnerFilter);
		filters.add(searchFilter);
		// RowFilter<Object, Object> comboFilter =
		// RowFilter.andFilter(filters);
		RowFilter<OscarTableModel, Integer> comboFilter = RowFilter
				.<OscarTableModel, Integer> andFilter(filters);
		sorter.setRowFilter(comboFilter);
	} else if (showOnlyWinners) {
		sorter.setRowFilter(winnerFilter);
	} else if (hasFilterString()) {
		sorter.setRowFilter(searchFilter);
	} else {
		sorter.setRowFilter(null);
	}
	tableStatus.setText((hasFilterString() ? searchLabelString
			: statusLabelString) + oscarTable.getRowCount());

}
 
Example 3
Source File: FilterTextParser.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private RowFilter<Object, Object> andExpr() throws Exception {
	ArrayList<RowFilter<Object, Object>> filters = new ArrayList<RowFilter<Object, Object>>();
	filters.add(primaryExpr());
	while (getNextChar() == '&') {
		index++;
		if (getNextChar() != '&') { throw new ParseException("& token is missing", index); }
		index++;
		filters.add(primaryExpr());
	}
	if (filters.size() == 1) { return filters.get(0); }
	return RowFilter.andFilter(filters);
}
 
Example 4
Source File: PhonebookUI.java    From Spark with Apache License 2.0 5 votes vote down vote up
private void filterTable(String text)
{
	String filterString = text;
	
	ArrayList<RowFilter<TableModel, Object>> andFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length);
	ArrayList<RowFilter<TableModel, Object>> subFilter;
	RowFilter<TableModel, Object> rf;
	RowFilter<TableModel, Object> rf0;

	try
	{
		subFilter = new ArrayList<RowFilter<TableModel, Object>>(1); //split.length);

		for (Integer i = 0; i < model.getColumnCount(); i++)
		{
			rf0 = RowFilter.regexFilter("^(?i)" + filterString, i);
			subFilter.add(rf0);
		}
		rf = RowFilter.orFilter(subFilter);

		andFilter.add(rf);
	}
	catch (PatternSyntaxException pse)
	{
		Log.error(pse);
	}

	RowFilter<TableModel, Object> rowf = RowFilter.andFilter(andFilter);
	sorter.setRowFilter(rowf);
}