本文整理汇总了Java中org.apache.wicket.markup.repeater.data.IDataProvider类的典型用法代码示例。如果您正苦于以下问题:Java IDataProvider类的具体用法?Java IDataProvider怎么用?Java IDataProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDataProvider类属于org.apache.wicket.markup.repeater.data包,在下文中一共展示了IDataProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public Workbook generate(IDataProvider<? extends User> dataProvider) {
Sheet sheet = createSheet(localize(SHEET_NAME_RESOURCE_KEY));
int rowIndex = 0;
// Headers
addHeadersToSheet(sheet, rowIndex, columns);
++rowIndex;
// Rows
Iterator<? extends User> iterator = dataProvider.iterator(0, Integer.MAX_VALUE);
while (iterator.hasNext()) {
Row currentRow = sheet.createRow(rowIndex);
populateRow(currentRow, HibernateUtils.unwrap(iterator.next()));
++rowIndex;
}
finalizeSheet(sheet, columns);
return workbook;
}
示例2: getMetaDataProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<T> getMetaDataProvider(final Class<T> clazz) {
return new IDataProvider<T>() {
@Override
public Iterator<T> iterator(long first, long count) {
return service.
getAllAscendingByName(clazz, first, count).iterator();
}
@Override
public long size() {
return service.countAll(clazz);
}
@Override
public IModel<T> model(T object) {
return Model.of(object);
}
@Override
public void detach() {
}
};
}
示例3: getMembershipProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<TeamMembership> getMembershipProvider(final Team team) {
return new IDataProvider<TeamMembership>() {
@Override
public Iterator<? extends TeamMembership> iterator(long first, long count) {
// TODO take into account first and count
return team.getMembers().iterator();
}
@Override
public long size() {
return team.getMembers().size();
}
@Override
public IModel<TeamMembership> model(TeamMembership object) {
return Model.of(object);
}
@Override
public void detach() {
}
};
}
示例4: getMembershipProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<TeamMembership> getMembershipProvider(final Team team) {
return new IDataProvider<TeamMembership>() {
@Override
public Iterator<? extends TeamMembership> iterator(long first, long count) {
return team.getMembers().iterator();
}
@Override
public long size() {
return team.getMembers().size();
}
@Override
public IModel<TeamMembership> model(TeamMembership object) {
return Model.of(object);
}
@Override
public void detach() {
}
};
}
示例5: productsProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<ProductInfo> productsProvider() {
return new IDataProvider<ProductInfo>() {
@Override
public Iterator<ProductInfo> iterator(long first, long count) {
return productListModel.getObject().iterator();
}
@Override
public long size() {
return productListModel.getObject().size();
}
@Override
public IModel<ProductInfo> model(ProductInfo product) {
return Model.of(product);
}
@Override
public void detach() {
}
};
}
示例6: productDataProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<ProductInfo> productDataProvider(IModel<List<ProductInfo>> model) {
return new IDataProvider<ProductInfo>() {
@Override
public Iterator<ProductInfo> iterator(long first, long count) {
return model.getObject().iterator();
}
@Override
public long size() {
return model.getObject().size();
}
@Override
public IModel<ProductInfo> model(ProductInfo object) {
return Model.of(object);
}
@Override
public void detach() {
}
};
}
示例7: addDataView
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private void addDataView(String id, final String className, IDataProvider<ArtifactBean> dataProvider) {
// Data view
final DataView<ArtifactBean> artifactDataView = new ArtifactBeanDataView("dataView", dataProvider);
dataViews.add(artifactDataView);
// Fragment
Fragment fragment = new Fragment(id, "dataViewFragment", this) {
private static final long serialVersionUID = 1L;
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(artifactDataView.getDataProvider().size() != 0);
}
};
fragment.add(new Label("title", new ResourceModel("artifact.follow.pom." + id)),
artifactDataView);
add(fragment);
}
示例8: ArtifactSearchResultsPanel
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public ArtifactSearchResultsPanel(String id, final IDataProvider<ArtifactBean> dataProvider) {
super(id);
add(new Label("title", new ResourceModel("artifact.follow.search.results.title")));
dataView = new ArtifactBeanDataView("artifacts", dataProvider, configurer.getArtifactSearchItemsPerPage());
add(
dataView,
new HideablePagingNavigator("pager", dataView)
.add(new EnclosureContainer("pager"))
);
add(new WebMarkupContainer("emptyList") {
private static final long serialVersionUID = 6700720373087584498L;
@Override
public boolean isVisible() {
return dataProvider.size() == 0;
}
});
}
示例9: onUpdateHeader
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
/**
* This method is called after select all checkbox is clicked
* @param target
* @param selected
* @param table
*/
protected void onUpdateHeader(AjaxRequestTarget target, boolean selected, DataTable table) {
IDataProvider provider = table.getDataProvider();
if (!(provider instanceof BaseSortableDataProvider)) {
LOGGER.debug("Select all checkbox work only with {} provider type. Current provider is type of {}.",
new Object[]{BaseSortableDataProvider.class.getName(), provider.getClass().getName()});
}
//update selected flag in model dto objects based on select all header state
BaseSortableDataProvider baseProvider = (BaseSortableDataProvider) provider;
List<T> objects = baseProvider.getAvailableData();
for (T object : objects) {
if (object instanceof Selectable) {
Selectable selectable = (Selectable) object;
selectable.setSelected(selected);
}
}
//refresh rows with ajax
ComponentHierarchyIterator iterator = table.visitChildren(SelectableDataTable.SelectableRowItem.class);
while (iterator.hasNext()) {
SelectableDataTable.SelectableRowItem row = (SelectableDataTable.SelectableRowItem) iterator.next();
if (!row.getOutputMarkupId()) {
//we skip rows that doesn't have outputMarkupId set to true (it would fail)
continue;
}
target.add(row);
}
}
示例10: SearchResultsHeaderPanel
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public SearchResultsHeaderPanel(String id, IModel<QueryFacetsSelection> model, AbstractPageableView<SolrDocument> resultsView, IDataProvider<SolrDocument> solrDocumentProvider) {
super(id, model);
this.solrDocumentProvider = solrDocumentProvider;
this.resultsView = resultsView;
add(createSearchInfoLabel("searchInfo"));
add(createQuerySelectionItems("querySelection"));
// form to select number of results per page
add(createResultPageSizeForm("resultPageSizeForm", resultsView));
//For Ajax updating of search results
setOutputMarkupId(true);
}
示例11: FieldsTablePanel
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public FieldsTablePanel(String id, IDataProvider<DocumentField> fieldProvider) {
super(id);
add(new DataView<DocumentField>("documentField", fieldProvider) {
@Override
protected void populateItem(final Item<DocumentField> item) {
final IModel<DocumentField> fieldModel = item.getModel();
final PropertyModel<String> fieldNameModel = new PropertyModel<String>(fieldModel, "fieldName");
final SolrFieldNameModel friendlyFieldNameModel = new SolrFieldNameModel(fieldNameModel);
final Label fieldName = new Label("fieldName", friendlyFieldNameModel);
item.add(fieldName);
fieldName.add(new AttributeAppender("title", new SolrFieldDescriptionModel(fieldNameModel)));
final PropertyModel<List> valuesModel = new PropertyModel<List>(fieldModel, "values");
item.add(new ListView("values", valuesModel) {
@Override
protected void populateItem(final ListItem fieldValueItem) {
// add a label that holds the field value
fieldValueItem.add(createValueLabel("value", fieldNameModel, fieldValueItem.getModel()));
// add a link for selecting the value in the search
fieldValueItem.add(createFacetSelectLink("facetSelect", fieldNameModel, fieldValueItem.getModel()));
}
});
// if field has multiple values, set 'multiple' class on markup element
item.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (valuesModel.getObject().size() > 1) {
return "multiplevalues";
} else {
return null;
}
}
}));
}
});
}
示例12: PageablePortfolioPanel
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public PageablePortfolioPanel(String id, IDataProvider<E> dataProvider, int itemsPerPage,
String countResourceKey) {
super(id, dataProvider, itemsPerPage);
this.countResourceKey = countResourceKey;
countModel = new PropertyModel<Integer>(dataProvider,
CoreWicketMoreBindings.iBindableDataProvider().size().getPath());
}
示例13: AbstractGenericItemListPanel
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
public AbstractGenericItemListPanel(String id, IDataProvider<T> dataProvider, long itemsPerPage) {
super(id);
this.setOutputMarkupId(true);
this.dataProvider = dataProvider;
dataView = new OddEvenDataView<T>("item", dataProvider, itemsPerPage) {
private static final long serialVersionUID = 8487422965167269031L;
@Override
protected void populateItem(final Item<T> item) {
final IModel<T> itemModel = item.getModel();
AbstractGenericItemListPanel.this.addItemColumns(item, itemModel);
item.add(getActionButtonsPanel("actionButtons", itemModel));
}
};
add(dataView);
add(new WebMarkupContainer("emptyList") {
private static final long serialVersionUID = 6700720373087584498L;
@Override
public boolean isVisible() {
return dataView.getDataProvider().size() == 0;
}
});
}
示例14: createDataProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<Member> createDataProvider( List<String> members )
{
ListDataProvider<Member> results;
if ( CollectionUtils.isNotEmpty( members ) )
{
Collections.sort( members, new Comparator<String>()
{
@Override
public int compare(String m1, String m2)
{
return m1.compareToIgnoreCase( m2 );
}
} );
int ctr = 0;
List<Member> tableMembers = new ArrayList<>();
for ( String member : members )
{
Member tableMember = new Member();
tableMember.setUserDn( member );
tableMember.setIndex( ++ctr );
tableMembers.add( tableMember );
}
results = new ListDataProvider<>( tableMembers );
}
else
{
results = new ListDataProvider<>( new ArrayList<Member>() );
}
return results;
}
示例15: createDataProvider
import org.apache.wicket.markup.repeater.data.IDataProvider; //导入依赖的package包/类
private IDataProvider<RequestMod> createDataProvider( List<RequestMod> mods )
{
ListDataProvider<RequestMod> results;
if ( CollectionUtils.isNotEmpty( mods ) )
{
results = new ListDataProvider<>( mods );
}
else
{
results = new ListDataProvider<>( new ArrayList<RequestMod>() );
}
return results;
}