@Override public void courseSelected(CourseRec course) { selected = course; sortedElements.clear(); if (selected != null) sortedElements.addAll(selected.getOfferings()); Collections.sort( sortedElements, new Comparator<OffRec>() { @Override public int compare(OffRec o1, OffRec o2) { if (o1.getStart() == null) { if (o2.getStart() != null) return 1; return o1.getId().compareTo(o2.getId()); } else { if (o2.getStart() == null) return -1; return o1.getStart().compareTo(o2.getStart()); } } }); this.fireTableDataChanged(); }
@Override public boolean accept(CourseRec rec) { if (!this.active || rec.getCategories().isEmpty()) return true; for (DescRec r : rec.getCategories()) if (selected.contains(r)) return true; return false; }