}
});
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
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(searchFormContainer);
}
};
addOrButton.setDefaultFormProcessing(false);
if (item.getIndex() != getModelObject().size() - 1) {
addOrButton.setVisible(false);
}
item.add(addOrButton);
AjaxButton dropButton = new IndicatingAjaxButton("dropButton", new ResourceModel("dropButton")) {
private static final long serialVersionUID = -4804368561204623354L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
getList().remove(Integer.valueOf(getParent().getId()).intValue());
target.add(searchFormContainer);
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(searchFormContainer);
}
};
dropButton.setDefaultFormProcessing(false);
if (item.getIndex() == 0) {
dropButton.setVisible(false);
}
item.add(dropButton);
if (searchCondition == null || searchCondition.getFilterType() == null) {
filterNameChooser.setChoices(Collections.<String>emptyList());