Weiteres Feintuning des CategoryFilter

git-svn-id: https://svn.libreccm.org/ccm/trunk@2341 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-10-08 14:09:26 +00:00
parent e36ecd9b7a
commit 722892e912
1 changed files with 13 additions and 6 deletions

View File

@ -118,12 +118,14 @@ public class CategoryFilter {
multipleElem.setText("false"); multipleElem.setText("false");
} }
if (!multiple) {
for (String value : values) { for (String value : values) {
if (!catNameToCatId.containsKey(value)) { if (!catNameToCatId.containsKey(value)) {
invalid.newChildElement("value").setText(value); invalid.newChildElement("value").setText(value);
invalidFound = true; invalidFound = true;
} }
} }
}
filter.addContent(categoriesElem); filter.addContent(categoriesElem);
if (invalidFound) { if (invalidFound) {
@ -138,7 +140,7 @@ public class CategoryFilter {
final StringBuffer searchString) { final StringBuffer searchString) {
final Element elem = new Element("category"); final Element elem = new Element("category");
elem.addAttribute("id", category.getID().toString()); elem.addAttribute("id", category.getID().toString());
//if ((values != null) && !values.isEmpty() && values.contains(category.getID().toString())) { if (multiple) {
if ((values != null) && !values.isEmpty() && values.contains(category.getName())) { if ((values != null) && !values.isEmpty() && values.contains(category.getName())) {
elem.addAttribute("selected", "selected"); elem.addAttribute("selected", "selected");
if (searchString.length() > 0) { if (searchString.length() > 0) {
@ -146,6 +148,11 @@ public class CategoryFilter {
} }
searchString.append(category.getName()); searchString.append(category.getName());
} }
} else {
if ((values != null) && !values.isEmpty() && values.contains(category.getID().toString())) {
elem.addAttribute("selected", "selected");
}
}
elem.setText(category.getName()); elem.setText(category.getName());
parent.addContent(elem); parent.addContent(elem);
} }