com.vaadin.shared.data.sort.SortDirection Java Examples
The following examples show how to use
com.vaadin.shared.data.sort.SortDirection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SizelessGridTest.java From viritin with Apache License 2.0 | 6 votes |
@Override public Component getTestComponent() { LazyGrid<Person> grid = new LazyGrid<>(Person.class); grid.setColumns("firstName", "lastName", "age"); grid.setItems((List<QuerySortOrder> sortOrder, int offset, int limit) -> { if(sortOrder.size() > 0) { System.err.println("Getting sorted data..."); QuerySortOrder querySortOrder = sortOrder.get(0); boolean asc = querySortOrder.getDirection() == SortDirection.ASCENDING; String prop = querySortOrder.getSorted(); return Service.findAll(offset, limit, prop, asc).stream(); } return Service.findAll(offset, limit).stream(); }); return grid; }
Example #2
Source File: GridUtils.java From viritin with Apache License 2.0 | 6 votes |
private void loadSortOrder() { Callback saveFunc = new Callback() { @Override public void onValueDetected(String value) { List<SortOrder> sortOrderList = new ArrayList<>(); if (!StringUtils.isEmpty(value)) { String[] sortOrder = value.split(SEMI_COLOMN_DELIMITER); for (String so : sortOrder) { String[] colIdWithSort = so.split(COLOMN_DELIMITER); Object propertyId = colIdWithSort[0]; SortDirection direction = SortDirection.valueOf( colIdWithSort[1]); SortOrder soCreated = new SortOrder(propertyId, direction); sortOrderList.add(soCreated); } } grid.setSortOrder(sortOrderList); } }; BrowserCookie.detectCookieValue(SORT_ORDER_SETTINGS_NAME, saveFunc); }
Example #3
Source File: WebWrapperUtils.java From cuba with Apache License 2.0 | 5 votes |
public static SortDirection convertToGridSortDirection(DataGrid.SortDirection sortDirection) { checkNotNullArgument(sortDirection); switch (sortDirection) { case ASCENDING: return SortDirection.ASCENDING; case DESCENDING: return SortDirection.DESCENDING; default: throw new IllegalArgumentException("Can't be converted to SortDirection: " + sortDirection); } }
Example #4
Source File: WebWrapperUtils.java From cuba with Apache License 2.0 | 5 votes |
public static DataGrid.SortDirection convertToDataGridSortDirection(SortDirection sortDirection) { checkNotNullArgument(sortDirection); switch (sortDirection) { case ASCENDING: return DataGrid.SortDirection.ASCENDING; case DESCENDING: return DataGrid.SortDirection.DESCENDING; default: throw new IllegalArgumentException("Can't be converted to SortDirection: " + sortDirection); } }
Example #5
Source File: PhoneBookService.java From jpa-addressbook with The Unlicense | 5 votes |
/** * Finds a set of entries from database with given filter, starting from * given row. The "page size" (aka max results limit passed for the query) * is 45. * * @param filter the filters string * @param firstRow the first row to be fetched * @param maxresults maximum number of results * @return */ public List<PhoneBookEntry> getEntriesPaged(String filter, int firstRow, int maxresults, List<QuerySortOrder> sortOrder) { QueryResult<PhoneBookEntry> qr = entryRepo.findByNameLikeIgnoreCase("%" + filter + "%"); for (QuerySortOrder qso : sortOrder) { if(qso.getDirection() == SortDirection.ASCENDING) { qr = qr.orderAsc(qso.getSorted()); } else { qr = qr.orderDesc(qso.getSorted()); } } return qr .firstResult(firstRow).maxResults(maxresults) .getResultList(); }