Hey Keith --
Awesome news! As for your question, Glazed Lists regrettably does not have such an interface. I do think it is a great idea though.
Currently, we have something similar:
Code:
public abstract class AbstractFilterList extends TransformedList {
public abstract boolean filterMatches(Object o);
public void handleFilterChanged();
...
}
The largest difference between this and a traditional constraint is that the filter can change over time. Consider the text filter in iTunes. As the user enters text, the filter changes what matches to only what includes the typed String. Therefore this 'constraint' must occasionally force the entire list to be re-filtered.
Of course, supporting constraints would only require the following code:
Code:
public class ConstraintFilterList extends AbstractFilterList {
private List constraints = new ArrayList();
public void addConstraint(Constraint c) {
constraints.add(c);
handleFilterChanged();
}
public void removeConstraint(Constraint c) {
constraints.remove(c);
handleFilterChanged();
}
public boolean filterMatches(Object o) {
for(int c = 0; c < constraints.size(); c++) {
Constraint constraint = constraints.get(c);
if(!constraint.test(o)) return false;
}
return true;
}
}
Well I've written enough code for a Friday night! I look forward to working with you and the Spring RCP team!
Jesse