Java Code Examples for org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider#setSort()
The following examples show how to use
org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider#setSort() .
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: OClassIntrospector.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void defineDefaultSorting(SortableDataProvider<ODocument, String> provider, OClass oClass) { if(oClass==null) return; OProperty property = CustomAttribute.SORT_BY.getValue(oClass); Boolean order = CustomAttribute.SORT_ORDER.getValue(oClass); SortOrder sortOrder = order==null?SortOrder.ASCENDING:(order?SortOrder.ASCENDING:SortOrder.DESCENDING); if(property==null) { if(order==null) provider.setSort(null); else provider.setSort("@rid", sortOrder); } else { provider.setSort(property.getName(), sortOrder); } }
Example 2
Source File: RunHistoryPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<RunReportHistory, String> createRunHistoryTable(RunReportHistoryDataProvider dataProvider) { SortableDataProvider<RunReportHistory, String> sortableDataProvider = new SortableDataAdapter<RunReportHistory>( dataProvider); sortableDataProvider.setSort("endDate", SortOrder.DESCENDING); return new BaseTable<RunReportHistory>("runHistoryTable", createHistoryTableColumns(), sortableDataProvider, rowsPerPage); }
Example 3
Source File: MonitorPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<ReportJobInfo, String> createJobsTable(ReportJobInfoDataProvider dataProvider) { SortableDataProvider<ReportJobInfo, String> sortableDataProvider = new SortableDataAdapter<ReportJobInfo>( dataProvider); sortableDataProvider.setSort("startDate", SortOrder.ASCENDING); return new BaseTable<ReportJobInfo>("jobsTable", createJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE); }
Example 4
Source File: MonitorPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<SchedulerJob, String> createSchedulerJobsTable(ActiveSchedulerJobDataProvider dataProvider) { SortableDataProvider<SchedulerJob, String> sortableDataProvider = new SortableDataAdapter<SchedulerJob>( dataProvider); sortableDataProvider.setSort("nextRun", SortOrder.ASCENDING); return new BaseTable<SchedulerJob>("schedulerJobsTable", createActiveSchedulerJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE); }
Example 5
Source File: TimesheetMassUpdatePage.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public TimesheetMassUpdatePage(final AbstractSecuredPage callerPage, final List<TimesheetDO> timesheets) { super(new PageParameters(), callerPage); this.timesheets = timesheets; form = new TimesheetMassUpdateForm(this); Integer taskId = null; for (final TimesheetDO sheet : timesheets) { if (taskId == null) { taskId = sheet.getTaskId(); } else if (taskId.equals(sheet.getTaskId()) == false) { taskId = null; break; } } if (taskId != null) { // All time sheets have the same task, so pre-select this task. timesheetDao.setTask(form.data, taskId); } body.add(form); form.init(); final List<IColumn<TimesheetDO, String>> columns = TimesheetListPage.createColumns(this, false, true, null, taskTree, userFormatter, dateTimeFormatter); @SuppressWarnings("serial") final SortableDataProvider<TimesheetDO, String> sortableDataProvider = new SortableDataProvider<TimesheetDO, String>() { public Iterator<TimesheetDO> iterator(final long first, final long count) { final SortParam sp = getSort(); final Comparator<TimesheetDO> comp = new MyBeanComparator<TimesheetDO>(sp.getProperty().toString(), sp.isAscending()); Collections.sort(timesheets, comp); return timesheets.subList((int)first, (int)(first + count)).iterator(); } public long size() { return timesheets != null ? timesheets.size() : 0; } public IModel<TimesheetDO> model(final TimesheetDO object) { return new Model<TimesheetDO>() { @Override public TimesheetDO getObject() { return object; } }; } }; sortableDataProvider.setSort("startTime", SortOrder.DESCENDING); final DefaultDataTable<TimesheetDO, String> dataTable = new DefaultDataTable<TimesheetDO, String>("table", columns, sortableDataProvider, 1000); body.add(dataTable); }
Example 6
Source File: AddressCampaignValueMassUpdatePage.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
public AddressCampaignValueMassUpdatePage(final AbstractSecuredPage callerPage, final List<AddressDO> addresses, final AddressCampaignDO addressCampaign, final Map<Integer, PersonalAddressDO> personalAddressMap, final Map<Integer, AddressCampaignValueDO> addressCampaignValueMap) { super(new PageParameters(), callerPage); this.addresses = addresses; form = new AddressCampaignValueMassUpdateForm(this, addressCampaign); body.add(form); form.init(); final List<IColumn<AddressDO, String>> columns = AddressCampaignValueListPage.createColumns(this, false, true, null, personalAddressMap, addressCampaignValueMap); @SuppressWarnings("serial") final SortableDataProvider<AddressDO, String> sortableDataProvider = new SortableDataProvider<AddressDO, String>() { @Override public Iterator< ? extends AddressDO> iterator(final long first, final long count) { final SortParam sp = getSort(); if (addresses == null) { return null; } final Comparator<AddressDO> comp = new MyBeanComparator<AddressDO>(sp.getProperty().toString(), sp.isAscending()); Collections.sort(addresses, comp); return addresses.subList((int)first, (int)(first + count)).iterator(); } public long size() { return addresses != null ? addresses.size() : 0; } public IModel<AddressDO> model(final AddressDO object) { return new Model<AddressDO>() { @Override public AddressDO getObject() { return object; } }; } }; sortableDataProvider.setSort("name", SortOrder.DESCENDING); final DefaultDataTable<AddressDO, String> dataTable = new DefaultDataTable<AddressDO, String>("table", columns, sortableDataProvider, 1000); body.add(dataTable); }