@Override public void sort(Object[] propertyIds, boolean[] ascendingFlags) { // A datasource supports sort only by single property Preconditions.checkArgument(propertyIds.length == 1); Preconditions.checkArgument(ascendingFlags.length == 1); MetaPropertyPath propertyPath = (MetaPropertyPath) propertyIds[0]; boolean ascending = ascendingFlags[0]; SortInfo<MetaPropertyPath> info = new SortInfo<>(); info.setPropertyPath(propertyPath); info.setOrder(ascending ? Order.ASC : Order.DESC); getSortableDatasource().sort(new SortInfo[]{info}); }
@Override public void sort(Object[] propertyIds, boolean[] ascendingFlags) { // table support sort only by one property Preconditions.checkArgument(propertyIds.length == 1); MetaPropertyPath propertyPath = (MetaPropertyPath) propertyIds[0]; boolean ascending = ascendingFlags[0]; SortInfo<MetaPropertyPath> info = new SortInfo<>(); info.setPropertyPath(propertyPath); info.setOrder(ascending ? Order.ASC : Order.DESC); getSortableDatasource().sort(new SortInfo[] {info}); }
protected void sortProcActors() { CollectionDatasource.Sortable.SortInfo procRoleOrderSortInfo = new CollectionDatasource.Sortable.SortInfo(); procRoleOrderSortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC); procRoleOrderSortInfo.setPropertyPath(procActorsDs.getMetaClass().getPropertyPath("procRole.order")); CollectionDatasource.Sortable.SortInfo procActorOrderSortInfo = new CollectionDatasource.Sortable.SortInfo(); procActorOrderSortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC); procActorOrderSortInfo.setPropertyPath(procActorsDs.getMetaClass().getPropertyPath("order")); ((CollectionDatasource.Sortable) procActorsDs).sort(new CollectionDatasource.Sortable.SortInfo[]{procRoleOrderSortInfo, procActorOrderSortInfo}); } }
protected void sortParametersByPosition() { MetaClass metaClass = metadata.getClassNN(ReportInputParameter.class); MetaPropertyPath mpp = new MetaPropertyPath(metaClass, metaClass.getProperty("position")); CollectionDatasource.Sortable.SortInfo<MetaPropertyPath> sortInfo = new CollectionDatasource.Sortable.SortInfo<>(); sortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC); sortInfo.setPropertyPath(mpp); parametersDs.sort(new CollectionDatasource.Sortable.SortInfo[]{sortInfo}); }
protected void sortTableDsByItemsOrderNum() { if (listComponent.getDatasource() instanceof CollectionDatasource.Sortable) { CollectionDatasource.Sortable.SortInfo sortInfo = new CollectionDatasource.Sortable.SortInfo(); sortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC); sortInfo.setPropertyPath(listComponent.getSingleSelected().getMetaClass().getPropertyPath("orderNum")); ((CollectionDatasource.Sortable) listComponent.getDatasource()).sort(new CollectionDatasource.Sortable.SortInfo[]{sortInfo}); } }
protected void sortSeriesByOrder() { CollectionDatasource.Sortable.SortInfo<MetaPropertyPath> sortInfo = new CollectionDatasource.Sortable.SortInfo<>(); sortInfo.setOrder(CollectionDatasource.Sortable.Order.ASC); sortInfo.setPropertyPath(seriesDs.getMetaClass().getPropertyPath("order")); seriesDs.sort(new CollectionDatasource.Sortable.SortInfo[]{sortInfo}); } }