Kleinere Korrekturen an der CustomizableObjectList
git-svn-id: https://svn.libreccm.org/ccm/trunk@814 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
aa13c461ee
commit
439e2d7630
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -51,27 +51,27 @@ import org.apache.log4j.Logger;
|
||||||
* {@code
|
* {@code
|
||||||
* ...
|
* ...
|
||||||
* <define:component name="itemList"
|
* <define:component name="itemList"
|
||||||
classname="com.arsdigita.london.navigation.ui.object.CustomizableObjectList"/>
|
classname="com.arsdigita.london.navigation.ui.object.CustomizableObjectList"/>
|
||||||
* ...
|
* ...
|
||||||
* <jsp:scriptlet>
|
* <jsp:scriptlet>
|
||||||
CustomizableObjectList objList = (CustomizableObjectList) itemList;
|
CustomizableObjectList objList = (CustomizableObjectList) itemList;
|
||||||
objList.setDefinition(new CMSDataCollectionDefinition());
|
objList.setDefinition(new CMSDataCollectionDefinition());
|
||||||
objList.setRenderer(new CMSDataCollectionRenderer());
|
objList.setRenderer(new CMSDataCollectionRenderer());
|
||||||
objList.getDefinition().setObjectType("com.arsdigita.cms.contenttypes.Publication");
|
objList.getDefinition().setObjectType("com.arsdigita.cms.contenttypes.Publication");
|
||||||
objList.getDefinition().setDescendCategories(false);
|
objList.getDefinition().setDescendCategories(false);
|
||||||
objList.addTextFilter("title", "title");
|
objList.addTextFilter("title", "title");
|
||||||
objList.addTextFilter("authors.surname", "author");
|
objList.addTextFilter("authors.surname", "author");
|
||||||
objList.addSelectFilter("yearOfPublication", "year", true, true, true, true);
|
objList.addSelectFilter("yearOfPublication", "year", true, true, true, true);
|
||||||
objList.addSortField("title", "title asc");
|
objList.addSortField("title", "title asc");
|
||||||
objList.addSortField("yearAsc", "yearOfPublication asc");
|
objList.addSortField("yearAsc", "yearOfPublication asc");
|
||||||
objList.addSortField("yearDesc", "yearOfPublication desc");
|
objList.addSortField("yearDesc", "yearOfPublication desc");
|
||||||
objList.addSortField("authors", "authors.surname asc, authors.givenname asc");
|
objList.addSortField("authors", "authors.surname asc, authors.givenname asc");
|
||||||
objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));
|
objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));
|
||||||
|
|
||||||
objList.getRenderer().setPageSize(20);
|
objList.getRenderer().setPageSize(20);
|
||||||
objList.getRenderer().setSpecializeObjects(true);
|
objList.getRenderer().setSpecializeObjects(true);
|
||||||
|
|
||||||
</jsp:scriptlet>
|
</jsp:scriptlet>
|
||||||
* ...
|
* ...
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
@ -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");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue