+ if ((currentSone != null) && "show-only".equals(followedSones)) {
+ knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
+
+ @Override
+ public boolean filterObject(Sone sone) {
+ return currentSone.hasFriend(sone.getId());
+ }
+ });
+ templateContext.set("followedSones", "show-only");
+ } else if ((currentSone != null) && "hide".equals(followedSones)) {
+ knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
+
+ @Override
+ public boolean filterObject(Sone sone) {
+ return !currentSone.hasFriend(sone.getId());
+ }
+ });
+ templateContext.set("followedSones", "hide");
+ }
+ if ("name".equals(sortField)) {
+ if ("desc".equals(sortOrder)) {
+ Collections.sort(knownSones, new ReverseComparator<Sone>(Sone.NICE_NAME_COMPARATOR));
+ } else {
+ Collections.sort(knownSones, Sone.NICE_NAME_COMPARATOR);
+ }
+ templateContext.set("sort", "name");
+ templateContext.set("order", "desc".equals(sortOrder) ? "desc" : "asc");
+ } else if ("activity".equals(sortField)) {
+ if ("asc".equals(sortOrder)) {
+ Collections.sort(knownSones, new ReverseComparator<Sone>(Sone.LAST_ACTIVITY_COMPARATOR));
+ } else {
+ Collections.sort(knownSones, Sone.LAST_ACTIVITY_COMPARATOR);
+ }
+ templateContext.set("sort", "activity");
+ templateContext.set("order", "asc".equals(sortOrder) ? "asc" : "desc");
+ }