use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.
the class SynchronizationStep method initObjectSyncEditor.
private void initObjectSyncEditor(WebMarkupContainer editor) {
Label editorLabel = new Label(ID_EDITOR_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (!isAnySelected()) {
// shouldn't occur
return null;
}
String name = syncDtoModel.getObject().getSelected().getName() != null ? syncDtoModel.getObject().getSelected().getName() : "";
return getString("SynchronizationStep.label.editSyncObject", name);
}
});
editorLabel.setOutputMarkupId(true);
editor.add(editorLabel);
TextField editorName = new TextField<>(ID_EDITOR_NAME, new PropertyModel<String>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".name"));
editorName.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorName);
editor.add(editorName);
TextArea editorDescription = new TextArea<>(ID_EDITOR_DESCRIPTION, new PropertyModel<String>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".description"));
parentPage.addEditingEnabledBehavior(editorDescription);
editor.add(editorDescription);
DropDownChoice editorKind = new DropDownChoice<>(ID_EDITOR_KIND, new PropertyModel<ShadowKindType>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>());
editorKind.setNullValid(true);
editorKind.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorKind);
editor.add(editorKind);
TextField editorIntent = new TextField<>(ID_EDITOR_INTENT, new PropertyModel<String>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".intent"));
editorIntent.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorIntent);
editor.add(editorIntent);
MultiValueAutoCompleteTextPanel<QName> editorObjectClass = new MultiValueAutoCompleteTextPanel<QName>(ID_EDITOR_OBJECT_CLASS, new PropertyModel<List<QName>>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".objectClass"), true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<QName> model) {
return new PropertyModel<>(model, "localPart");
}
@Override
protected QName createNewEmptyItem() {
return new QName("");
}
@Override
protected boolean buttonsDisabled() {
return !isAnySelected();
}
@Override
protected List<QName> createObjectList() {
return syncDtoModel.getObject().getObjectClassList();
}
@Override
protected String createAutoCompleteObjectLabel(QName object) {
return object.getLocalPart();
}
@Override
protected IValidator<String> createAutoCompleteValidator() {
return createObjectClassValidator(new AbstractReadOnlyModel<List<QName>>() {
@Override
public List<QName> getObject() {
return syncDtoModel.getObject().getObjectClassList();
}
});
}
};
parentPage.addEditingEnabledBehavior(editorObjectClass);
editor.add(editorObjectClass);
// TODO: switch to ObjectTypeSelectPanel
DropDownChoice editorFocus = new DropDownChoice<>(ID_EDITOR_FOCUS, new PropertyModel<QName>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".focusType"), new AbstractReadOnlyModel<List<QName>>() {
@Override
public List<QName> getObject() {
return WebComponentUtil.createFocusTypeList();
}
}, new QNameChoiceRenderer());
editorFocus.setNullValid(true);
editorFocus.add(new UpdateNamesBehaviour());
parentPage.addEditingEnabledBehavior(editorFocus);
editor.add(editorFocus);
CheckBox editorEnabled = new CheckBox(ID_EDITOR_ENABLED, new PropertyModel<Boolean>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".enabled"));
parentPage.addEditingEnabledBehavior(editorEnabled);
editor.add(editorEnabled);
AjaxSubmitLink editorCondition = new AjaxSubmitLink(ID_EDITOR_BUTTON_CONDITION) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
conditionEditPerformed(target);
}
};
addDisableClassModifier(editorCondition);
editor.add(editorCondition);
AjaxSubmitLink editorConfirmation = new AjaxSubmitLink(ID_EDITOR_BUTTON_CONFIRMATION) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
confirmationEditPerformed(target);
}
};
addDisableClassModifier(editorConfirmation);
editor.add(editorConfirmation);
DropDownChoice editorObjectTemplate = new DropDownChoice<>(ID_EDITOR_OBJECT_TEMPLATE, new PropertyModel<ObjectReferenceType>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".objectTemplateRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ObjectTemplateType.class, getPageBase(), syncDtoModel.getObject().getObjectTemplateMap());
}
}, new ObjectReferenceChoiceRenderer(syncDtoModel.getObject().getObjectTemplateMap()));
editorObjectTemplate.setNullValid(true);
parentPage.addEditingEnabledBehavior(editorObjectTemplate);
editor.add(editorObjectTemplate);
CheckBox editorReconcile = new CheckBox(ID_EDITOR_RECONCILE, new PropertyModel<Boolean>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".reconcile"));
parentPage.addEditingEnabledBehavior(editorReconcile);
editor.add(editorReconcile);
TriStateComboPanel opportunistic = new TriStateComboPanel(ID_EDITOR_OPPORTUNISTIC, new PropertyModel<Boolean>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".opportunistic"));
parentPage.addEditingEnabledBehavior(opportunistic);
editor.add(opportunistic);
MultiValueTextEditPanel editorCorrelation = new MultiValueTextEditPanel<ConditionalSearchFilterType>(ID_EDITOR_EDITOR_CORRELATION, new PropertyModel<List<ConditionalSearchFilterType>>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".correlation"), new PropertyModel<ConditionalSearchFilterType>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED_CORRELATION), false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<ConditionalSearchFilterType> model) {
return new Model<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
ConditionalSearchFilterType searchFilter = model.getObject();
if (searchFilter != null && searchFilter.getDescription() != null) {
sb.append(searchFilter.getDescription());
}
if (sb.toString().isEmpty()) {
sb.append(getString("SynchronizationStep.label.notSpecified"));
}
return sb.toString();
}
};
}
@Override
protected ConditionalSearchFilterType createNewEmptyItem() {
return new ConditionalSearchFilterType();
}
@Override
protected void editPerformed(AjaxRequestTarget target, ConditionalSearchFilterType object) {
correlationEditPerformed(target, object);
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, ConditionalSearchFilterType added) {
parentPage.refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<ConditionalSearchFilterType> item) {
parentPage.refreshIssues(target);
}
@Override
protected boolean buttonsDisabled() {
return !isAnySelected();
}
};
editor.add(editorCorrelation);
MultiValueTextEditPanel editorReaction = new MultiValueTextEditPanel<SynchronizationReactionType>(ID_EDITOR_REACTION, new PropertyModel<List<SynchronizationReactionType>>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED + ".reaction"), new PropertyModel<SynchronizationReactionType>(syncDtoModel, ResourceSynchronizationDto.F_SELECTED_REACTION), false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<SynchronizationReactionType> model) {
return new Model<String>() {
@Override
public String getObject() {
SynchronizationReactionType reaction = model.getObject();
if (reaction == null) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(reaction.getName() != null ? reaction.getName() + " " : "");
sb.append("(");
if (reaction.getSituation() != null) {
sb.append(reaction.getSituation());
}
if (Boolean.TRUE.equals(reaction.isSynchronize()) || !reaction.getAction().isEmpty()) {
sb.append(" -> ");
if (!reaction.getAction().isEmpty()) {
boolean first = true;
for (SynchronizationActionType action : reaction.getAction()) {
if (first) {
first = false;
} else {
sb.append(", ");
}
sb.append(StringUtils.substringAfter(action.getHandlerUri(), "#"));
}
} else {
// TODO i18n
sb.append("sync");
}
}
sb.append(")");
return sb.toString();
}
};
}
@Override
protected SynchronizationReactionType createNewEmptyItem() {
return new SynchronizationReactionType();
}
@Override
protected void editPerformed(AjaxRequestTarget target, SynchronizationReactionType object) {
reactionEditPerformed(target, object);
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, SynchronizationReactionType added) {
parentPage.refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<SynchronizationReactionType> item) {
parentPage.refreshIssues(target);
}
@Override
protected boolean buttonsDisabled() {
return !isAnySelected();
}
};
editorReaction.setOutputMarkupId(true);
editor.add(editorReaction);
Label kindTooltip = new Label(ID_T_KIND);
kindTooltip.add(new InfoTooltipBehavior());
editor.add(kindTooltip);
Label intentTooltip = new Label(ID_T_INTENT);
intentTooltip.add(new InfoTooltipBehavior());
editor.add(intentTooltip);
Label objClassTooltip = new Label(ID_T_OBJ_CLASS);
objClassTooltip.add(new InfoTooltipBehavior());
editor.add(objClassTooltip);
Label focusTooltip = new Label(ID_T_FOCUS);
focusTooltip.add(new InfoTooltipBehavior());
editor.add(focusTooltip);
Label enabledTooltip = new Label(ID_T_ENABLED);
enabledTooltip.add(new InfoTooltipBehavior());
editor.add(enabledTooltip);
Label conditionTooltip = new Label(ID_T_CONDITION);
conditionTooltip.add(new InfoTooltipBehavior());
editor.add(conditionTooltip);
Label confirmationTooltip = new Label(ID_T_CONFIRMATION);
confirmationTooltip.add(new InfoTooltipBehavior());
editor.add(confirmationTooltip);
Label objTemplateTooltip = new Label(ID_T_OBJ_TEMPLATE);
objTemplateTooltip.add(new InfoTooltipBehavior());
editor.add(objTemplateTooltip);
Label reconcileTooltip = new Label(ID_T_RECONCILE);
reconcileTooltip.add(new InfoTooltipBehavior());
editor.add(reconcileTooltip);
Label opportunisticTooltip = new Label(ID_T_OPPORTUNISTIC);
opportunisticTooltip.add(new InfoTooltipBehavior());
editor.add(opportunisticTooltip);
Label correlationTooltip = new Label(ID_T_CORRELATION);
correlationTooltip.add(new InfoTooltipBehavior());
editor.add(correlationTooltip);
Label reactionTooltip = new Label(ID_T_REACTION);
reactionTooltip.add(new InfoTooltipBehavior());
editor.add(reactionTooltip);
}
use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.
the class SynchronizationReactionEditor method initLayout.
protected void initLayout(PageResourceWizard parentPage) {
Label label = new Label(ID_LABEL, new ResourceModel("SynchronizationReactionEditor.label.edit"));
add(label);
TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(getModel(), "name"));
name.add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(name);
add(name);
TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
parentPage.addEditingEnabledBehavior(description);
add(description);
DropDownChoice situation = new DropDownChoice<>(ID_SITUATION, new PropertyModel<SynchronizationSituationType>(getModel(), "situation"), WebComponentUtil.createReadonlyModelFromEnum(SynchronizationSituationType.class), new EnumChoiceRenderer<SynchronizationSituationType>(this));
situation.setNullValid(true);
situation.add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(situation);
situation.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
});
add(situation);
MultiValueDropDownPanel channel = new MultiValueDropDownPanel<String>(ID_CHANNEL, new PropertyModel<List<String>>(getModel(), "channel"), true, parentPage.getReadOnlyModel()) {
@Override
protected String createNewEmptyItem() {
return "";
}
@Override
protected IModel<List<String>> createChoiceList() {
return new AbstractReadOnlyModel<List<String>>() {
@Override
public List<String> getObject() {
return WebComponentUtil.getChannelList();
}
};
}
@Override
protected IChoiceRenderer<String> createRenderer() {
return new StringChoiceRenderer("Channel.", "#");
}
};
add(channel);
TriStateComboPanel synchronize = new TriStateComboPanel(ID_SYNCHRONIZE, new PropertyModel<Boolean>(getModel(), "synchronize"));
synchronize.getBaseFormComponent().add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(synchronize);
add(synchronize);
CheckBox reconcile = new CheckBox(ID_RECONCILE, new PropertyModel<Boolean>(getModel(), "reconcile"));
parentPage.addEditingEnabledBehavior(reconcile);
add(reconcile);
DropDownChoice objectTemplateRef = new DropDownChoice<>(ID_OBJECT_TEMPLATE_REF, new PropertyModel<ObjectReferenceType>(getModel(), "objectTemplateRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ObjectTemplateType.class, getPageBase(), objectTemplateMap);
}
}, new ObjectReferenceChoiceRenderer(objectTemplateMap));
objectTemplateRef.setNullValid(true);
parentPage.addEditingEnabledBehavior(objectTemplateRef);
add(objectTemplateRef);
MultiValueTextEditPanel action = new MultiValueTextEditPanel<SynchronizationActionType>(ID_ACTION, new PropertyModel<List<SynchronizationActionType>>(getModel(), "action"), null, false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<SynchronizationActionType> model) {
return new Model<String>() {
@Override
public String getObject() {
SynchronizationActionType action = model.getObject();
if (action == null) {
return null;
}
StringBuilder sb = new StringBuilder();
sb.append(action.getName() != null ? action.getName() : "-");
if (action.getHandlerUri() != null) {
sb.append(" (").append(StringUtils.substringAfter(action.getHandlerUri(), "#")).append(")");
}
return sb.toString();
}
};
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, SynchronizationActionType added) {
target.add(parentStep.getReactionList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<SynchronizationActionType> item) {
target.add(parentStep.getReactionList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected SynchronizationActionType createNewEmptyItem() {
return new SynchronizationActionType();
}
@Override
protected void editPerformed(AjaxRequestTarget target, SynchronizationActionType object) {
actionEditPerformed(target, object);
}
};
action.setOutputMarkupId(true);
add(action);
Label situationTooltip = new Label(ID_T_SITUATION);
situationTooltip.add(new InfoTooltipBehavior());
add(situationTooltip);
Label channelTooltip = new Label(ID_T_CHANNEL);
channelTooltip.add(new InfoTooltipBehavior());
add(channelTooltip);
Label synchronizeTooltip = new Label(ID_T_SYNCHRONIZE);
synchronizeTooltip.add(new InfoTooltipBehavior());
add(synchronizeTooltip);
Label reconcileTooltip = new Label(ID_T_RECONCILE);
reconcileTooltip.add(new InfoTooltipBehavior());
add(reconcileTooltip);
Label objTemplateTooltip = new Label(ID_T_OBJ_TEMPLATE);
objTemplateTooltip.add(new InfoTooltipBehavior());
add(objTemplateTooltip);
Label actionTooltip = new Label(ID_T_ACTION);
actionTooltip.add(new InfoTooltipBehavior());
add(actionTooltip);
initModals();
}
use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel 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 com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel 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 com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.
the class ResourceAssociationEditor method initLayout.
protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {
Label label = new Label(ID_LABEL, new ResourceModel("ResourceAssociationEditor.label.edit"));
label.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(label);
DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(getModel(), "kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
kind.setNullValid(false);
kind.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(kind);
MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT, new PropertyModel<List<String>>(getModel(), "intent"), readOnlyModel, true);
intent.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intent);
DropDownChoice direction = new DropDownChoice<>(ID_DIRECTION, new PropertyModel<ResourceObjectAssociationDirectionType>(getModel(), "direction"), WebComponentUtil.createReadonlyModelFromEnum(ResourceObjectAssociationDirectionType.class), new EnumChoiceRenderer<ResourceObjectAssociationDirectionType>(this));
direction.setNullValid(true);
direction.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
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 QNameChoiceRenderer(true));
associationAttribute.setNullValid(true);
associationAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
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 QNameChoiceRenderer(true));
valueAttribute.setNullValid(true);
valueAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(valueAttribute);
CheckBox explicitRefIntegrity = new CheckBox(ID_EXPLICIT_REF_INTEGRITY, new PropertyModel<Boolean>(getModel(), "explicitReferentialIntegrity"));
explicitRefIntegrity.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
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", true, true) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAssociationList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
};
nonSchemaRefPanel.setOutputMarkupId(true);
nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true);
nonSchemaRefPanel.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(nonSchemaRefPanel);
TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName"));
displayName.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAssociationList());
}
});
displayName.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(displayName);
TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
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"));
exclusiveStrong.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(exclusiveStrong);
CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<Boolean>(getModel(), "tolerant"));
tolerant.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerant);
MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerantVP);
MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intolerantVP);
DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<AttributeFetchStrategyType>(getModel(), "fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this));
fetchStrategy.setNullValid(true);
fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(fetchStrategy);
AttributeEditorUtils.addMatchingRuleFields(this, readOnlyModel);
VisibleEnableBehaviour showIfEditingOrOutboundExists = AttributeEditorUtils.createShowIfEditingOrOutboundExists(getModel(), readOnlyModel);
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);
outboundLabel.add(showIfEditingOrOutboundExists);
add(outboundLabel);
AjaxSubmitButton outbound = new AjaxSubmitButton(ID_BUTTON_OUTBOUND) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
outboundEditPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(parentStep.getPageBase().getFeedbackPanel());
}
};
outbound.setOutputMarkupId(true);
outbound.add(showIfEditingOrOutboundExists);
add(outbound);
AjaxSubmitLink deleteOutbound = new AjaxSubmitLink(ID_DELETE_OUTBOUND) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
deleteOutboundPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(parentStep.getPageBase().getFeedbackPanel());
}
};
deleteOutbound.setOutputMarkupId(true);
deleteOutbound.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
add(deleteOutbound);
MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(getModel(), "inbound"), null, false, true, readOnlyModel) {
@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 performAddValueHook(AjaxRequestTarget target, MappingType added) {
target.add(parentStep.getAssociationList());
// because of marking duplicates
target.add(parentStep.getAttributeList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<MappingType> item) {
target.add(parentStep.getAssociationList());
// because of marking duplicates
target.add(parentStep.getAttributeList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@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(readOnlyModel);
}
Aggregations