use of com.evolveum.midpoint.web.util.SearchFormEnterBehavior in project midpoint by Evolveum.
the class PageAccounts method initSearchForm.
private void initSearchForm(Form searchForm) {
BasicSearchPanel<AccountDetailsSearchDto> basicSearch = new BasicSearchPanel<AccountDetailsSearchDto>(ID_SEARCH_BASIC) {
@Override
protected IModel<String> createSearchTextModel() {
return new PropertyModel<>(searchModel, AccountDetailsSearchDto.F_SEARCH_TEXT);
}
@Override
protected void searchPerformed(AjaxRequestTarget target) {
PageAccounts.this.searchPerformed(target);
}
@Override
protected void clearSearchPerformed(AjaxRequestTarget target) {
PageAccounts.this.clearSearchPerformed(target);
}
};
basicSearch.setOutputMarkupId(true);
searchForm.add(basicSearch);
DropDownChoice failedOperationType = new DropDownChoice<>(ID_SEARCH_FAILED_OPERATION_TYPE, new PropertyModel<FailedOperationTypeType>(searchModel, AccountDetailsSearchDto.F_FAILED_OPERATION_TYPE), WebComponentUtil.createReadonlyModelFromEnum(FailedOperationTypeType.class), new EnumChoiceRenderer<FailedOperationTypeType>(this));
failedOperationType.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
searchPerformed(target);
}
});
failedOperationType.setOutputMarkupId(true);
failedOperationType.setNullValid(true);
searchForm.add(failedOperationType);
DropDownChoice kind = new DropDownChoice<>(ID_SEARCH_KIND, new PropertyModel<ShadowKindType>(searchModel, AccountDetailsSearchDto.F_KIND), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
kind.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
searchPerformed(target);
}
});
kind.setOutputMarkupId(true);
kind.setNullValid(true);
searchForm.add(kind);
DropDownChoice intent = new DropDownChoice<>(ID_SEARCH_INTENT, new PropertyModel<String>(searchModel, AccountDetailsSearchDto.F_INTENT), createIntentChoices(), new StringChoiceRenderer(null));
intent.setNullValid(true);
intent.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
searchPerformed(target);
}
});
intent.setOutputMarkupId(true);
searchForm.add(intent);
AutoCompleteTextField<String> objectClass = new AutoCompleteTextField<String>(ID_SEARCH_OBJECT_CLASS, new PropertyModel<String>(searchModel, AccountDetailsSearchDto.F_OBJECT_CLASS)) {
@Override
protected Iterator<String> getChoices(String input) {
if (Strings.isEmpty(input)) {
List<String> emptyList = Collections.emptyList();
return emptyList.iterator();
}
AccountDetailsSearchDto dto = searchModel.getObject();
List<QName> accountObjectClassList = dto.getObjectClassList();
List<String> choices = new ArrayList<>(AUTO_COMPLETE_LIST_SIZE);
for (QName s : accountObjectClassList) {
if (s.getLocalPart().toLowerCase().startsWith(input.toLowerCase())) {
choices.add(s.getLocalPart());
if (choices.size() == AUTO_COMPLETE_LIST_SIZE) {
break;
}
}
}
return choices.iterator();
}
};
objectClass.add(AttributeModifier.replace("placeholder", createStringResource("PageAccounts.accounts.objectClass")));
objectClass.setOutputMarkupId(true);
objectClass.add(createObjectClassValidator());
objectClass.add(new SearchFormEnterBehavior(basicSearch.getSearchButton()));
searchForm.add(objectClass);
}
use of com.evolveum.midpoint.web.util.SearchFormEnterBehavior in project midpoint by Evolveum.
the class PageSizePopover method initLayout.
protected void initLayout() {
Button popButton = new Button(ID_POP_BUTTON);
popButton.setOutputMarkupId(true);
add(popButton);
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) {
super.onError(target);
target.add(getPageBase().getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target) {
super.onSubmit(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);
form.add(input);
}
use of com.evolveum.midpoint.web.util.SearchFormEnterBehavior 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 com.evolveum.midpoint.web.util.SearchFormEnterBehavior in project midpoint by Evolveum.
the class BasicSearchPanel method initLayout.
protected void initLayout() {
Label label = new Label(ID_LABEL, createTextNameModel());
add(label);
AjaxSubmitButton searchButton = new AjaxSubmitButton(ID_SEARCH, createStringResource("BasicSearchPanel.search")) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
searchPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getFeedbackPanel());
}
};
add(searchButton);
AjaxSubmitButton clearButton = new AjaxSubmitButton(ID_CLEAR_SEARCH) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
clearSearchPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getFeedbackPanel());
}
};
add(clearButton);
final TextField searchText = new TextField(ID_SEARCH_TEXT, createSearchTextModel());
searchText.add(AttributeModifier.replace("placeholder", createTextNameModel()));
searchText.add(new SearchFormEnterBehavior(searchButton));
add(searchText);
}
Aggregations