Search in sources :

Example 1 with SortInfo

use of com.haulmont.cuba.gui.data.CollectionDatasource.Sortable.SortInfo in project cuba by cuba-platform.

the class SortableCollectionDsWrapper method sort.

@Override
public void sort(Object[] propertyId, boolean[] ascending) {
    List<SortInfo> infos = new LinkedList<>();
    for (int i = 0; i < propertyId.length; i++) {
        final MetaPropertyPath propertyPath = (MetaPropertyPath) propertyId[i];
        final SortInfo<MetaPropertyPath> info = new SortInfo<>();
        info.setPropertyPath(propertyPath);
        info.setOrder(ascending[i] ? Order.ASC : Order.DESC);
        infos.add(info);
    }
    SortInfo[] sortInfos = infos.toArray(new SortInfo[infos.size()]);
    ((CollectionDatasource.Sortable) datasource).sort(sortInfos);
}
Also used : MetaPropertyPath(com.haulmont.chile.core.model.MetaPropertyPath) LinkedList(java.util.LinkedList) SortInfo(com.haulmont.cuba.gui.data.CollectionDatasource.Sortable.SortInfo)

Example 2 with SortInfo

use of com.haulmont.cuba.gui.data.CollectionDatasource.Sortable.SortInfo in project cuba by cuba-platform.

the class SortableDataGridIndexedCollectionDsWrapper method sort.

@Override
public void sort(Object[] propertyId, boolean[] ascending) {
    List<SortInfo> infos = new LinkedList<>();
    for (int i = 0; i < propertyId.length; i++) {
        final MetaPropertyPath propertyPath = (MetaPropertyPath) propertyId[i];
        final SortInfo<MetaPropertyPath> info = new SortInfo<>();
        info.setPropertyPath(propertyPath);
        info.setOrder(ascending[i] ? Order.ASC : Order.DESC);
        infos.add(info);
    }
    SortInfo[] sortInfos = infos.toArray(new SortInfo[infos.size()]);
    ((CollectionDatasource.Sortable) datasource).sort(sortInfos);
}
Also used : MetaPropertyPath(com.haulmont.chile.core.model.MetaPropertyPath) LinkedList(java.util.LinkedList) SortInfo(com.haulmont.cuba.gui.data.CollectionDatasource.Sortable.SortInfo)

Aggregations

MetaPropertyPath (com.haulmont.chile.core.model.MetaPropertyPath)2 SortInfo (com.haulmont.cuba.gui.data.CollectionDatasource.Sortable.SortInfo)2 LinkedList (java.util.LinkedList)2