當前位置: 首頁>>代碼示例>>Java>>正文


Java WebMarkupContainer.setMarkupId方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:48,代碼來源:RequestOverviewPage.java

示例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);
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:57,代碼來源:LimitationsEditorDialog.java


注:本文中的org.apache.wicket.markup.html.WebMarkupContainer.setMarkupId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。