List of usage examples for org.apache.wicket.markup.html WebMarkupContainer setMarkupId
final void setMarkupId(Component comp)
From source file:com.aplombee.navigator.AjaxComponentScrollEventBehaviorTest.java
License:Apache License
@Test(groups = { "wicketTests" }) public void getPrecondition() { WebMarkupContainer parent = new WebMarkupContainer("parent"); parent.setMarkupId("parent"); AjaxComponentScrollEventBehavior.ParentScrollListener listener = new AjaxComponentScrollEventBehavior.ParentScrollListener(); String actual = listener.getPrecondition(parent).toString(); String expected = "return " + RepeaterUtil.get().isComponentScrollBarAtBottom(parent); Assert.assertEquals(actual, expected); }
From source file:com.aplombee.RepeaterUtilTest.java
License:Apache License
@Test(groups = { "utilTests" }) public void isComponentScrollBarAtBottom() { WebMarkupContainer c = new WebMarkupContainer("parent"); c.setMarkupId("parent"); String actual = RepeaterUtil.get().isComponentScrollBarAtBottom(c); String expected = "QuickView.isComponentScrollBarAtBottom('parent');"; Assert.assertEquals(actual, expected); }
From source file:com.evolveum.midpoint.web.component.message.FeedbackMessagePanel.java
License:Apache License
private void initLayout(final IModel<FeedbackMessage> message) { WebMarkupContainer messageContainer = new WebMarkupContainer("messageContainer"); messageContainer.setOutputMarkupId(true); messageContainer.add(new AttributeAppender("class", new LoadableModel<String>() { @Override//from w w w .j a va2 s .c o m protected String load() { return getLabelCss(message); } }, " ")); messageContainer.add(new AttributeModifier("title", new LoadableModel<String>() { @Override protected String load() { return getString("feedbackMessagePanel.message." + createMessageTooltip(message)); } })); add(messageContainer); Label label = new Label("message", new LoadableModel<String>(false) { @Override protected String load() { return getTopMessage(message); } }); messageContainer.add(label); WebMarkupContainer topExceptionContainer = new WebMarkupContainer("topExceptionContainer"); messageContainer.add(topExceptionContainer); WebMarkupContainer content = new WebMarkupContainer("content"); if (message.getObject().getMessage() instanceof OpResult) { OpResult result = (OpResult) message.getObject().getMessage(); xml = result.getXml(); export(content, new Model<String>(xml)); ListView<OpResult> subresults = new ListView<OpResult>("subresults", createSubresultsModel(message)) { @Override protected void populateItem(final ListItem<OpResult> item) { item.add(new AttributeAppender("class", OperationResultPanel.createMessageLiClass(item.getModel()), " ")); item.add(new AttributeModifier("title", new LoadableModel<String>() { @Override protected String load() { return getString("feedbackMessagePanel.message." + OperationResultPanel.createMessageTooltip(item.getModel()).getObject()); } })); item.add(new OperationResultPanel("subresult", item.getModel())); } }; content.add(subresults); content.add(new AttributeAppender("class", new LoadableModel<String>(false) { @Override protected String load() { return getDetailsCss(new PropertyModel<OpResult>(message, "message")); } }, " ")); } else { content.setVisible(false); topExceptionContainer.setVisibilityAllowed(false); } content.setMarkupId(messageContainer.getMarkupId() + "_content"); add(content); WebMarkupContainer operationPanel = new WebMarkupContainer("operationPanel"); topExceptionContainer.add(operationPanel); operationPanel.add(new Label("operation", new LoadableModel<String>() { @Override protected String load() { OpResult result = (OpResult) message.getObject().getMessage(); String resourceKey = OperationResultPanel.OPERATION_RESOURCE_KEY_PREFIX + result.getOperation(); return getPage().getString(resourceKey, null, resourceKey); } })); WebMarkupContainer countPanel = new WebMarkupContainer("countPanel"); countPanel.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { OpResult result = (OpResult) message.getObject().getMessage(); return result.getCount() > 1; } }); countPanel.add(new Label("count", new PropertyModel<String>(message, "message.count"))); operationPanel.add(countPanel); ListView<Param> params = new ListView<Param>("params", OperationResultPanel.createParamsModel(new PropertyModel<OpResult>(message, "message"))) { @Override protected void populateItem(ListItem<Param> item) { item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name"))); item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value"))); } }; topExceptionContainer.add(params); ListView<Context> contexts = new ListView<Context>("contexts", OperationResultPanel.createContextsModel(new PropertyModel<OpResult>(message, "message"))) { @Override protected void populateItem(ListItem<Context> item) { item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name"))); item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value"))); } }; topExceptionContainer.add(contexts); /* * WebMarkupContainer countLi = new WebMarkupContainer("countLi"); * countLi.add(new VisibleEnableBehaviour() { * * @Override public boolean isVisible() { OpResult result = (OpResult) * message.getObject().getMessage(); return result.getCount() > 1; } }); * content.add(countLi); countLi.add(new Label("count", new * PropertyModel<String>(message, "message.count"))); */ initExceptionLayout(content, topExceptionContainer, message); content.add(new Label("collapseAll", new LoadableModel<String>() { @Override protected String load() { return getString("feedbackMessagePanel.collapseAll"); } })); content.add(new Label("expandAll", new LoadableModel<String>() { @Override protected String load() { return getString("feedbackMessagePanel.expandAll"); } })); }
From source file:com.evolveum.midpoint.web.component.message.FeedbackMessagePanel.java
License:Apache License
private void initExceptionLayout(WebMarkupContainer content, WebMarkupContainer topExceptionContainer, final IModel<FeedbackMessage> message) { WebMarkupContainer exception = new WebMarkupContainer("exception") { @Override/* w w w.j a v a 2 s. c o m*/ public boolean isVisible() { return isExceptionVisible(message); } }; topExceptionContainer.add(exception); exception.add(new MultiLineLabel("exceptionMessage", new PropertyModel<String>(message, "message.exceptionMessage"))); WebMarkupContainer errorStackContainer = new WebMarkupContainer("errorStackContainer") { @Override public boolean isVisible() { return isExceptionVisible(message); } }; content.add(errorStackContainer); WebMarkupContainer errorStack = new WebMarkupContainer("errorStack"); errorStack.setOutputMarkupId(true); errorStackContainer.add(errorStack); // export(errorStackContainer, new PropertyModel<String>(message, // "message.exceptionsStackTrace")); WebMarkupContainer errorStackContent = new WebMarkupContainer("errorStackContent"); errorStackContent.setMarkupId(errorStack.getMarkupId() + "_content"); errorStackContainer.add(errorStackContent); errorStackContent.add(new MultiLineLabel("exceptionStack", new PropertyModel<String>(message, "message.exceptionsStackTrace"))); }
From source file:com.evolveum.midpoint.web.component.message.OperationResultPanel.java
License:Apache License
private void initLayout(final IModel<OpResult> model) { WebMarkupContainer operationPanel = new WebMarkupContainer("operationPanel"); operationPanel.setOutputMarkupId(true); add(operationPanel);//from w ww . j av a2 s.com Label operation = new Label("operation", new LoadableModel<Object>() { @Override protected Object load() { OpResult result = model.getObject(); String resourceKey = OPERATION_RESOURCE_KEY_PREFIX + result.getOperation(); return getPage().getString(resourceKey, null, resourceKey); } }); operation.setOutputMarkupId(true); operationPanel.add(operation); operationPanel.add(initCountPanel(model)); WebMarkupContainer arrow = new WebMarkupContainer("arrow"); arrow.add(new AttributeAppender("class", createArrowClass(model), " ")); arrow.setMarkupId(operationPanel.getMarkupId() + "_arrow"); add(arrow); WebMarkupContainer operationContent = new WebMarkupContainer("operationContent"); operationContent.setMarkupId(operationPanel.getMarkupId() + "_content"); add(operationContent); operationContent.add(new Label("message", new PropertyModel<String>(model, "message"))); initParams(operationContent, model); initContexts(operationContent, model); //initCount(operationContent, model); initExceptionLayout(operationContent, model); }
From source file:com.evolveum.midpoint.web.component.message.OperationResultPanel.java
License:Apache License
private void initExceptionLayout(WebMarkupContainer operationContent, final IModel<OpResult> model) { WebMarkupContainer exception = new WebMarkupContainer("exception") { @Override//w w w .ja va 2 s . c om public boolean isVisible() { OpResult result = model.getObject(); return StringUtils.isNotEmpty(result.getExceptionMessage()) || StringUtils.isNotEmpty(result.getExceptionsStackTrace()); } }; operationContent.add(exception); exception.add(new MultiLineLabel("exceptionMessage", new PropertyModel<String>(model, "exceptionMessage"))); WebMarkupContainer errorStack = new WebMarkupContainer("errorStack"); errorStack.setOutputMarkupId(true); exception.add(errorStack); WebMarkupContainer errorStackContent = new WebMarkupContainer("errorStackContent"); errorStackContent.setMarkupId(errorStack.getMarkupId() + "_content"); exception.add(errorStackContent); errorStackContent.add( new MultiLineLabel("exceptionStack", new PropertyModel<String>(model, "exceptionsStackTrace"))); }
From source file:com.evolveum.midpoint.web.component.message.TempMessagePanel.java
License:Apache License
private void initLayout(final IModel<FeedbackMessage> message) { Label label = new Label("message", new LoadableModel<String>(false) { @Override/*from w w w. j a v a 2s . co m*/ protected String load() { return getTopMessage(message); } }); label.add(new AttributeAppender("class", new LoadableModel<String>() { @Override protected String load() { return getLabelCss(message); } }, " ")); label.setOutputMarkupId(true); label.add(new AttributeModifier("title", new LoadableModel<String>() { @Override protected String load() { return getString("tempMessagePanel.message." + FeedbackMessagePanel.createMessageTooltip(message)); } })); add(label); WebMarkupContainer content = new WebMarkupContainer("content"); if (message.getObject().getMessage() instanceof OpResult) { content.add(new AttributeAppender("class", new LoadableModel<String>(false) { @Override protected String load() { return getDetailsCss(new PropertyModel<OpResult>(message, "message")); } }, " ")); } else { content.setVisible(false); } content.setMarkupId(label.getMarkupId() + "_content"); content.add(new AttributeModifier("title", new LoadableModel<String>() { @Override protected String load() { return getString("tempMessagePanel.message." + FeedbackMessagePanel.createMessageTooltip(message)); } })); add(content); WebMarkupContainer operationPanel = new WebMarkupContainer("operationPanel"); content.add(operationPanel); operationPanel.add(new Label("operation", new LoadableModel<String>() { @Override protected String load() { OpResult result = (OpResult) message.getObject().getMessage(); String resourceKey = OperationResultPanel.OPERATION_RESOURCE_KEY_PREFIX + result.getOperation(); return getPage().getString(resourceKey, null, resourceKey); } })); WebMarkupContainer countPanel = new WebMarkupContainer("countPanel"); countPanel.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { OpResult result = (OpResult) message.getObject().getMessage(); return result.getCount() > 1; } }); countPanel.add(new Label("count", new PropertyModel<String>(message, "message.count"))); operationPanel.add(countPanel); ListView<Param> params = new ListView<Param>("params", OperationResultPanel.createParamsModel(new PropertyModel<OpResult>(message, "message"))) { @Override protected void populateItem(ListItem<Param> item) { item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name"))); item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value"))); } }; content.add(params); ListView<Context> contexts = new ListView<Context>("contexts", OperationResultPanel.createContextsModel(new PropertyModel<OpResult>(message, "message"))) { @Override protected void populateItem(ListItem<Context> item) { item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name"))); item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value"))); } }; content.add(contexts); initExceptionLayout(content, message); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog.java
License:Apache License
public void initLayout(WebMarkupContainer content) { Form form = new Form(ID_MAIN_FORM); form.setOutputMarkupId(true);// ww w . ja va2 s . c o m 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); } }; 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"; } } })); } item.add(limitationBody); initLimitationBody(limitationBody, item); } }; repeater.setOutputMarkupId(true); form.add(repeater); initButtons(form); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.ResourceDependencyEditor.java
License:Apache License
@Override protected void initLayout() { WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER); container.setOutputMarkupId(true);// w ww.j a va 2s .com add(container); ListView repeater = new ListView<ResourceObjectTypeDependencyType>(ID_REPEATER, getModel()) { @Override protected void populateItem(final ListItem<ResourceObjectTypeDependencyType> item) { WebMarkupContainer linkContainer = new WebMarkupContainer(ID_DEPENDENCY_LINK); linkContainer.setOutputMarkupId(true); linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true))); item.add(linkContainer); Label linkLabel = new Label(ID_DEPENDENCY_LINK_NAME, createDependencyLabelModel(item)); linkContainer.add(linkLabel); AjaxLink delete = new AjaxLink(ID_DELETE_BUTTON) { @Override public void onClick(AjaxRequestTarget target) { deleteDependencyPerformed(target, item); } }; linkContainer.add(delete); WebMarkupContainer dependencyBody = new WebMarkupContainer(ID_DEPENDENCY_BODY); dependencyBody.setOutputMarkupId(true); dependencyBody.setMarkupId(createCollapseItemId(item, false).getObject()); if (changeState != ChangeState.SKIP) { dependencyBody.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"; } } })); } item.add(dependencyBody); TextField order = new TextField<>(ID_ORDER, new PropertyModel<Integer>(item.getModelObject(), "order")); order.add(prepareAjaxOnComponentTagUpdateBehavior()); dependencyBody.add(order); DropDownChoice strictness = new DropDownChoice<>(ID_STRICTNESS, new PropertyModel<ResourceObjectTypeDependencyStrictnessType>(item.getModelObject(), "strictness"), WebMiscUtil.createReadonlyModelFromEnum(ResourceObjectTypeDependencyStrictnessType.class), new EnumChoiceRenderer<ResourceObjectTypeDependencyStrictnessType>(this)); strictness.add(prepareAjaxOnComponentTagUpdateBehavior()); dependencyBody.add(strictness); DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(item.getModelObject(), "kind"), WebMiscUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this)); kind.add(prepareAjaxOnComponentTagUpdateBehavior()); dependencyBody.add(kind); TextField intent = new TextField<>(ID_INTENT, new PropertyModel<String>(item.getModelObject(), "intent")); intent.add(prepareAjaxOnComponentTagUpdateBehavior()); dependencyBody.add(intent); DropDownChoice resource = new DropDownChoice<>(ID_REF, new PropertyModel<ObjectReferenceType>(item.getModelObject(), "resourceRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() { @Override public List<ObjectReferenceType> getObject() { return createResourceList(); } }, new IChoiceRenderer<ObjectReferenceType>() { @Override public Object getDisplayValue(ObjectReferenceType object) { return createResourceReadLabel(object); } @Override public String getIdValue(ObjectReferenceType object, int index) { return Integer.toString(index); } }); resource.add(prepareAjaxOnComponentTagUpdateBehavior()); dependencyBody.add(resource); Label orderTooltip = new Label(ID_T_ORDER); orderTooltip.add(new InfoTooltipBehavior()); dependencyBody.add(orderTooltip); Label strictnessTooltip = new Label(ID_T_STRICTNESS); strictnessTooltip.add(new InfoTooltipBehavior()); dependencyBody.add(strictnessTooltip); Label kindTooltip = new Label(ID_T_KIND); kindTooltip.add(new InfoTooltipBehavior()); dependencyBody.add(kindTooltip); Label intentTooltip = new Label(ID_T_INTENT); intentTooltip.add(new InfoTooltipBehavior()); dependencyBody.add(intentTooltip); Label resourceRefTooltip = new Label(ID_T_RESOURCE_REF); resourceRefTooltip.add(new InfoTooltipBehavior()); dependencyBody.add(resourceRefTooltip); } }; repeater.setOutputMarkupId(true); container.add(repeater); AjaxLink add = new AjaxLink(ID_ADD_BUTTON) { @Override public void onClick(AjaxRequestTarget target) { addDependencyPerformed(target); } }; add(add); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.ResourceProtectedEditor.java
License:Apache License
@Override protected void initLayout() { WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER); container.setOutputMarkupId(true);//from ww w. ja v a 2 s .c om add(container); ListView repeater = new ListView<ResourceObjectPatternType>(ID_REPEATER, getModel()) { @Override protected void populateItem(final ListItem<ResourceObjectPatternType> item) { WebMarkupContainer linkCont = new WebMarkupContainer(ID_ACCOUNT_LINK); linkCont.setOutputMarkupId(true); linkCont.add(new AttributeModifier("href", createCollapseItemId(item, true))); item.add(linkCont); Label accountLabel = new Label(ID_ACCOUNT_NAME, new AbstractReadOnlyModel<String>() { @Override public String getObject() { StringBuilder sb = new StringBuilder(); ResourceObjectPatternType account = item.getModelObject(); sb.append("#").append(item.getIndex() + 1).append(" - "); if (account.getUid() != null) { sb.append(account.getUid()).append(":"); } if (account.getName() != null) { sb.append(account.getName()); } return sb.toString(); } }); linkCont.add(accountLabel); AjaxLink delete = new AjaxLink(ID_BUTTON_DELETE) { @Override public void onClick(AjaxRequestTarget target) { deleteDependencyPerformed(target, item); } }; linkCont.add(delete); WebMarkupContainer accountBody = new WebMarkupContainer(ID_ACCOUNT_BODY); accountBody.setOutputMarkupId(true); accountBody.setMarkupId(createCollapseItemId(item, false).getObject()); if (changeState != ChangeState.SKIP) { accountBody.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"; } } })); } item.add(accountBody); //TODO - maybe add some validator and auto-complete functionality? TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(item.getModelObject(), "name")); name.add(prepareAjaxOnComponentTagUpdateBehavior()); accountBody.add(name); //TODO - maybe add some validator and auto-complete functionality? TextField uid = new TextField<>(ID_UID, new PropertyModel<String>(item.getModelObject(), "uid")); uid.add(prepareAjaxOnComponentTagUpdateBehavior()); accountBody.add(uid); SearchFilterPanel searchFilterPanel = new SearchFilterPanel<>(ID_FILTER_EDITOR, new PropertyModel<SearchFilterType>(item.getModelObject(), "filter")); accountBody.add(searchFilterPanel); Label nameTooltip = new Label(ID_T_NAME); nameTooltip.add(new InfoTooltipBehavior()); accountBody.add(nameTooltip); Label uidTooltip = new Label(ID_T_UID); uidTooltip.add(new InfoTooltipBehavior()); accountBody.add(uidTooltip); Label filterTooltip = new Label(ID_T_FILTER); filterTooltip.add(new InfoTooltipBehavior()); accountBody.add(filterTooltip); } }; repeater.setOutputMarkupId(true); container.add(repeater); AjaxLink add = new AjaxLink(ID_BUTTON_ADD) { @Override public void onClick(AjaxRequestTarget target) { addProtectedAccountPerformed(target); } }; add(add); }