use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceCredentialsEditor method initLayout.
protected void initLayout(final PageResourceWizard parentPage) {
DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<AttributeFetchStrategyType>(getModel(), "password.fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this));
parentPage.addEditingEnabledBehavior(fetchStrategy);
add(fetchStrategy);
VisibleEnableBehaviour showIfEditingOrOutboundExists = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
ResourceCredentialsDefinitionType credentials = getModel().getObject();
if (credentials == null || credentials.getPassword() == null) {
return !parentPage.isReadOnly();
}
return !parentPage.isReadOnly() || credentials.getPassword().getOutbound() != null;
}
};
TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
ResourceCredentialsDefinitionType credentials = getModel().getObject();
if (credentials == null || credentials.getPassword() == null) {
return null;
}
// TODO: support multiple password mappings
MappingType outbound = null;
List<MappingType> outbounds = credentials.getPassword().getOutbound();
if (!outbounds.isEmpty()) {
outbound = outbounds.get(0);
}
return MappingTypeDto.createMappingLabel(outbound, LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
}
});
outboundLabel.setEnabled(false);
outboundLabel.setOutputMarkupId(true);
outboundLabel.add(showIfEditingOrOutboundExists);
add(outboundLabel);
AjaxSubmitLink outbound = new AjaxSubmitLink(ID_OUTBOUND_BUTTON) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
outboundEditPerformed(target);
}
};
outbound.setOutputMarkupId(true);
outbound.add(showIfEditingOrOutboundExists);
add(outbound);
MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(getModel(), "password.inbound"), null, false, true, parentPage.getReadOnlyModel()) {
@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);
DropDownChoice passwordPolicy = new DropDownChoice<>(ID_PASS_POLICY, new PropertyModel<ObjectReferenceType>(getModel(), "password.passwordPolicyRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ValuePolicyType.class, getPageBase(), passPolicyMap);
}
}, new ObjectReferenceChoiceRenderer(passPolicyMap));
parentPage.addEditingEnabledBehavior(passwordPolicy);
add(passwordPolicy);
Label fetchTooltip = new Label(ID_T_FETCH);
fetchTooltip.add(new InfoTooltipBehavior());
add(fetchTooltip);
Label outTooltip = new Label(ID_T_OUT);
outTooltip.add(new InfoTooltipBehavior());
add(outTooltip);
Label inTooltip = new Label(ID_T_IN);
inTooltip.add(new InfoTooltipBehavior());
add(inTooltip);
Label passPolicyTooltip = new Label(ID_T_PASS_POLICY);
passPolicyTooltip.add(new InfoTooltipBehavior());
add(passPolicyTooltip);
initModals(parentPage.getReadOnlyModel());
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceCredentialsEditor method initModals.
private void initModals(NonEmptyModel<Boolean> readOnlyModel) {
ModalWindow inboundEditor = new MappingEditorDialog(ID_MODAL_INBOUND, null, readOnlyModel) {
@Override
public void updateComponents(AjaxRequestTarget target) {
target.add(ResourceCredentialsEditor.this.get(ID_INBOUND));
}
};
add(inboundEditor);
ModalWindow outboundEditor = new MappingEditorDialog(ID_MODAL_OUTBOUND, null, readOnlyModel) {
@Override
public void updateComponents(AjaxRequestTarget target) {
target.add(ResourceCredentialsEditor.this.get(ID_OUTBOUND_LABEL), ResourceCredentialsEditor.this.get(ID_OUTBOUND_BUTTON));
}
};
add(outboundEditor);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceDependencyEditor method initLayout.
protected void initLayout(final PageResourceWizard parentPage) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
container.setOutputMarkupId(true);
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);
}
};
parentPage.addEditingVisibleBehavior(delete);
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());
parentPage.addEditingEnabledBehavior(order);
dependencyBody.add(order);
DropDownChoice strictness = new DropDownChoice<>(ID_STRICTNESS, new PropertyModel<ResourceObjectTypeDependencyStrictnessType>(item.getModelObject(), "strictness"), WebComponentUtil.createReadonlyModelFromEnum(ResourceObjectTypeDependencyStrictnessType.class), new EnumChoiceRenderer<ResourceObjectTypeDependencyStrictnessType>(this));
strictness.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(strictness);
dependencyBody.add(strictness);
DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(item.getModelObject(), "kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
kind.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(kind);
dependencyBody.add(kind);
TextField intent = new TextField<>(ID_INTENT, new PropertyModel<String>(item.getModelObject(), "intent"));
intent.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(intent);
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 WebModelServiceUtils.createObjectReferenceList(ResourceType.class, getPageBase(), resourceMap);
}
}, new ObjectReferenceChoiceRenderer(resourceMap));
resource.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(resource);
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);
}
};
parentPage.addEditingVisibleBehavior(add);
add(add);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class ResourceIterationEditor method prepareIterationSubsectionBody.
private void prepareIterationSubsectionBody(String containerValue, String descriptionId, String variableId, String returnMultiplicityId, String expressionType, final String expression, final String languageId, final String policyId, final String prefix, final String languageContainerId, final String policyContainerId, PageResourceWizard parentPage) {
TextArea description = new TextArea<>(descriptionId, new PropertyModel<String>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".description"));
parentPage.addEditingEnabledBehavior(description);
add(description);
MultiValueTextEditPanel variableList = new MultiValueTextEditPanel<ExpressionVariableDefinitionType>(variableId, new PropertyModel<List<ExpressionVariableDefinitionType>>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".variable"), null, false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<ExpressionVariableDefinitionType> model) {
return new Model<String>() {
@Override
public String getObject() {
ExpressionVariableDefinitionType variable = model.getObject();
if (variable != null && variable.getName() != null) {
return variable.getName().getLocalPart();
} else {
return null;
}
}
};
}
@Override
protected ExpressionVariableDefinitionType createNewEmptyItem() {
return new ExpressionVariableDefinitionType();
}
@Override
protected void editPerformed(AjaxRequestTarget target, ExpressionVariableDefinitionType object) {
expressionVariableEditPerformed(target, object);
}
};
add(variableList);
DropDownChoice returnMultiplicity = new DropDownChoice<>(returnMultiplicityId, new PropertyModel<ExpressionReturnMultiplicityType>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".returnMultiplicity"), WebComponentUtil.createReadonlyModelFromEnum(ExpressionReturnMultiplicityType.class), new EnumChoiceRenderer<ExpressionReturnMultiplicityType>(this));
parentPage.addEditingEnabledBehavior(returnMultiplicity);
add(returnMultiplicity);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class CertDecisionHelper method createTargetNameColumn.
<T extends CertCaseOrWorkItemDto> IColumn<T, String> createTargetNameColumn(final PageBase page, final String headerKey) {
IColumn column;
column = new LinkColumn<CertCaseOrWorkItemDto>(page.createStringResource(headerKey), SearchingUtils.TARGET_NAME, CertCaseOrWorkItemDto.F_TARGET_NAME) {
@Override
public void onClick(AjaxRequestTarget target, IModel<CertCaseOrWorkItemDto> rowModel) {
CertCaseOrWorkItemDto dto = rowModel.getObject();
dispatchToObjectDetailsPage(dto.getCertCase().getTargetRef(), page, false);
}
};
return column;
}
Aggregations