Table of Contents
With all issues on screen it's already time to remove some of them!
Your users can filter the table simply by entering words into a
JTextField, just like in Apple iTunes. Text filtering is a fast
and easy way to find a needle in a haystack!
You need to tell Glazed Lists which Strings to filter against for
each element in your EventList. Implement the
TextFilterator interface by adding all the
relevant Strings from
Issue to the List
provided.
import java.util.List; // glazed lists import ca.odell.glazedlists.TextFilterator; // a simple issues library import ca.odell.issuezilla.*; /** * Get the Strings to filter against for a given Issue. * * @author <a href="mailto:jesse@odel.on.ca">Jesse Wilson</a> */ public class IssueTextFilterator implements TextFilterator { public void getFilterStrings(List baseList, Object element) { Issue issue = (Issue)element; baseList.add(issue.getComponent()); baseList.add(issue.getIssueType()); baseList.add(issue.getOperatingSystem()); baseList.add(issue.getResolution()); baseList.add(issue.getShortDescription()); baseList.add(issue.getStatus()); baseList.add(issue.getSubcomponent()); baseList.add(issue.getVersion()); } }
The getFilterStrings() method is awkward
because the List of
Strings is a parameter rather than the return
type. This approach allows Glazed Lists to skip creating an
ArrayList each time the method is invoked.
We're generally averse to this kind of micro-optimization. In this
case this performance improvement is worthwhile because the method is
used heavily while filtering.