}
});
searchItems.setFields(nameField, removeField);
updateDisplay();
HLayout addBar = new HLayout(0);
addBar.setAlign(Alignment.LEFT);
addBar.setHeight(20);
Img addImg = new Img(ADD_IMAGE, 16, 16);
addImg.setTooltip(messages.combinedSearchWidgetAdd());
DynamicForm searchForm = new DynamicForm();
selectSearch = new SelectItem();
selectSearch.setTitle(addImg.getInnerHTML());
selectSearch.setWidth(200);
selectSearch.setTooltip(messages.combinedSearchWidgetSelectSearch());
selectSearch.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
if (event.getValue() != null) {
final SearchWidget sw = getSearchWidget((String) event.getValue());
sw.showForSave(new SaveRequestHandler() {
public void onSaveRequested(SaveRequestEvent event) {
searchItems.addData(new SearchListRecord(sw.getName(), event.getCriterion()));
updateDisplay();
}
});
}
event.cancel();
}
});
searchForm.setFields(selectSearch);
addBar.addMember(searchForm);
wrapper.setOverflow(Overflow.AUTO);
wrapper.addMember(searchItems);
wrapper.addMember(addBar);
layout.addMember(wrapper);