use of org.apache.wicket.markup.html.form.TextArea in project midpoint by Evolveum.
the class ScriptExecutionHandlerPanel method initLayout.
private void initLayout() {
WebMarkupContainer scriptContainer = new WebMarkupContainer(ID_SCRIPT_CONTAINER);
TextArea script = new TextArea<>(ID_SCRIPT, new PropertyModel<>(getModel(), ScriptExecutionHandlerDto.F_SCRIPT));
script.setEnabled(false);
scriptContainer.add(script);
add(scriptContainer);
}
use of org.apache.wicket.markup.html.form.TextArea in project midpoint by Evolveum.
the class ExecuteChangesHandlerPanel method initLayout.
private void initLayout() {
WebMarkupContainer changeContainer = new WebMarkupContainer(ID_CHANGE_CONTAINER);
TextArea change = new TextArea<>(ID_CHANGE, new PropertyModel<>(getModel(), ExecuteChangesHandlerDto.F_OBJECT_DELTA_XML));
change.setEnabled(false);
changeContainer.add(change);
add(changeContainer);
WebMarkupContainer optionsContainer = new WebMarkupContainer(ID_OPTIONS_CONTAINER);
TextArea options = new TextArea<>(ID_OPTIONS, new PropertyModel<>(getModel(), ExecuteChangesHandlerDto.F_OPTIONS));
options.setEnabled(false);
optionsContainer.add(options);
add(optionsContainer);
}
use of org.apache.wicket.markup.html.form.TextArea in project midpoint by Evolveum.
the class ExpressionEditorPanel method initLayout.
protected void initLayout(PageResourceWizard parentPage) {
parentPage.addEditingEnabledBehavior(this);
setOutputMarkupId(true);
loadDtoModel();
Label descriptionLabel = new Label(ID_LABEL_DESCRIPTION, createStringResource(getDescriptionLabelKey()));
add(descriptionLabel);
TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(dtoModel, ExpressionTypeDto.F_DESCRIPTION));
description.setOutputMarkupId(true);
//parentPage.addEditingEnabledBehavior(description);
add(description);
Label typeLabel = new Label(ID_LABEL_TYPE, createStringResource(getTypeLabelKey()));
add(typeLabel);
DropDownChoice type = new DropDownChoice<>(ID_TYPE, new PropertyModel<ExpressionUtil.ExpressionEvaluatorType>(dtoModel, ExpressionTypeDto.F_TYPE), WebComponentUtil.createReadonlyModelFromEnum(ExpressionUtil.ExpressionEvaluatorType.class), new EnumChoiceRenderer<ExpressionUtil.ExpressionEvaluatorType>(this));
//parentPage.addEditingEnabledBehavior(type);
type.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
dtoModel.getObject().updateExpressionType();
//target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
// because of ACE editor
target.add(ExpressionEditorPanel.this);
}
});
type.setOutputMarkupId(true);
type.setOutputMarkupPlaceholderTag(true);
type.setNullValid(true);
add(type);
WebMarkupContainer languageContainer = new WebMarkupContainer(ID_LANGUAGE_CONTAINER);
languageContainer.setOutputMarkupId(true);
languageContainer.setOutputMarkupPlaceholderTag(true);
languageContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return ExpressionUtil.ExpressionEvaluatorType.SCRIPT.equals(dtoModel.getObject().getType());
}
});
//parentPage.addEditingEnabledBehavior(languageContainer);
add(languageContainer);
DropDownChoice language = new DropDownChoice<>(ID_LANGUAGE, new PropertyModel<ExpressionUtil.Language>(dtoModel, ExpressionTypeDto.F_LANGUAGE), WebComponentUtil.createReadonlyModelFromEnum(ExpressionUtil.Language.class), new EnumChoiceRenderer<ExpressionUtil.Language>(this));
//parentPage.addEditingEnabledBehavior(language);
language.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
dtoModel.getObject().updateExpressionLanguage();
//target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
// because of ACE editor
target.add(ExpressionEditorPanel.this);
}
});
language.setNullValid(false);
languageContainer.add(language);
WebMarkupContainer policyContainer = new WebMarkupContainer(ID_POLICY_CONTAINER);
policyContainer.setOutputMarkupId(true);
policyContainer.setOutputMarkupPlaceholderTag(true);
policyContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return ExpressionUtil.ExpressionEvaluatorType.GENERATE.equals(dtoModel.getObject().getType());
}
});
add(policyContainer);
DropDownChoice policyRef = new DropDownChoice<>(ID_POLICY_REF, new PropertyModel<ObjectReferenceType>(dtoModel, ExpressionTypeDto.F_POLICY_REF), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ValuePolicyType.class, getPageBase(), policyMap);
}
}, new ObjectReferenceChoiceRenderer(policyMap));
//parentPage.addEditingEnabledBehavior(policyRef);
policyRef.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
dtoModel.getObject().updateExpressionValuePolicyRef();
target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
}
});
policyRef.setNullValid(true);
policyContainer.add(policyRef);
Label expressionLabel = new Label(ID_LABEL_EXPRESSION, createStringResource(getExpressionLabelKey()));
add(expressionLabel);
AceEditor expression = new AceEditor(ID_EXPRESSION, new PropertyModel<String>(dtoModel, ExpressionTypeDto.F_EXPRESSION));
expression.setOutputMarkupId(true);
//parentPage.addEditingEnabledBehavior(expression);
add(expression);
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateExpressionPerformed(target);
}
};
Label updateLabel = new Label(ID_LABEL_UPDATE, createStringResource(getUpdateLabelKey()));
updateLabel.setRenderBodyOnly(true);
update.add(updateLabel);
parentPage.addEditingVisibleBehavior(update);
add(update);
add(WebComponentUtil.createHelp(ID_T_TYPE));
languageContainer.add(WebComponentUtil.createHelp(ID_T_LANGUAGE));
policyContainer.add(WebComponentUtil.createHelp(ID_T_POLICY));
add(WebComponentUtil.createHelp(ID_T_EXPRESSION));
}
use of org.apache.wicket.markup.html.form.TextArea in project midpoint by Evolveum.
the class SearchFilterPanel method initLayout.
protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {
TextArea<String> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), SearchFilterType.F_DESCRIPTION.getLocalPart()));
description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(description);
AceEditor clause = new AceEditor(ID_FILTER_CLAUSE, clauseStringModel);
clause.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(clause);
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateClausePerformed(target);
}
};
update.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
add(update);
Label clauseTooltip = new Label(ID_T_CLAUSE);
clauseTooltip.add(new InfoTooltipBehavior());
add(clauseTooltip);
}
use of org.apache.wicket.markup.html.form.TextArea in project midpoint by Evolveum.
the class AssignmentEditorPanel method initBodyLayout.
protected void initBodyLayout(WebMarkupContainer body) {
WebMarkupContainer propertyContainer = new WebMarkupContainer(ID_PROPERTY_CONTAINER);
propertyContainer.setOutputMarkupId(true);
body.add(propertyContainer);
WebMarkupContainer descriptionContainer = new WebMarkupContainer(ID_DESCRIPTION_CONTAINER);
descriptionContainer.setOutputMarkupId(true);
descriptionContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_DESCRIPTION));
}
});
body.add(descriptionContainer);
TextArea<String> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), AssignmentEditorDto.F_DESCRIPTION));
description.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return getModel().getObject().isEditable();
}
});
descriptionContainer.add(description);
WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
relationContainer.setOutputMarkupId(true);
relationContainer.setOutputMarkupPlaceholderTag(true);
relationContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (!isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF, ObjectReferenceType.F_RELATION))) {
return false;
}
AssignmentEditorDto dto = getModel().getObject();
if (dto != null) {
if (AssignmentEditorDtoType.ORG_UNIT.equals(dto.getType()) || AssignmentEditorDtoType.SERVICE.equals(dto.getType()) || AssignmentEditorDtoType.ROLE.equals(dto.getType())) {
return true;
}
}
return false;
}
});
body.add(relationContainer);
addRelationDropDown(relationContainer);
WebMarkupContainer focusTypeContainer = new WebMarkupContainer(ID_FOCUS_TYPE_CONTAINER);
focusTypeContainer.setOutputMarkupId(true);
focusTypeContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_FOCUS_TYPE));
}
});
body.add(focusTypeContainer);
ObjectTypeSelectPanel<FocusType> focusType = new ObjectTypeSelectPanel<>(ID_FOCUS_TYPE, new PropertyModel<>(getModel(), AssignmentEditorDto.F_FOCUS_TYPE), FocusType.class);
focusTypeContainer.add(focusType);
Label relationLabel = new Label(ID_RELATION_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (getModel() == null || getModel().getObject() == null) {
return getString("AssignmentEditorPanel.relation.notSpecified");
}
AssignmentEditorDto object = getModel().getObject();
String propertyKey = RelationTypes.class.getSimpleName() + "." + (object.getTargetRef() == null || object.getTargetRef().getRelation() == null ? RelationTypes.MEMBER : RelationTypes.getRelationType(object.getTargetRef().getRelation()));
return createStringResource(propertyKey).getString();
}
});
relationLabel.setOutputMarkupId(true);
relationLabel.setOutputMarkupPlaceholderTag(true);
relationLabel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !isCreatingNewAssignment();
}
});
relationContainer.add(relationLabel);
WebMarkupContainer tenantRefContainer = createTenantContainer();
tenantRefContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_TENANT_REF));
}
});
body.add(tenantRefContainer);
WebMarkupContainer orgRefContainer = createOrgContainer();
orgRefContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_ORG_REF));
}
});
body.add(orgRefContainer);
propertyContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_DESCRIPTION)) || isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF, ObjectReferenceType.F_RELATION)) || isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_FOCUS_TYPE)) || isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_TENANT_REF)) || isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_ORG_REF));
}
});
WebMarkupContainer activationBlock = new WebMarkupContainer(ID_ACTIVATION_BLOCK);
body.add(activationBlock);
WebMarkupContainer adminStatusContainer = new WebMarkupContainer(ID_ADMIN_STATUS_CONTAINER);
adminStatusContainer.setOutputMarkupId(true);
adminStatusContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS));
}
});
activationBlock.add(adminStatusContainer);
DropDownChoicePanel administrativeStatus = WebComponentUtil.createEnumPanel(ActivationStatusType.class, ID_ADMINISTRATIVE_STATUS, new PropertyModel<ActivationStatusType>(getModel(), AssignmentEditorDto.F_ACTIVATION + "." + ActivationType.F_ADMINISTRATIVE_STATUS.getLocalPart()), this);
administrativeStatus.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return getModel().getObject().isEditable();
}
});
adminStatusContainer.add(administrativeStatus);
WebMarkupContainer validFromContainer = new WebMarkupContainer(ID_VALID_FROM_CONTAINER);
validFromContainer.setOutputMarkupId(true);
validFromContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_ACTIVATION, ActivationType.F_VALID_FROM));
}
});
activationBlock.add(validFromContainer);
DateInput validFrom = new DateInput(ID_VALID_FROM, createDateModel(new PropertyModel<>(getModel(), AssignmentEditorDto.F_ACTIVATION + ".validFrom")));
validFrom.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return getModel().getObject().isEditable();
}
});
validFromContainer.add(validFrom);
WebMarkupContainer validToContainer = new WebMarkupContainer(ID_VALID_TO_CONTAINER);
validToContainer.setOutputMarkupId(true);
validToContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_ACTIVATION, ActivationType.F_VALID_TO));
}
});
activationBlock.add(validToContainer);
DateInput validTo = new DateInput(ID_VALID_TO, createDateModel(new PropertyModel<>(getModel(), AssignmentEditorDto.F_ACTIVATION + ".validTo")));
validTo.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return getModel().getObject().isEditable();
}
});
validToContainer.add(validTo);
activationBlock.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
// enabled activation in assignments for now.
return true;
}
});
WebMarkupContainer targetContainer = new WebMarkupContainer(ID_TARGET_CONTAINER);
targetContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
if (!isItemAllowed(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_TARGET))) {
return false;
}
AssignmentEditorDto dto = getModel().getObject();
return !AssignmentEditorDtoType.CONSTRUCTION.equals(dto.getType());
}
});
body.add(targetContainer);
Label target = new Label(ID_TARGET, createTargetModel());
targetContainer.add(target);
WebMarkupContainer constructionContainer = new WebMarkupContainer(ID_CONSTRUCTION_CONTAINER);
constructionContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto dto = getModel().getObject();
return AssignmentEditorDtoType.CONSTRUCTION.equals(dto.getType());
}
});
body.add(constructionContainer);
AjaxLink showEmpty = new AjaxLink(ID_SHOW_EMPTY) {
@Override
public void onClick(AjaxRequestTarget target) {
showEmptyPerformed(target);
}
};
constructionContainer.add(showEmpty);
Label showEmptyLabel = new Label(ID_SHOW_EMPTY_LABEL, createShowEmptyLabel());
showEmptyLabel.setOutputMarkupId(true);
showEmpty.add(showEmptyLabel);
initAttributesLayout(constructionContainer);
Component metadataPanel;
if (UserDtoStatus.ADD.equals(getModel().getObject().getStatus()) || getModelObject().getOldValue().asContainerable() == null) {
metadataPanel = new WebMarkupContainer(ID_METADATA_CONTAINER);
} else {
metadataPanel = new MetadataPanel(ID_METADATA_CONTAINER, new AbstractReadOnlyModel<MetadataType>() {
@Override
public MetadataType getObject() {
return getModelObject().getOldValue().getValue().getMetadata();
}
}, "", "row");
}
metadataPanel.setOutputMarkupId(true);
metadataPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !UserDtoStatus.ADD.equals(getModel().getObject().getStatus());
}
});
body.add(metadataPanel);
addAjaxOnUpdateBehavior(body);
}
Aggregations