diff --git a/src/java/com/threerings/admin/client/TabbedDSetEditor.java b/src/java/com/threerings/admin/client/TabbedDSetEditor.java index b2c16d505..2187569d5 100644 --- a/src/java/com/threerings/admin/client/TabbedDSetEditor.java +++ b/src/java/com/threerings/admin/client/TabbedDSetEditor.java @@ -53,24 +53,23 @@ public class TabbedDSetEditor extends JPanel public static abstract class EntryGrouper { /** - * Record & return the group for a given entry. + * Subclasses implement the actual logic to figure out a group names from an entry here. */ - public String getGroup (E entry) - { - String group = computeGroup(entry); - _allGroups.add(group); - return group; - } + protected abstract String[] computeGroups (E entry); /** - * Subclasses implement the actual logic to figure out a group name from an entry here. + * Returns a predicate that returns true if the given entry is in the given group. */ - protected abstract String computeGroup (E entry); - protected Predicate getPredicate (final String group) { return new Predicate() { public boolean apply (E entry) { - return group.equals(getGroup(entry)); + String[] groups = computeGroups(entry); + for (String g: groups) { + if (g.equals(group)) { + return true; + } + } + return false; } }; } @@ -81,7 +80,10 @@ public class TabbedDSetEditor extends JPanel */ public void computeGroups (Iterable entries) { for (E entry : entries) { - getGroup(entry); + String[] groups = computeGroups(entry); + for (String group : groups) { + _allGroups.add(group); + } } } @@ -116,19 +118,18 @@ public class TabbedDSetEditor extends JPanel } @Override - protected String computeGroup (E entry) { + protected String[] computeGroups (E entry) { try { - return StringUtil.toString(_field.get(entry)); + return new String[] { StringUtil.toString(_field.get(entry)) }; } catch (IllegalAccessException iae) { // This ain't good, but let's soldier on. - return ""; + return new String[] { "" }; } } protected final Field _field; } - /** * Convenience function to make an edittor that groups based on the values of a given field. */