Search in sources :

Example 1 with SortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider in project midpoint by Evolveum.

the class ContainerableListPanel method setDefaultSorting.

protected void setDefaultSorting(ISelectableDataProvider<C, PO> provider) {
    if (provider instanceof SortableDataProvider && isCollectionViewPanel() && getObjectCollectionView().getPaging() != null && getObjectCollectionView().getPaging().getOrderBy() != null) {
        PagingType paging = getObjectCollectionView().getPaging();
        boolean ascending = !OrderDirectionType.DESCENDING.equals(paging.getOrderDirection());
        ItemPath orderBy = paging.getOrderBy().getItemPath();
        ItemName name = orderBy.lastName();
        if (name == null) {
            return;
        }
        ((SortableDataProvider) provider).setSort(new SortParam(name.getLocalPart(), ascending));
    }
}
Also used : PagingType(com.evolveum.prism.xml.ns._public.query_3.PagingType) ItemName(com.evolveum.midpoint.prism.path.ItemName) SortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam)

Aggregations

ItemName (com.evolveum.midpoint.prism.path.ItemName)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 PagingType (com.evolveum.prism.xml.ns._public.query_3.PagingType)1 SortParam (org.apache.wicket.extensions.markup.html.repeater.util.SortParam)1 SortableDataProvider (org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider)1