本文整理汇总了Java中org.apache.wicket.markup.repeater.data.ListDataProvider类的典型用法代码示例。如果您正苦于以下问题:Java ListDataProvider类的具体用法?Java ListDataProvider怎么用?Java ListDataProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListDataProvider类属于org.apache.wicket.markup.repeater.data包,在下文中一共展示了ListDataProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ForAdmins
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
/**
* Construct.
*
* @param id
*/
public ForAdmins(String id, final BodyFrame index) {
super(id);
// generate data-view to populate the table
DataView<NavigationItem> naviView = new DataView<NavigationItem>("adminNavis",
new ListDataProvider<NavigationItem>(index.getAdminNavigationList())) {
@Override
protected void populateItem(Item<NavigationItem> item) {
NavigationItem naviItem = item.getModelObject();
// link to the page
ChangeFramePageLink link = new ChangeFramePageLink("linkToAdminPage", index, naviItem.getPageClass());
link.add(new Label("adminLinkLabel", naviItem.getPageName()));
item.add(link);
}
};
add(naviView);
}
示例2: addDetailRows
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
private void addDetailRows(MasterDetailTable<M, D> table, M masterObject, boolean expanded) {
List<D> list = null;
if (expanded) {
// calculate inner rows only if this parent row is expanded
list = table.getDetails(masterObject);
}
if (list == null) {
add(new WebMarkupContainer("rows").setVisible(false));
return;
}
final SortParam sortParam = getSortParam(table);
sortList(list, sortParam);
final ListDataProvider dataProvider = new DetailsDataProvider<>(list, masterObject);
add(new DetailsGridView("rows", table.getColumns(), dataProvider));
}
示例3: HomePage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public HomePage(final PageParameters parameters) {
super(parameters);
add(new DataView<Invoice>("invoice-table", new ListDataProvider(invoiceService.getAll()))
{
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final Item<Invoice> item)
{
Invoice invoice = item.getModelObject();
item.add(new Label("shop" , invoice.getShop()));
item.add(new Label("invoice-date", invoice.getInvoiceDate()));
}
});
// TODO Add your page's components here
}
示例4: BulletListPanel
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public BulletListPanel(String id, String header, List<String> list) {
super(id);
if (list == null) {
list = new ArrayList<String>();
}
add(new Label("header", header).setVisible(list.size() > 0));
ListDataProvider<String> listDp = new ListDataProvider<String>(list);
DataView<String> listView = new DataView<String>("list", listDp) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<String> item) {
String entry = item.getModelObject();
item.add(new Label("listItem", entry));
}
};
add(listView.setVisible(list.size() > 0));
}
示例5: ListItemsPage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public ListItemsPage() {
final Label label = new Label("message", "items from database:");
add(label);
add(new Link("link") {
@Override
public void onClick() {
setResponsePage(AddItemPage.class);
}
});
ListDataProvider<Item> itemProvider = new ListDataProvider<Item>(itemService.findAll());
IColumn[] columns = new IColumn[2];
columns[0] = new PropertyColumn(new Model<String>("Name"), "name");
columns[1] = new PropertyColumn(new Model<String>("Price"), "price");
DataTable table = new DataTable("datatable", columns, itemProvider, 10);
table.addBottomToolbar(new NavigationToolbar(table));
table.addTopToolbar(new HeadersToolbar(table, null));
add(table);
}
示例6: createDataProvider
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的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;
}
示例7: createDataProvider
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的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;
}
示例8: newSubmenu
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
/**
* Creates a submenu. This is not actually submenu because we're using an older Twitter Bootstrap which is pre-submenu.
*
* @param wicketId
* @param submenuTitle
* @param menuItems
* @return a submenu fragment
*/
private Fragment newSubmenu(String wicketId, String submenuTitle, List<MenuItem> menuItems) {
Fragment submenu = new Fragment(wicketId, "submenuFragment", this);
submenu.add(new Label("submenuTitle", submenuTitle).setRenderBodyOnly(true));
ListDataProvider<MenuItem> menuItemsDp = new ListDataProvider<MenuItem>(menuItems);
DataView<MenuItem> submenuItems = new DataView<MenuItem>("submenuItem", menuItemsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<MenuItem> menuItem) {
final MenuItem item = menuItem.getModelObject();
String name = item.toString();
try {
// try to lookup translation
name = getString(name);
} catch (Exception e) {
}
if (item instanceof PageLinkMenuItem) {
// link to another Wicket page
PageLinkMenuItem pageLink = (PageLinkMenuItem) item;
menuItem.add(new LinkPanel("submenuLink", null, null, name, pageLink.getPageClass(), pageLink.getPageParameters(), false)
.setRenderBodyOnly(true));
} else if (item instanceof ExternalLinkMenuItem) {
// link to a specified href
ExternalLinkMenuItem extLink = (ExternalLinkMenuItem) item;
menuItem.add(new LinkPanel("submenuLink", null, name, extLink.getHref(), extLink.openInNewWindow()).setRenderBodyOnly(true));
} else if (item instanceof MenuDivider) {
// divider
menuItem.add(new Label("submenuLink").setRenderBodyOnly(true));
WicketUtils.setCssClass(menuItem, "divider");
}
}
};
submenu.add(submenuItems);
submenu.setRenderBodyOnly(true);
return submenu;
}
示例9: TicketPage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public TicketPage(PageParameters params) {
super(params);
final String ticketFolder = WicketUtils.getPath(params);
Repository r = getRepository();
TicketModel t = TicgitUtils.getTicket(r, ticketFolder);
add(new Label("ticketTitle", t.title));
add(new Label("ticketId", t.id));
add(new Label("ticketHandler", t.handler.toLowerCase()));
add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone(), getTimeUtils()));
Label stateLabel = new Label("ticketState", t.state);
WicketUtils.setTicketCssClass(stateLabel, t.state);
add(stateLabel);
add(new Label("ticketTags", StringUtils.flattenStrings(t.tags)));
ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);
DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {
private static final long serialVersionUID = 1L;
int counter;
public void populateItem(final Item<Comment> item) {
final Comment entry = item.getModelObject();
item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession
.get().getTimezone(), getTimeUtils()));
item.add(new Label("commentAuthor", entry.author.toLowerCase()));
item.add(new Label("commentText", prepareComment(entry.text))
.setEscapeModelStrings(false));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(commentsView);
}
示例10: DocsPage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public DocsPage(PageParameters params) {
super(params);
Repository r = getRepository();
List<String> extensions = GitBlit.getStrings(Keys.web.markdownExtensions);
List<PathModel> paths = JGitUtils.getDocuments(r, extensions);
final ByteFormat byteFormat = new ByteFormat();
add(new Label("header", getString("gb.docs")));
// documents list
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
DataView<PathModel> pathsView = new DataView<PathModel>("document", pathsDp) {
private static final long serialVersionUID = 1L;
int counter;
public void populateItem(final Item<PathModel> item) {
PathModel entry = item.getModelObject();
item.add(WicketUtils.newImage("docIcon", "file_world_16x16.png"));
item.add(new Label("docSize", byteFormat.format(entry.size)));
item.add(new LinkPanel("docName", "list", entry.name, BlobPage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
// links
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
item.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
.newPathParameter(repositoryName, entry.commitId, entry.path)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(pathsView);
}
示例11: TicketsPage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public TicketsPage(PageParameters params) {
super(params);
List<TicketModel> tickets = TicgitUtils.getTickets(getRepository());
ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
private static final long serialVersionUID = 1L;
int counter;
public void populateItem(final Item<TicketModel> item) {
final TicketModel entry = item.getModelObject();
Label stateLabel = new Label("ticketState", entry.state);
WicketUtils.setTicketCssClass(stateLabel, entry.state);
item.add(stateLabel);
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
.get().getTimezone(), getTimeUtils()));
item.add(new Label("ticketHandler", StringUtils.trimString(
entry.handler.toLowerCase(), 30)));
item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(ticketsView);
}
示例12: CommitLegendPanel
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public CommitLegendPanel(String id, List<PathChangeModel> paths) {
super(id);
final Map<ChangeType, AtomicInteger> stats = getChangedPathsStats(paths);
ListDataProvider<ChangeType> legendDp = new ListDataProvider<ChangeType>(
new ArrayList<ChangeType>(stats.keySet()));
DataView<ChangeType> legendsView = new DataView<ChangeType>("legend", legendDp) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<ChangeType> item) {
ChangeType entry = item.getModelObject();
Label changeType = new Label("changeType", "");
WicketUtils.setChangeTypeCssClass(changeType, entry);
item.add(changeType);
int count = stats.get(entry).intValue();
String description = "";
switch (entry) {
case ADD:
description = MessageFormat.format(getString("gb.filesAdded"), count);
break;
case MODIFY:
description = MessageFormat.format(getString("gb.filesModified"), count);
break;
case DELETE:
description = MessageFormat.format(getString("gb.filesDeleted"), count);
break;
case COPY:
description = MessageFormat.format(getString("gb.filesCopied"), count);
break;
case RENAME:
description = MessageFormat.format(getString("gb.filesRenamed"), count);
break;
}
item.add(new Label("description", description));
}
};
add(legendsView);
}
示例13: FederationRegistrationsPanel
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public FederationRegistrationsPanel(String wicketId) {
super(wicketId);
final List<FederationModel> list = new ArrayList<FederationModel>(GitBlit.self()
.getFederationRegistrations());
list.addAll(GitBlit.self().getFederationResultRegistrations());
Collections.sort(list);
hasRegistrations = list.size() > 0;
DataView<FederationModel> dataView = new DataView<FederationModel>("row",
new ListDataProvider<FederationModel>(list)) {
private static final long serialVersionUID = 1L;
private int counter;
@Override
protected void onBeforeRender() {
super.onBeforeRender();
counter = 0;
}
public void populateItem(final Item<FederationModel> item) {
final FederationModel entry = item.getModelObject();
item.add(new LinkPanel("url", "list", entry.url, FederationRegistrationPage.class,
WicketUtils.newRegistrationParameter(entry.url, entry.name)));
item.add(WicketUtils.getPullStatusImage("statusIcon", entry.getLowestStatus()));
item.add(new LinkPanel("name", "list", entry.name,
FederationRegistrationPage.class, WicketUtils.newRegistrationParameter(
entry.url, entry.name)));
item.add(WicketUtils.getRegistrationImage("typeIcon", entry, this));
item.add(WicketUtils.createDateLabel("lastPull", entry.lastPull, getTimeZone(), getTimeUtils()));
item.add(WicketUtils
.createTimestampLabel("nextPull", entry.nextPull, getTimeZone(), getTimeUtils()));
item.add(new Label("frequency", entry.frequency));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(dataView);
}
示例14: DropDownMenu
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public DropDownMenu(String id, String label, final DropDownMenuRegistration menu) {
super(id);
add(new Label("label", label).setRenderBodyOnly(true));
ListDataProvider<DropDownMenuItem> items = new ListDataProvider<DropDownMenuItem>(
menu.menuItems);
DataView<DropDownMenuItem> view = new DataView<DropDownMenuItem>("menuItems", items) {
private static final long serialVersionUID = 1L;
public void populateItem(final Item<DropDownMenuItem> item) {
DropDownMenuItem entry = item.getModelObject();
if (entry.isDivider()) {
item.add(new Label("menuItem").setRenderBodyOnly(true));
WicketUtils.setCssClass(item, "divider");
} else {
String icon = null;
if (entry.isSelected()) {
icon = "icon-ok";
} else {
icon = "icon-ok-white";
}
item.add(new LinkPanel("menuItem", icon, null, entry.toString(), menu.pageClass,
entry.getPageParameters(), false).setRenderBodyOnly(true));
}
}
};
add(view);
setRenderBodyOnly(true);
}
示例15: TicketsPage
import org.apache.wicket.markup.repeater.data.ListDataProvider; //导入依赖的package包/类
public TicketsPage(PageParameters params) {
super(params);
List<TicketModel> tickets = TicgitUtils.getTickets(getRepository());
// header
add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
newRepositoryParameter()));
ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
private static final long serialVersionUID = 1L;
int counter;
public void populateItem(final Item<TicketModel> item) {
final TicketModel entry = item.getModelObject();
Label stateLabel = new Label("ticketState", entry.state);
WicketUtils.setTicketCssClass(stateLabel, entry.state);
item.add(stateLabel);
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
.get().getTimezone(), getTimeUtils()));
item.add(new Label("ticketHandler", StringUtils.trimString(
entry.handler.toLowerCase(), 30)));
item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(ticketsView);
}