本文整理匯總了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);
}