本文整理汇总了Java中org.apache.wicket.markup.html.WebMarkupContainer.setMarkupId方法的典型用法代码示例。如果您正苦于以下问题:Java WebMarkupContainer.setMarkupId方法的具体用法?Java WebMarkupContainer.setMarkupId怎么用?Java WebMarkupContainer.setMarkupId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.markup.html.WebMarkupContainer
的用法示例。
在下文中一共展示了WebMarkupContainer.setMarkupId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newActivityRow
import org.apache.wicket.markup.html.WebMarkupContainer; //导入方法依赖的package包/类
private Component newActivityRow(String id, PullRequestActivity activity) {
WebMarkupContainer row = new WebMarkupContainer(id, Model.of(activity)) {
@Override
public void onEvent(IEvent<?> event) {
super.onEvent(event);
if (event.getPayload() instanceof RequestCommentDeleted) {
RequestCommentDeleted commentRemoved = (RequestCommentDeleted) event.getPayload();
remove();
commentRemoved.getHandler().appendJavaScript(String.format("$('#%s').remove();", getMarkupId()));
}
}
};
row.setOutputMarkupId(true);
String anchor = activity.getAnchor();
if (anchor != null)
row.setMarkupId(anchor);
if (row.get("content") == null)
row.add(activity.render("content"));
WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
row.add(avatarColumn);
if (activity instanceof OpenedActivity) {
row.add(AttributeAppender.append("class", " discussion"));
PullRequest request = ((OpenedActivity)activity).getRequest();
avatarColumn.add(new AvatarLink("avatar",
User.getForDisplay(request.getSubmitter(), request.getSubmitterName())));
} else if (activity instanceof CommentedActivity) {
row.add(AttributeAppender.append("class", " discussion"));
PullRequestComment comment = ((CommentedActivity)activity).getComment();
avatarColumn.add(new AvatarLink("avatar", User.getForDisplay(comment.getUser(), comment.getUserName())));
} else {
row.add(AttributeAppender.append("class", " non-discussion"));
avatarColumn.add(new WebMarkupContainer("avatar"));
}
if (activity instanceof UpdatedActivity)
row.add(AttributeAppender.append("class", " update"));
else
row.add(AttributeAppender.append("class", " non-update"));
return row;
}
示例2: initLayout
import org.apache.wicket.markup.html.WebMarkupContainer; //导入方法依赖的package包/类
public void initLayout(WebMarkupContainer content) {
Form form = new Form(ID_MAIN_FORM);
form.setOutputMarkupId(true);
content.add(form);
ListView repeater = new ListView<PropertyLimitationsTypeDto>(ID_REPEATER, model){
@Override
protected void populateItem(final ListItem<PropertyLimitationsTypeDto> item){
WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LIMITATIONS_LINK);
linkContainer.setOutputMarkupId(true);
linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true)));
item.add(linkContainer);
Label linkLabel = new Label(ID_LIMITATIONS_LABEL, createLimitationsLabelModel(item));
linkContainer.add(linkLabel);
AjaxLink delete = new AjaxLink(ID_LIMITATION_DELETE) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteLimitationPerformed(target, item);
}
};
delete.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
linkContainer.add(delete);
WebMarkupContainer limitationBody = new WebMarkupContainer(ID_BODY);
limitationBody.setOutputMarkupId(true);
limitationBody.setMarkupId(createCollapseItemId(item, false).getObject());
if (changeState != ChangeState.SKIP) {
limitationBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
return "panel-collapse collapse in";
} else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size()-1)) {
return "panel-collapse collapse in";
} else {
return "panel-collapse collapse";
}
}
}));
}
limitationBody.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
item.add(limitationBody);
initLimitationBody(limitationBody, item);
}
};
repeater.setOutputMarkupId(true);
form.add(repeater);
initButtons(form);
}