use of org.apache.wicket.markup.html.form.TextField in project midpoint by Evolveum.
the class TableConfigurationPanel method initPopoverLayout.
private void initPopoverLayout() {
WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
popover.setOutputMarkupId(true);
add(popover);
Form<?> form = new MidpointForm<>(ID_FORM);
popover.add(form);
AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {
@Override
protected void onError(AjaxRequestTarget target) {
target.add(TableConfigurationPanel.this.get(createComponentPath(ID_POPOVER, ID_FORM, "inputFeedback")));
}
@Override
protected void onSubmit(AjaxRequestTarget target) {
pageSizeChanged(target);
}
};
form.add(button);
TextField<?> input = new TextField<>(ID_INPUT, createInputModel());
input.add(new RangeValidator<>(5, 100));
input.setLabel(createStringResource("PageSizePopover.title"));
input.add(new SearchFormEnterBehavior(button));
input.setType(Integer.class);
input.setOutputMarkupId(true);
FeedbackPanel feedback = new FeedbackPanel("inputFeedback", new ComponentFeedbackMessageFilter(input));
feedback.setOutputMarkupId(true);
form.add(feedback);
form.add(input);
}
use of org.apache.wicket.markup.html.form.TextField in project midpoint by Evolveum.
the class MultiValueTextFormGroup method initLayout.
private void initLayout(final IModel<String> label, final String labelSize, final String textSize, final boolean required) {
Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.add(AttributeAppender.prepend("class", new IModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(textSize)) {
sb.append(textSize).append(' ');
}
if (item.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
sb.append(getOffsetClass()).append(' ');
sb.append(CLASS_MULTI_VALUE);
}
return sb.toString();
}
}));
item.add(textWrapper);
TextField<?> text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
text.setRequired(required);
text.add(AttributeAppender.replace("placeholder", label));
text.setLabel(label);
textWrapper.add(text);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
textWrapper.add(feedback);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
buttonGroup.add(AttributeAppender.append("class", new IModel<String>() {
@Override
public String getObject() {
if (item.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
return CLASS_MULTI_VALUE;
}
return null;
}
}));
item.add(buttonGroup);
initButtons(buttonGroup, item);
}
};
add(repeater);
}
use of org.apache.wicket.markup.html.form.TextField in project midpoint by Evolveum.
the class ValueChoosePanel method initLayer.
private void initLayer() {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.setOutputMarkupId(true);
IModel<String> textModel = createTextModel();
TextField<String> text = new TextField<>(ID_TEXT, textModel);
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
}
});
text.add(AttributeAppender.append("title", textModel));
text.setRequired(isRequired());
text.setEnabled(true);
textWrapper.add(text);
FeedbackAlerts feedback = new FeedbackAlerts(ID_FEEDBACK);
feedback.setFilter(new ComponentFeedbackMessageFilter(text));
textWrapper.add(feedback);
AjaxLink<String> edit = new AjaxLink<String>(ID_EDIT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editValuePerformed(target);
}
};
edit.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return isEditButtonEnabled();
}
});
textWrapper.add(edit);
add(textWrapper);
initButtons();
}
use of org.apache.wicket.markup.html.form.TextField in project midpoint by Evolveum.
the class GenericMultiValueLabelEditPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
Label l = new Label(ID_LABEL, label);
l.setVisible(getLabelVisibility());
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
WebMarkupContainer addFirstContainer = new WebMarkupContainer(ID_ADD_FIRST_CONTAINER);
addFirstContainer.setOutputMarkupId(true);
addFirstContainer.setOutputMarkupPlaceholderTag(true);
addFirstContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getModelObject().isEmpty();
}
});
add(addFirstContainer);
AjaxLink<Void> addFirst = new AjaxLink<Void>(ID_ADD_FIRST) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addFirstPerformed(target);
}
};
addFirstContainer.add(addFirst);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<T> listItem) {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.add(AttributeAppender.prepend("class", new IModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(textSize)) {
sb.append(textSize).append(' ');
}
if (listItem.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
sb.append(getOffsetClass()).append(' ');
sb.append(CLASS_MULTI_VALUE);
}
return sb.toString();
}
}));
listItem.add(textWrapper);
TextField text = new TextField<>(ID_TEXT, createTextModel(listItem.getModel()));
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
}
});
text.setEnabled(false);
text.add(AttributeAppender.replace("placeholder", label));
text.setLabel(label);
textWrapper.add(text);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
textWrapper.add(feedback);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
buttonGroup.add(AttributeAppender.append("class", new IModel<String>() {
@Override
public String getObject() {
if (listItem.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
return CLASS_MULTI_VALUE;
}
return null;
}
}));
AjaxLink<Void> edit = new AjaxLink<Void>(ID_EDIT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editValuePerformed(target, listItem.getModel());
}
};
edit.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return GenericMultiValueLabelEditPanel.this.isEditButtonEnabled();
}
});
textWrapper.add(edit);
listItem.add(buttonGroup);
initButtons(buttonGroup, listItem);
}
};
add(repeater);
}
use of org.apache.wicket.markup.html.form.TextField in project midpoint by Evolveum.
the class DefinitionStagePanel method initLayout.
protected void initLayout(PageBase pageBase) {
TextField nameField = new TextField<>(ID_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_NAME));
add(nameField);
TextArea descriptionField = new TextArea<>(ID_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DESCRIPTION));
add(descriptionField);
TextField durationField = new TextField<>(ID_DURATION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DURATION));
add(durationField);
add(WebComponentUtil.createHelp(ID_STAGE_DURATION_HELP));
TextField notifyBeforeDeadlineField = new TextField<>(ID_NOTIFY_BEFORE_DEADLINE, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_BEFORE_DEADLINE));
add(notifyBeforeDeadlineField);
add(WebComponentUtil.createHelp(ID_NOTIFY_BEFORE_DEADLINE_HELP));
add(new CheckBox(ID_NOTIFY_ONLY_WHEN_NO_DECISION, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_ONLY_WHEN_NO_DECISION)));
add(WebComponentUtil.createHelp(ID_NOTIFY_WHEN_NO_DECISION_HELP));
TextField reviewerNameField = new TextField<>(ID_REVIEWER_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_NAME));
add(reviewerNameField);
TextArea reviewerDescriptionField = new TextArea<>(ID_REVIEWER_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DESCRIPTION));
add(reviewerDescriptionField);
add(new CheckBox(ID_USE_TARGET_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_OWNER)));
add(new CheckBox(ID_USE_TARGET_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_APPROVER)));
add(WebComponentUtil.createHelp(ID_TARGET_HELP));
add(new CheckBox(ID_USE_OBJECT_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_OWNER)));
add(new CheckBox(ID_USE_OBJECT_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_APPROVER)));
add(WebComponentUtil.createHelp(ID_OBJECT_HELP));
AjaxCheckBox useObjectManagerCheckbox = new AjaxCheckBox(ID_USE_OBJECT_MANAGER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER_PRESENT)) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(DefinitionStagePanel.this.get(ID_USE_OBJECT_MANAGER_DETAILS));
}
};
add(useObjectManagerCheckbox);
WebMarkupContainer useObjectManagerDetails = new WebMarkupContainer(ID_USE_OBJECT_MANAGER_DETAILS);
useObjectManagerDetails.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return useObjectManagerCheckbox.getModelObject();
}
});
useObjectManagerDetails.setOutputMarkupId(true);
add(useObjectManagerDetails);
add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_HELP));
TextField orgTypeField = new TextField<>(ID_USE_OBJECT_MANAGER_ORG_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ORG_TYPE));
orgTypeField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
useObjectManagerDetails.add(orgTypeField);
useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ORG_TYPE_HELP));
CheckBox allowSelf = new CheckBox(ID_USE_OBJECT_MANAGER_ALLOW_SELF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ALLOW_SELF));
allowSelf.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
useObjectManagerDetails.add(allowSelf);
useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ALLOW_SELF_HELP));
try {
ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(iw -> ItemVisibility.AUTO);
Panel defaultOwnerRefPanel = pageBase.initItemPanel(ID_DEFAULT_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DEFAULT_REVIEWERS), builder.build());
add(defaultOwnerRefPanel);
add(WebComponentUtil.createHelp(ID_DEFAULT_REVIEWER_REF_HELP));
Panel additionalOwnerRefPanel = pageBase.initItemPanel(ID_ADDITIONAL_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_ADDITIONAL_REVIEWERS), builder.build());
add(additionalOwnerRefPanel);
add(WebComponentUtil.createHelp(ID_ADDITIONAL_REVIEWER_REF_HELP));
} catch (SchemaException e) {
}
DropDownChoice outcomeStrategy1 = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
add(outcomeStrategy1);
add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
DropDownChoice<AccessCertificationResponseType> outcomeIfNoReviewers = new DropDownChoice<>(ID_OUTCOME_IF_NO_REVIEWERS, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_IF_NO_REVIEWERS), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationResponseType.class), new EnumChoiceRenderer<>(this));
add(outcomeIfNoReviewers);
add(WebComponentUtil.createHelp(ID_OUTCOME_IF_NO_REVIEWERS_HELP));
Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new IModel<String>() {
@Override
public String getObject() {
List<AccessCertificationResponseType> stopOn = getModelObject().getStopReviewOn();
return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
}
});
add(stopReviewOn);
add(WebComponentUtil.createHelp(ID_STOP_REVIEW_ON_HELP));
}
Aggregations