org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider Java Examples

The following examples show how to use org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider. 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 6 votes vote down vote up
@Override
public SortableDataProvider<ODocument, String> prepareDataProviderForProperty(
		OProperty property, IModel<ODocument> documentModel) {
	SortableDataProvider<ODocument, String> provider;
	if(CustomAttribute.CALCULABLE.getValue(property, false))
	{
		String sql = CustomAttribute.CALC_SCRIPT.getValue(property);
		sql = sql.replace("?", ":doc");
		provider = new OQueryDataProvider<ODocument>(sql).setParameter("doc", documentModel);
	}
	else
	{
		provider =  new ODocumentLinksDataProvider(documentModel, property);
	}
	OClass linkedClass = property.getLinkedClass();
	defineDefaultSorting(provider, linkedClass);
	return provider;
}
 
Example #2
Source File: ODocumentLinksDataProvider.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
protected SortableDataProvider<ODocument, String> delegate() {
	if(thisRunProvider==null)
	{
		if(useQueryProvider())
		{
			if(queryProvider==null) queryProvider = new ODocumentLinksQueryDataProvider(docModel, propertyModel) {
				private static final long serialVersionUID = 1L;

				@Override
				public SortParam<String> getSort() {
					return ODocumentLinksDataProvider.this.getSort();
				}
			};
			thisRunProvider = queryProvider;
		}
		else
		{
			if(javaSortableProvider==null) javaSortableProvider = new ODocumentLinksJavaSortableDataProvider<String>(docModel, propertyModel){
				private static final long serialVersionUID = 1L;

				@Override
				public SortParam<String> getSort() {
					return ODocumentLinksDataProvider.this.getSort();
				}
			};
			thisRunProvider = javaSortableProvider;
		}
	}
	return thisRunProvider;
}
 
Example #3
Source File: OClassIntrospector.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@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 #4
Source File: RunHistoryPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 #5
Source File: MonitorPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 #6
Source File: MonitorPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
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 #7
Source File: SearchEntityPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
protected AjaxCheckTablePanel<Entity> createTablePanel(EntityListDataProvider dataProvider) {
     SortableDataProvider<Entity, String> sortableDataProvider = new SortableDataAdapter<Entity>(dataProvider);
     return new AjaxCheckTablePanel<Entity>("table", createTableColumns(), sortableDataProvider, 10) {
     	
private static final long serialVersionUID = 1L;

@Override
protected boolean isCheckable(IModel<Entity> rowModel) {
         	return !StorageUtil.isSystemPath(rowModel.getObject().getPath());
         }

     };
 }
 
Example #8
Source File: SortableDataProviderComparator.java    From syncope with Apache License 2.0 4 votes vote down vote up
public SortableDataProviderComparator(final SortableDataProvider<T, String> provider) {
    this.provider = provider;
}
 
Example #9
Source File: SortableAnyProviderComparator.java    From syncope with Apache License 2.0 4 votes vote down vote up
public SortableAnyProviderComparator(final SortableDataProvider<T, String> provider) {
    super(provider);
}
 
Example #10
Source File: TimesheetMassUpdatePage.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
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 #11
Source File: AddressCampaignValueMassUpdatePage.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
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);
}
 
Example #12
Source File: ForwardingDataProvider.java    From wicket-orientdb with Apache License 2.0 votes vote down vote up
protected abstract SortableDataProvider<T,S> delegate(); 
Example #13
Source File: IOClassIntrospector.java    From Orienteer with Apache License 2.0 votes vote down vote up
public SortableDataProvider<ODocument, String> prepareDataProviderForProperty(OProperty property, IModel<ODocument> documentModel); 
Example #14
Source File: IOClassIntrospector.java    From Orienteer with Apache License 2.0 votes vote down vote up
public void defineDefaultSorting(SortableDataProvider<ODocument, String> provider, OClass oClass);