protected ApplicationDialog createSelectionDialog() {
EventList eventList = createEventList(selectableItemsHolder);
final ValueModel2EventListBridge itemRefresher = new ValueModel2EventListBridge(selectableItemsHolder,
eventList, true);
ListSelectionDialog selectionDialog = null;
if (filtered) {
FilterListSelectionDialog filterDialog = new FilterListSelectionDialog("", null, new FilterList(eventList));
if (filterProperties == null) {
filterDialog.setFilterator(new StringTextFilterator());
} else {
filterDialog.setFilterator(new BeanTextFilterator(filterProperties));
}
selectionDialog = filterDialog;
} else {
selectionDialog = new ListSelectionDialog("", null, eventList);
}
selectionDialog.setOnAboutToShow(new Block() {
protected void handle(Object ignore) {
itemRefresher.synchronize();
}
});
selectionDialog.setOnSelectAction(new Closure() {
public Object call(Object argument) {
controlValueChanged(argument);
selectField.setValue(argument);
return argument;
}
});
selectionDialog.setRenderer(getRendererForSelectionDialog());
if (StringUtils.hasText(descriptionKey)) {
String description = getMessage(descriptionKey);
selectionDialog.setDescription(description);
}
if (StringUtils.hasText(titleKey)) {
String title = getMessage(titleKey);
selectionDialog.setTitle(title);
}
return selectionDialog;
}