}
if (setMap.size() > 0) {
List<String> sets = new ArrayList<String>(setMap.keySet());
Collections.sort(sets);
for (String set : sets) {
filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", set,
setMap.get(set).get()), "set", set, params));
}
// divider
filters.add(new DropDownMenuItem());
}
// user's team memberships
if (user != null && user.teams.size() > 0) {
List<TeamModel> teams = new ArrayList<TeamModel>(user.teams);
Collections.sort(teams);
for (TeamModel team : teams) {
filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", team.name,
team.repositories.size()), "team", team.name, params));
}
// divider
filters.add(new DropDownMenuItem());
}
// custom filters
String customFilters = app().settings().getString(Keys.web.customFilters, null);
if (!StringUtils.isEmpty(customFilters)) {
boolean addedExpression = false;
List<String> expressions = StringUtils.getStringsFromValue(customFilters, "!!!");
for (String expression : expressions) {
if (!StringUtils.isEmpty(expression)) {
addedExpression = true;
filters.add(new DropDownToggleItem(null, "x", expression, params));
}
}
// if we added any custom expressions, add a divider
if (addedExpression) {
filters.add(new DropDownMenuItem());