this.entitlements = entitlements;
}
@Override
protected void populateItem(final ListItem<SearchCondWrapper> item) {
final SearchCondWrapper searchCondition = item.getModelObject();
if (item.getIndex() == 0) {
item.add(new Label("operationType", ""));
} else {
item.add(new Label("operationType", searchCondition.getOperationType().toString()));
}
final CheckBox notOperator = new CheckBox("notOperator", new PropertyModel(searchCondition, "notOperator"));
notOperator.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
}
});
item.add(notOperator);
final DropDownChoice<AttributeCond.Type> type = new DropDownChoice<AttributeCond.Type>("type",
new PropertyModel<AttributeCond.Type>(searchCondition, "type"), attributeTypes);
type.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
}
});
item.add(type);
final DropDownChoice<String> filterNameChooser = new DropDownChoice<String>("filterName",
new PropertyModel<String>(searchCondition, "filterName"), (IModel) null);
filterNameChooser.setOutputMarkupId(true);
filterNameChooser.setRequired(required);
filterNameChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
}
});
item.add(filterNameChooser);
final TextField<String> filterValue = new TextField<String>("filterValue", new PropertyModel<String>(
searchCondition, "filterValue"));
filterValue.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
}
});
item.add(filterValue);
final DropDownChoice<SearchCondWrapper.FilterType> filterTypeChooser =
new DropDownChoice<SearchCondWrapper.FilterType>("filterType",
new PropertyModel<SearchCondWrapper.FilterType>(searchCondition, "filterType"), filterTypes);
filterTypeChooser.setOutputMarkupId(true);
filterTypeChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
target.add(searchFormContainer);
}
});
filterTypeChooser.setRequired(required);
item.add(filterTypeChooser);
AjaxButton addAndButton = new IndicatingAjaxButton("addAndButton", new ResourceModel("addAndButton")) {
private static final long serialVersionUID = -4804368561204623354L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
SearchCondWrapper conditionWrapper = new SearchCondWrapper();
conditionWrapper.setOperationType(SearchCondWrapper.OperationType.AND);
SearchView.this.getModelObject().add(conditionWrapper);
target.add(searchFormContainer);
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(searchFormContainer);
}
};
addAndButton.setDefaultFormProcessing(false);
if (item.getIndex() != getModelObject().size() - 1) {
addAndButton.setVisible(false);
}
item.add(addAndButton);
AjaxButton addOrButton = new IndicatingAjaxButton("addOrButton", new ResourceModel("addOrButton")) {
private static final long serialVersionUID = -4804368561204623354L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
SearchCondWrapper conditionWrapper = new SearchCondWrapper();
conditionWrapper.setOperationType(SearchCondWrapper.OperationType.OR);
SearchView.this.getModelObject().add(conditionWrapper);
target.add(searchFormContainer);
}
@Override