this.searchFormContainer = searchFormContainer;
}
@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<FilterType> filterTypeChooser = new DropDownChoice<FilterType>("filterType",
new PropertyModel<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 dropButton = new ClearIndicatingAjaxButton("dropButton", new ResourceModel("dropButton"),
pageRef) {
private static final long serialVersionUID = -4804368561204623354L;
@Override
protected void onSubmitInternal(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.EMPTY_LIST);
} else {
switch (searchCondition.getFilterType()) {
case ATTRIBUTE:
final List<String> names = new ArrayList<String>(dnames.getObject());
if (unames.getObject() != null && !unames.getObject().isEmpty()) {
names.addAll(unames.getObject());