本文整理汇总了Java中org.apache.wicket.markup.html.list.ListItem.getModelObject方法的典型用法代码示例。如果您正苦于以下问题:Java ListItem.getModelObject方法的具体用法?Java ListItem.getModelObject怎么用?Java ListItem.getModelObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.markup.html.list.ListItem
的用法示例。
在下文中一共展示了ListItem.getModelObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DocumentationIndexPage
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
public DocumentationIndexPage() {
Harvester harvester = new Harvester();
@SuppressWarnings({ "unchecked", "rawtypes" })
ListView listview = new ListView("listview", harvester.getWorkspaces()) {
/**
*
*/
private static final long serialVersionUID = 2974513833506276491L;
protected void populateItem(ListItem item) {
WorkspaceDoc wi = (WorkspaceDoc) item.getModelObject();
BookmarkablePageLink link = new BookmarkablePageLink("link", WorkspacePage.class);
link.setParameter("workspaceName", wi.getName());
link.add(new Label("workspaceName", wi.getName()));
item.add(link);
}
};
add(listview);
ExtensionInfo info = new ExtensionInfo();
add(new Label("documentorVersion", info.getVersion()));
add(new Label("documentorGitVersion", info.getGitVersion()));
add(new Label("readme", info.getReadme()));
}
示例2: populateNode
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void populateNode() throws ExternalServiceException, IOException, RemoteException {
ListView<NodeDto> list = new ListView<NodeDto>("nodeList", this.model) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<NodeDto> item) {
NodeDto node = item.getModelObject();
BookmarkablePageLink<Void> link = NodePageUtil.createNodeLink("nodeLink", node);
item.add(link);
}
};
add(list);
WebMarkupContainer container = new WebMarkupContainer("nodeBlock");
add(container);
container.setVisible(this.model.isVisible());
}
示例3: initLayout
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void initLayout() {
Label titleLabel = new Label(ID_TITLE, new PropertyModel<>(getModel(), InformationType.F_TITLE.getLocalPart()));
titleLabel.add(new VisibleBehaviour(() -> getModelObject().getTitle() != null));
add(titleLabel);
ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS,
new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
@Override
protected void populateItem(ListItem<InformationPartType> item) {
InformationPartType part = item.getModelObject();
Label label = new Label(ID_PART, part.getText());
if (Boolean.TRUE.equals(part.isHasMarkup())) {
label.setEscapeModelStrings(false);
}
item.add(label);
}
};
add(list);
}
示例4: initCounters
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void initCounters() {
ListView<InternalCounters> countersTable = new ListView<InternalCounters>(ID_COUNTERS_TABLE, Arrays.asList(InternalCounters.values())) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<InternalCounters> item) {
InternalCounters counter = item.getModelObject();
Label label = new Label(ID_COUNTER_LABEL, createStringResource("InternalCounters."+counter.getKey()));
item.add(label);
Label valueLabel = new Label(ID_COUNTER_VALUE, new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
long val = InternalMonitor.getCount(counter);
return Long.toString(val);
}
});
item.add(valueLabel);
}
};
add(countersTable);
}
示例5: populateItem
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
@Override
protected void populateItem(final ListItem<StreamClient> item) {
StreamClient client = item.getModelObject();
item.add(new Label("clientId", "" + client.getId()))
.add(new Label("clientLogin", "" + client.getLogin()))
.add(new ConfirmableAjaxBorder("clientDelete", getString("80"), getString("833")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
StreamClient c = item.getModelObject();
getBean(UserManager.class).kickById(c.getUid());
updateClients(target);
}
});
}
示例6: createDocumentList
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void createDocumentList(List<DocumentListData> docList) {
ListView listview = new ListView("listView", docList) {
@Override
protected void populateItem(ListItem item) {
DocumentListData doc = (DocumentListData) item.getModelObject();
PageParameters pp = new PageParameters();
pp.add("id", doc.getId());
BookmarkablePageLink<Void> docLink = new BookmarkablePageLink("docLink", DocumentTabs.class, pp);
item.add(docLink.add(new Label("id", doc.getId())));
item.add(new Label("title", doc.getTitle()));
item.add(new Label("author", doc.getAuthor()));
}
};
add(listview);
}
示例7: makeAssignmentsToCreateListView
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
/**
* Helper to create a listview for what needs to be shown for new assignments
* @param markupId wicket markup id
* @param itemList list of Assignments populated by the item creation steps
*/
private ListView<Assignment> makeAssignmentsToCreateListView(final String markupId, final List<Assignment> itemList) {
final ListView<Assignment> rval = new ListView<Assignment>(markupId, itemList) {
@Override
protected void populateItem(final ListItem<Assignment> item) {
final Assignment assignment = item.getModelObject();
String extraCredit = assignment.isExtraCredit() ? yes : no;
String dueDate = FormatHelper.formatDate(assignment.getDueDate(), "");
String releaseToStudents = assignment.isReleased() ? yes : no;
String includeInCourseGrades = assignment.isCounted() ? yes : no;
item.add(new Label("title", assignment.getName()));
item.add(new Label("points", assignment.getPoints()));
item.add(new Label("extraCredit", extraCredit));
item.add(new Label("dueDate", dueDate));
item.add(new Label("releaseToStudents", releaseToStudents));
item.add(new Label("includeInCourseGrades", includeInCourseGrades));
}
};
return rval;
}
示例8: populateItem
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
@Override
protected void populateItem(ListItem<Person> item) {
Person person = item.getModelObject();
item.add(new Label("firstname", person.getFirstName()));
item.add(new Label("lastname", person.getLastName()));
item.add(new Label("jobtitle", person.getJobTitle()));
}
示例9: populateItem
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
@Override
protected void populateItem(ListItem<ChampionMasteryItem> item) {
ChampionMasteryItem mastery = item.getModelObject();
ChampionStatisticItem championStatistic = null;
// create boolean to storing whether or not element should be shown
// set to false if mastery or championStatistic is null
boolean visible = true;
// check if mastery is null
if (mastery != null) {
championStatistic = PageDataProvider.getChampionStatisticById(mastery.getChampionId());
} else {
// if mastery is null create a new one and fill it with default data
mastery = new ChampionMasteryItem();
mastery.setChampionPoints(42);
mastery.setChampionLevel(1);
visible = false;
}
if (championStatistic == null) {
// if champion statistic is null use default champion for statistic
championStatistic = PageDataProvider.championStatisticMap.get("bard");
visible = false;
}
// create link to champion page
PageParameters linkParameters = new PageParameters();
linkParameters.set(0, championStatistic.getKeyName());
BookmarkablePageLink<String> link = new BookmarkablePageLink<>("champion_link",
SingleChampionPage.class, linkParameters);
item.add(link);
// add champion portrait, name and mastery score as well as champion level
link.add(new ExternalImage("champion_portrait", championStatistic.getPortraitUrl()));
link.add(new Label("champion_name", championStatistic.getChampionName()));
link.add(new Label("champion_stats", String.format("%s - Level %d", NumberFormatter.formatLong(
mastery.getChampionPoints()), mastery.getChampionLevel())));
// hide link if necessary
link.setVisible(visible);
}
示例10: createDependencyLabelModel
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private IModel<String> createDependencyLabelModel(final ListItem<ResourceObjectTypeDependencyType> item){
return new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
ResourceObjectTypeDependencyType dep = item.getModelObject();
sb.append("#").append(item.getIndex()+1).append(" - ");
if(dep.getResourceRef() != null){
sb.append(resourceMap.get(dep.getResourceRef().getOid())).append(":");
}
if(dep.getKind() != null){
sb.append(dep.getKind().toString()).append(":");
}
if(dep.getIntent() != null){
sb.append(dep.getIntent()).append(":");
}
sb.append(dep.getOrder()).append(":");
if(dep.getStrictness() != null){
sb.append(dep.getStrictness().toString());
}
return sb.toString();
}
};
}
示例11: initMenuItem
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void initMenuItem(ListItem<InlineMenuItem> menuItem) {
final InlineMenuItem item = menuItem.getModelObject();
menuItem.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (item.isMenuHeader()) {
return "dropdown-header";
} else if (item.isDivider()) {
return "divider";
}
return getBoolean(item.getEnabled(), true) ? null : "disabled";
}
}));
menuItem.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return getBoolean(item.getEnabled(), true);
}
@Override
public boolean isVisible() {
return getBoolean(item.getVisible(), true);
}
});
WebMarkupContainer menuItemBody;
if (item.isMenuHeader() || item.isDivider()) {
menuItemBody = new MenuDividerPanel(ID_MENU_ITEM_BODY, menuItem.getModel());
} else {
menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, menuItem.getModel());
}
menuItemBody.setRenderBodyOnly(true);
menuItem.add(menuItemBody);
}
示例12: initLayout
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void initLayout() {
setOutputMarkupId(true);
WebMarkupContainer messagesPanel = new WebMarkupContainer(ID_MESSAGES_PANEL);
messagesPanel.setOutputMarkupId(true);
add(messagesPanel);
ListView<ConnectorStruct> connectorView = new ListView<ConnectorStruct>(ID_CONNECTOR_MESSAGES_PANEL, connectorResourceResults) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<ConnectorStruct> item) {
Label connectorNameLabel = new Label(ID_CONNECTOR_NAME, item.getModelObject().connectorName);
item.add(connectorNameLabel);
RepeatingView connectorResultView = new RepeatingView(ID_CONNECTOR_MESSAGES);
List<OpResult> resultsDto = item.getModelObject().connectorResultsDto;
if (resultsDto != null) {
initResultsPanel(connectorResultView, resultsDto, parentPage);
}
item.add(connectorResultView);
}
};
messagesPanel.add(connectorView);
RepeatingView resultView = new RepeatingView(ID_RESOURCE_MESSAGES);
if (modelResourceResults.getObject() != null) {
initResultsPanel(resultView, modelResourceResults.getObject(), parentPage);
}
resultView.setOutputMarkupId(true);
messagesPanel.add(resultView);
}
示例13: initMenuItem
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
private void initMenuItem(ListItem<InlineMenuItem> menuItem) {
final InlineMenuItem item = menuItem.getModelObject();
WebMarkupContainer menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, menuItem.getModel());
menuItemBody.setRenderBodyOnly(true);
menuItem.add(menuItemBody);
}
示例14: addCharts
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
/**
* adds all attribute charts from database to page
*/
@SuppressWarnings({"unchecked"})
private void addCharts() {
this.listview = new ListView("listview", this.getOptions()) {
@Override
protected void populateItem(final ListItem item) {
// prepare and add chart
final ChartConfiguration currentOptions = (ChartConfiguration) item.getModelObject();
item.add(AttributeChartPage.this.addChart(currentOptions));
// prepare and add removeButton
final AjaxButton removeButton = new AjaxButton("removeChartButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(final AjaxRequestTarget target, final Form form) {
currentOptions.remove();
AttributeChartPage.this.getOptions().detach();
target.add(AttributeChartPage.this.listview.getParent());
}
};
final Form<Void> removeform = new Form<Void>("form");
removeform.add(removeButton);
item.add(removeform);
}
};
this.listview.setOutputMarkupId(true);
this.add(this.listview);
}
示例15: addViews
import org.apache.wicket.markup.html.list.ListItem; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
private void addViews() {
this.listview = new ListView("listview", this.views) {
@Override
protected void populateItem(final ListItem item) {
// prepare and add view
final EventView viewOptions = (EventView) item.getModelObject();
final WebMarkupContainer view = new WebMarkupContainer("view");
try {
// build view
final EventViewOptions options = new EventViewOptions(viewOptions);
view.add(new Chart("view", options));
view.add(new Label("sub", options.getExplanationString()));
} catch (final Exception e) {
e.printStackTrace();
// if chart could not be build, display error message
view.add(new Label("view", "This View could not be built."));
view.add(new Label("sub", "Sorry for the inconvenience"));
}
item.add(view);
// prepare and add removeButton
final AjaxButton removeButton = new AjaxButton("removeViewButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(final AjaxRequestTarget target, final Form form) {
viewOptions.remove();
EventViewPage.this.views.detach();
target.add(EventViewPage.this.listview.getParent());
}
};
final Form<Void> removeform = new Form<Void>("removeform");
removeform.add(removeButton);
item.add(removeform);
}
};
this.listview.setOutputMarkupId(true);
this.add(this.listview);
}