Skip to content

Commit

Permalink
modify SortableDataProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
dpmihai committed Feb 15, 2016
1 parent c48d3f6 commit 48e8fac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.List;

import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
Expand All @@ -33,7 +33,7 @@
/**
* @author Decebal Suiu
*/
public class ReportJobInfoDataProvider extends SortableDataProvider<ReportJobInfo, String> {
public class ReportJobInfoDataProvider implements IDataProvider<ReportJobInfo> {

private static final long serialVersionUID = 1L;

Expand Down
11 changes: 9 additions & 2 deletions src/ro/nextreports/server/web/monitor/MonitorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
Expand Down Expand Up @@ -60,6 +62,7 @@
import ro.nextreports.server.web.common.table.BaseTable;
import ro.nextreports.server.web.common.table.BooleanImagePropertyColumn;
import ro.nextreports.server.web.common.table.DateColumn;
import ro.nextreports.server.web.common.table.SortableDataAdapter;
import ro.nextreports.server.web.core.table.NextRunDateColumn;
import ro.nextreports.server.web.report.RunHistoryPanel;
import ro.nextreports.server.web.schedule.ActiveSchedulerJobDataProvider;
Expand Down Expand Up @@ -114,11 +117,15 @@ public MonitorPanel(String id) {
}

protected DataTable<ReportJobInfo, String> createJobsTable(ReportJobInfoDataProvider dataProvider) {
return new BaseTable<ReportJobInfo>("jobsTable", createJobsTableColumns(), dataProvider, Integer.MAX_VALUE);
SortableDataProvider<ReportJobInfo, String> sortableDataProvider = new SortableDataAdapter<ReportJobInfo>(dataProvider);
sortableDataProvider.setSort("startDate", SortOrder.ASCENDING);
return new BaseTable<ReportJobInfo>("jobsTable", createJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE);
}

protected DataTable<SchedulerJob, String> createSchedulerJobsTable(ActiveSchedulerJobDataProvider dataProvider) {
return new BaseTable<SchedulerJob>("schedulerJobsTable", createActiveSchedulerJobsTableColumns(), dataProvider, Integer.MAX_VALUE);
SortableDataProvider<SchedulerJob, String> sortableDataProvider = new SortableDataAdapter<SchedulerJob>(dataProvider);
sortableDataProvider.setSort("nextRun", SortOrder.ASCENDING);
return new BaseTable<SchedulerJob>("schedulerJobsTable", createActiveSchedulerJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE);
}

protected List<IColumn<ReportJobInfo, String>> createJobsTableColumns() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.util.Iterator;
import java.util.List;

import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
Expand All @@ -34,7 +34,7 @@
* Date: 11-Jun-2010
* Time: 11:54:39
*/
public class ActiveSchedulerJobDataProvider extends SortableDataProvider<SchedulerJob, String> {
public class ActiveSchedulerJobDataProvider implements IDataProvider<SchedulerJob> {

private static final long serialVersionUID = 1L;

Expand Down

0 comments on commit 48e8fac

Please sign in to comment.