List<FieldComparator> comparators = new ArrayList<FieldComparator>();
comparators.add(new FieldComparator("author"));
comparators.add(new FieldComparator("year"));
comparators.add(new FieldComparator(BibtexFields.KEY_FIELD));
// Use glazed lists to get a sorted view of the entries:
BasicEventList entryList = new BasicEventList();
// Set up a list of all entries, if keySet==null, or the entries whose
// ids are in keySet, otherwise:
if (keySet == null)
entryList.addAll(database.getEntries());
else {
for (String key : keySet)
entryList.add(database.getEntryById(key));
}
entries = new SortedList(entryList, new FieldComparatorStack(comparators));
}