package com.onaro.util.jfc.tables.filter; import java.util.List; import com.onaro.util.jfc.tables.FilterTable; import com.onaro.util.jfc.tables.filter.matcher.FilterMatcher; import com.onaro.util.jfc.tables.filter.matcher.MatchRange; /** * Abstract class that delegates the parsing and matching of the filter to * the passed in FilterMatcherFactory. * */ public class AbstractFactoryFilter extends AbstractFilter implements FilterEditorProvider { private FilterMatcherFactory factory; private FilterMatcher matcher; public AbstractFactoryFilter(FilterMatcherFactory factory) { this.factory = factory; } @Override protected void parsePattern() throws FilterException { if (isActive()) { matcher = factory.parse(this.pattern.toString()); } } public boolean isAccepted(Object value) { return matcher.isAccepted(value); } public List getAcceptedRange(Object value) { return matcher.getAcceptedRange(value); } public AbstractFilterEditor createEditor(FilterTable table, int selectedColumnInModel) { return new TextFieldFilterEditor(table, selectedColumnInModel, this); } }