List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink
public AjaxLink(final String id)
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog.java
License:Apache License
private void initButtons(Form form) { AjaxLink add = new AjaxLink(ID_BUTTON_ADD) { @Override/*from ww w.j ava2s .c om*/ public void onClick(AjaxRequestTarget target) { addLimitationsPerformed(target); } }; form.add(add); AjaxLink cancel = new AjaxLink(ID_BUTTON_CANCEL) { @Override public void onClick(AjaxRequestTarget target) { cancelPerformed(target); } }; form.add(cancel); AjaxLink save = new AjaxLink(ID_BUTTON_SAVE) { @Override public void onClick(AjaxRequestTarget target) { savePerformed(target); } }; form.add(save); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.ResourceAssociationEditor.java
License:Apache License
@Override protected void initLayout() { Label label = new Label(ID_LABEL, new AbstractReadOnlyModel<String>() { @Override//from w w w . ja v a 2 s . c o m public String getObject() { ResourceObjectAssociationType association = getModelObject(); if (association.getDisplayName() == null && association.getRef() == null) { return getString("ResourceAssociationEditor.label.new"); } else { if (association.getRef().getItemPath() != null) { return getString("ResourceAssociationEditor.label.edit", association.getRef().getItemPath().toString()); } return getString("ResourceAssociationEditor.label.edit", ""); } } }); add(label); DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(getModel(), "kind"), WebMiscUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this)); kind.setNullValid(false); add(kind); MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT, new PropertyModel<List<String>>(getModel(), "intent")); add(intent); DropDownChoice direction = new DropDownChoice<>(ID_DIRECTION, new PropertyModel<ResourceObjectAssociationDirectionType>(getModel(), "direction"), WebMiscUtil.createReadonlyModelFromEnum(ResourceObjectAssociationDirectionType.class), new EnumChoiceRenderer<ResourceObjectAssociationDirectionType>(this)); direction.setNullValid(true); add(direction); DropDownChoice associationAttribute = new DropDownChoice<>(ID_ASSOCIATION_ATTRIBUTE, new PropertyModel<QName>(getModel(), "associationAttribute"), new AbstractReadOnlyModel<List<QName>>() { @Override public List<QName> getObject() { return loadObjectReferences(false); } }, new IChoiceRenderer<QName>() { @Override public Object getDisplayValue(QName object) { return prepareReferenceDisplayValue(object); } @Override public String getIdValue(QName object, int index) { return Integer.toString(index); } }); associationAttribute.setNullValid(true); add(associationAttribute); DropDownChoice valueAttribute = new DropDownChoice<>(ID_VALUE_ATTRIBUTE, new PropertyModel<QName>(getModel(), "valueAttribute"), new AbstractReadOnlyModel<List<QName>>() { @Override public List<QName> getObject() { return loadObjectReferences(false); } }, new IChoiceRenderer<QName>() { @Override public Object getDisplayValue(QName object) { return prepareReferenceDisplayValue(object); } @Override public String getIdValue(QName object, int index) { return Integer.toString(index); } }); valueAttribute.setNullValid(true); add(valueAttribute); CheckBox explicitRefIntegrity = new CheckBox(ID_EXPLICIT_REF_INTEGRITY, new PropertyModel<Boolean>(getModel(), "explicitReferentialIntegrity")); add(explicitRefIntegrity); QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel<ItemPathType>(getModel(), "ref"), "SchemaHandlingStep.association.label.associationName", "SchemaHandlingStep.association.tooltip.associationLocalPart", "SchemaHandlingStep.association.label.associationNamespace", "SchemaHandlingStep.association.tooltip.associationNamespace"); nonSchemaRefPanel.setOutputMarkupId(true); nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true); add(nonSchemaRefPanel); TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName")); add(displayName); TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description")); add(description); AjaxLink limitations = new AjaxLink(ID_BUTTON_LIMITATIONS) { @Override public void onClick(AjaxRequestTarget target) { limitationsEditPerformed(target); } }; add(limitations); CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<Boolean>(getModel(), "exclusiveStrong")); add(exclusiveStrong); CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<Boolean>(getModel(), "tolerant")); add(tolerant); MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern")); add(tolerantVP); MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern")); add(intolerantVP); DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<AttributeFetchStrategyType>(getModel(), "fetchStrategy"), WebMiscUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this)); fetchStrategy.setNullValid(true); add(fetchStrategy); DropDownChoice matchingRule = new DropDownChoice<>(ID_MATCHING_RULE, new PropertyModel<QName>(getModel(), "matchingRule"), new AbstractReadOnlyModel<List<QName>>() { @Override public List<QName> getObject() { return WebMiscUtil.getMatchingRuleList(); } }, new IChoiceRenderer<QName>() { @Override public Object getDisplayValue(QName object) { return object.getLocalPart(); } @Override public String getIdValue(QName object, int index) { return Integer.toString(index); } }); matchingRule.setNullValid(true); add(matchingRule); TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new AbstractReadOnlyModel<String>() { @Override public String getObject() { ResourceObjectAssociationType association = getModel().getObject(); if (association == null) { return null; } return MappingTypeDto.createMappingLabel(association.getOutbound(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified")); } }); outboundLabel.setOutputMarkupId(true); outboundLabel.setEnabled(false); add(outboundLabel); AjaxSubmitButton outbound = new AjaxSubmitButton(ID_BUTTON_OUTBOUND) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { outboundEditPerformed(target); } }; outbound.setOutputMarkupId(true); add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(getModel(), "inbound"), false) { @Override protected IModel<String> createTextModel(final IModel<MappingType> model) { return new Model<String>() { @Override public String getObject() { return MappingTypeDto.createMappingLabel(model.getObject(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified")); } }; } @Override protected MappingType createNewEmptyItem() { return WizardUtil.createEmptyMapping(); } @Override protected void editPerformed(AjaxRequestTarget target, MappingType object) { inboundEditPerformed(target, object); } }; inbound.setOutputMarkupId(true); add(inbound); Label kindTooltip = new Label(ID_T_KIND); kindTooltip.add(new InfoTooltipBehavior()); add(kindTooltip); Label intentTooltip = new Label(ID_T_INTENT); intentTooltip.add(new InfoTooltipBehavior()); add(intentTooltip); Label directionTooltip = new Label(ID_T_DIRECTION); directionTooltip.add(new InfoTooltipBehavior()); add(directionTooltip); Label assAttributeTooltip = new Label(ID_T_ASSOCIATION_ATTRIBUTE); assAttributeTooltip.add(new InfoTooltipBehavior()); add(assAttributeTooltip); Label valueAttributeTooltip = new Label(ID_T_VALUE_ATTRIBUTE); valueAttributeTooltip.add(new InfoTooltipBehavior()); add(valueAttributeTooltip); Label integrityTooltip = new Label(ID_T_EXPLICIT_REF_INTEGRITY); integrityTooltip.add(new InfoTooltipBehavior()); add(integrityTooltip); Label limitationsTooltip = new Label(ID_T_LIMITATIONS); limitationsTooltip.add(new InfoTooltipBehavior()); add(limitationsTooltip); Label exclusiveStrongTooltip = new Label(ID_T_EXCLUSIVE_STRONG); exclusiveStrongTooltip.add(new InfoTooltipBehavior()); add(exclusiveStrongTooltip); Label tolerantTooltip = new Label(ID_T_TOLERANT); tolerantTooltip.add(new InfoTooltipBehavior()); add(tolerantTooltip); Label tolerantVPTooltip = new Label(ID_T_TOLERANT_VP); tolerantVPTooltip.add(new InfoTooltipBehavior()); add(tolerantVPTooltip); Label intolerantVPTooltip = new Label(ID_T_INTOLERANT_VP); intolerantVPTooltip.add(new InfoTooltipBehavior()); add(intolerantVPTooltip); Label fetchTooltip = new Label(ID_T_FETCH); fetchTooltip.add(new InfoTooltipBehavior()); add(fetchTooltip); Label matchingRuleTooltip = new Label(ID_T_MATCHING_RULE); matchingRuleTooltip.add(new InfoTooltipBehavior()); add(matchingRuleTooltip); Label outboundTooltip = new Label(ID_T_OUTBOUND); outboundTooltip.add(new InfoTooltipBehavior()); add(outboundTooltip); Label inboundTooltip = new Label(ID_T_INBOUND); inboundTooltip.add(new InfoTooltipBehavior()); add(inboundTooltip); initModals(); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.ResourceAttributeEditor.java
License:Apache License
@Override protected void initLayout() { Label label = new Label(ID_LABEL, new AbstractReadOnlyModel<String>() { @Override//from w w w .j a va 2 s. c o m public String getObject() { ResourceAttributeDefinitionType attribute = getModelObject(); if (attribute.getRef() == null || attribute.getRef().equals(new ItemPathType())) { return getString("ResourceAttributeEditor.label.new"); } else { return getString("ResourceAttributeEditor.label.edit", ItemPathUtil.getOnlySegmentQName(attribute.getRef()).getLocalPart()); } } }); add(label); QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel<ItemPathType>(getModel(), "ref"), "SchemaHandlingStep.attribute.label.attributeName", "SchemaHandlingStep.attribute.tooltip.attributeLocalPart", "SchemaHandlingStep.attribute.label.attributeNamespace", "SchemaHandlingStep.attribute.tooltip.attributeNamespace"); nonSchemaRefPanel.setOutputMarkupId(true); nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true); nonSchemaRefPanel.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return nonSchemaRefValueAllowed; } }); add(nonSchemaRefPanel); WebMarkupContainer schemaRefPanel = new WebMarkupContainer(ID_SCHEMA_REF_PANEL); schemaRefPanel.setOutputMarkupId(true); schemaRefPanel.setOutputMarkupPlaceholderTag(true); schemaRefPanel.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return !nonSchemaRefValueAllowed; } }); add(schemaRefPanel); Label refTooltip = new Label(ID_T_REF); refTooltip.add(new InfoTooltipBehavior()); refTooltip.setOutputMarkupId(true); refTooltip.setOutputMarkupId(true); schemaRefPanel.add(refTooltip); DropDownChoice refSelect = new DropDownChoice<ItemPathType>(ID_REFERENCE_SELECT, new PropertyModel<ItemPathType>(getModel(), "ref"), new AbstractReadOnlyModel<List<ItemPathType>>() { @Override public List<ItemPathType> getObject() { return loadObjectReferences(); } }, new IChoiceRenderer<ItemPathType>() { @Override public Object getDisplayValue(ItemPathType object) { return prepareReferenceDisplayValue(object); } @Override public String getIdValue(ItemPathType object, int index) { return Integer.toString(index); } }) { @Override protected boolean isSelected(ItemPathType object, int index, String selected) { if (getModelObject() == null || getModelObject().equals(new ItemPathType())) { return false; } QName referenceQName = ItemPathUtil.getOnlySegmentQName(getModelObject()); QName optionQName = ItemPathUtil.getOnlySegmentQName(object); return referenceQName.equals(optionQName); } }; refSelect.setNullValid(false); refSelect.setOutputMarkupId(true); refSelect.setOutputMarkupPlaceholderTag(true); schemaRefPanel.add(refSelect); CheckBox allowNonSchema = new CheckBox(ID_REFERENCE_ALLOW, new PropertyModel<Boolean>(this, "nonSchemaRefValueAllowed")); allowNonSchema.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(get(ID_NON_SCHEMA_REF_PANEL), get(ID_SCHEMA_REF_PANEL)); } }); add(allowNonSchema); TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName")); add(displayName); TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description")); add(description); AjaxLink limitations = new AjaxLink(ID_BUTTON_LIMITATIONS) { @Override public void onClick(AjaxRequestTarget target) { limitationsEditPerformed(target); } }; add(limitations); CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<Boolean>(getModel(), "exclusiveStrong")); add(exclusiveStrong); CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<Boolean>(getModel(), "tolerant")); add(tolerant); MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern")); add(tolerantVP); MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern")); add(intolerantVP); DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<AttributeFetchStrategyType>(getModel(), "fetchStrategy"), WebMiscUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this)); fetchStrategy.setNullValid(true); add(fetchStrategy); DropDownChoice matchingRule = new DropDownChoice<>(ID_MATCHING_RULE, new PropertyModel<QName>(getModel(), "matchingRule"), new AbstractReadOnlyModel<List<QName>>() { @Override public List<QName> getObject() { return WebMiscUtil.getMatchingRuleList(); } }, new IChoiceRenderer<QName>() { @Override public Object getDisplayValue(QName object) { return object.getLocalPart(); } @Override public String getIdValue(QName object, int index) { return Integer.toString(index); } }); matchingRule.setNullValid(true); add(matchingRule); TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new AbstractReadOnlyModel<String>() { @Override public String getObject() { ResourceAttributeDefinitionType attributeDefinition = getModel().getObject(); if (attributeDefinition == null) { return null; } return MappingTypeDto.createMappingLabel(attributeDefinition.getOutbound(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified")); } }); outboundLabel.setEnabled(false); outboundLabel.setOutputMarkupId(true); add(outboundLabel); AjaxSubmitLink outbound = new AjaxSubmitLink(ID_BUTTON_OUTBOUND) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { outboundEditPerformed(target); } }; outbound.setOutputMarkupId(true); add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(getModel(), "inbound"), false) { @Override protected IModel<String> createTextModel(final IModel<MappingType> model) { return new Model<String>() { @Override public String getObject() { return MappingTypeDto.createMappingLabel(model.getObject(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified")); } }; } @Override protected MappingType createNewEmptyItem() { return WizardUtil.createEmptyMapping(); } @Override protected void editPerformed(AjaxRequestTarget target, MappingType object) { inboundEditPerformed(target, object); } }; inbound.setOutputMarkupId(true); add(inbound); Label allowTooltip = new Label(ID_T_ALLOW); allowTooltip.add(new InfoTooltipBehavior()); add(allowTooltip); Label limitationsTooltip = new Label(ID_T_LIMITATIONS); limitationsTooltip.add(new InfoTooltipBehavior()); add(limitationsTooltip); Label exclusiveStrongTooltip = new Label(ID_T_EXCLUSIVE_STRONG); exclusiveStrongTooltip.add(new InfoTooltipBehavior()); add(exclusiveStrongTooltip); Label tolerantTooltip = new Label(ID_T_TOLERANT); tolerantTooltip.add(new InfoTooltipBehavior()); add(tolerantTooltip); Label tolerantVPTooltip = new Label(ID_T_TOLERANT_VP); tolerantVPTooltip.add(new InfoTooltipBehavior()); add(tolerantVPTooltip); Label intolerantVPTooltip = new Label(ID_T_INTOLERANT_VP); intolerantVPTooltip.add(new InfoTooltipBehavior()); add(intolerantVPTooltip); Label fetchTooltip = new Label(ID_T_FETCH); fetchTooltip.add(new InfoTooltipBehavior()); add(fetchTooltip); Label matchingRuleTooltip = new Label(ID_T_MATCHING_RULE); matchingRuleTooltip.add(new InfoTooltipBehavior()); add(matchingRuleTooltip); Label outboundTooltip = new Label(ID_T_OUTBOUND); outboundTooltip.add(new InfoTooltipBehavior()); add(outboundTooltip); Label inboundTooltip = new Label(ID_T_INBOUND); inboundTooltip.add(new InfoTooltipBehavior()); add(inboundTooltip); initModals(); }
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);/*from ww w . jav a2 s .c o m*/ 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 w ww . ja v a2 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); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.SchemaListPanel.java
License:Apache License
@Override protected void initLayout() { initModels();/*w ww . j a va2 s . co m*/ final ObjectClassDataProvider dataProvider = new ObjectClassDataProvider(allClasses); TextField objectClass = new TextField(ID_OBJECT_CLASS, new Model<>()); objectClass.setOutputMarkupId(true); objectClass.add(new AjaxFormComponentUpdatingBehavior("keyUp") { @Override protected void onUpdate(AjaxRequestTarget target) { updateSearchPerformed(target, dataProvider); } }); add(objectClass); AjaxButton clearSearch = new AjaxButton(ID_CLEAR_SEARCH) { @Override public void onClick(AjaxRequestTarget target) { clearSearchPerformed(target, dataProvider); } }; add(clearSearch); WebMarkupContainer tableBody = new WebMarkupContainer(ID_TABLE_BODY); tableBody.setOutputMarkupId(true); add(tableBody); DataView<ObjectClassDto> pageable = new DataView<ObjectClassDto>(ID_PAGEABLE, dataProvider) { @Override protected void populateItem(final Item<ObjectClassDto> item) { AjaxLink link = new AjaxLink(ID_CLASS_LINK) { @Override public void onClick(AjaxRequestTarget target) { objectClassClickPerformed(target, item.getModelObject(), allClasses.getObject()); } }; item.add(link); Label label = new Label(ID_LABEL, new PropertyModel<>(item.getModel(), ObjectClassDto.F_NAME)); link.add(label); item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<Object>() { @Override public Object getObject() { if (item.getModelObject().isSelected()) { return "success"; } return null; } })); } }; tableBody.add(pageable); ISortableDataProvider attributeProvider = new ListDataProvider(this, attributeModel); TablePanel attributeTable = new TablePanel(ID_ATTRIBUTE_TABLE, attributeProvider, initColumns()); attributeTable.setOutputMarkupId(true); attributeTable.setItemsPerPage(20); add(attributeTable); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.synchronization.SynchronizationActionEditorDialog.java
License:Apache License
private void initButtons(Form form) { AjaxLink cancel = new AjaxLink(ID_BUTTON_CANCEL) { @Override/* w w w. j a va 2s . c o m*/ public void onClick(AjaxRequestTarget target) { cancelPerformed(target); } }; form.add(cancel); AjaxSubmitLink save = new AjaxSubmitLink(ID_BUTTON_SAVE) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { savePerformed(target); } }; form.add(save); }
From source file:com.evolveum.midpoint.web.component.wizard.resource.component.WizardHelpDialog.java
License:Apache License
public void initLayout(WebMarkupContainer content) { Label helpLabel = new Label(ID_HELP, new AbstractReadOnlyModel<String>() { @Override//from ww w . j ava 2 s . c o m public String getObject() { return getString(determineHelpKey()); } }); helpLabel.setEscapeModelStrings(false); content.add(helpLabel); AjaxLink ok = new AjaxLink(ID_BUTTON_OK) { @Override public void onClick(AjaxRequestTarget target) { closePerformed(target); } }; content.add(ok); }
From source file:com.evolveum.midpoint.web.page.admin.certification.StageEditorPanel.java
License:Apache License
private void initPanelLayout() { AjaxLink name = new AjaxLink(ID_NAME) { @Override/*from w ww . j av a2 s . co m*/ public void onClick(AjaxRequestTarget target) { nameClickPerformed(target); } }; Label nameLabel = new Label(ID_NAME_LABEL, getModel().getObject().getName() == null || getModel().getObject().getName().trim().equals("") ? "Stage definition #" + getModel().getObject().getNumber() : getModel().getObject().getName()); name.add(nameLabel); add(name); }
From source file:com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel.java
License:Apache License
@Override protected void initLayout() { final Label name = new Label(ID_OBJECT_NAME, new AbstractReadOnlyModel<String>() { @Override//from w ww . j a v a 2 s . c om public String getObject() { ObjectViewDto dto = getModel().getObject(); if (dto.getName() != null) return getModel().getObject().getName(); else return createStringResource("chooseTypePanel.ObjectNameValue.null").getString(); } }); name.setOutputMarkupId(true); AjaxLink choose = new AjaxLink(ID_LINK_CHOOSE) { @Override public void onClick(AjaxRequestTarget target) { changeOptionPerformed(target); } }; AjaxLink remove = new AjaxLink(ID_LINK_REMOVE) { @Override public void onClick(AjaxRequestTarget target) { setToDefault(); target.add(name); } }; add(choose); add(remove); add(name); initDialog(); }