Kleinere Korrekturen an der CustomizableObjectList

git-svn-id: https://svn.libreccm.org/ccm/trunk@814 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-04-01 07:20:01 +00:00
parent aa13c461ee
commit 439e2d7630
2 changed files with 25 additions and 32 deletions

View File

@ -140,7 +140,7 @@ public class CompareFilter implements Filter {
Element option; Element option;
option = filter.newChildElement("option"); option = filter.newChildElement("option");
option.addAttribute(label, ALL); option.addAttribute("label", ALL);
} }
Element option; Element option;

View File

@ -99,17 +99,15 @@ public class CustomizableObjectList extends ComplexObjectList {
* preserve the insertation order. * preserve the insertation order.
* *
*/ */
private final Map<String, Filter> filters = new LinkedHashMap<String, Filter>(); private final Map<String, Filter> filters =
new LinkedHashMap<String, Filter>();
/** /**
* The available sort fields. We use an {@link LinkedHashMap} here to * The available sort fields. We use an {@link LinkedHashMap} here to
* preserve the insertation order. * preserve the insertation order.
* *
*/ */
private final Map<String, String> sortFields = new LinkedHashMap<String, String>(); private final Map<String, String> sortFields =
/** new LinkedHashMap<String, String>();
* Sort by which property?
*/
private String sortBy = null;
/** /**
* Adds a new text filter to the list. * Adds a new text filter to the list.
@ -295,13 +293,8 @@ public class CustomizableObjectList extends ComplexObjectList {
//collection (if it is a valid value). If no sort parameter is found, //collection (if it is a valid value). If no sort parameter is found,
//use the first sort field as default. //use the first sort field as default.
String sortByKey = request.getParameter("sort"); String sortByKey = request.getParameter("sort");
sortBy = sortFields.get(sortByKey); if (!sortFields.containsKey(sortByKey)) {
if (((sortBy == null)
|| sortBy.isEmpty()
|| !sortFields.containsKey(sortBy))
&& !sortFields.isEmpty()) {
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0); sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
sortBy = new ArrayList<String>(sortFields.values()).get(0);
} }
Element controls = content.newChildElement("controls"); Element controls = content.newChildElement("controls");