* @param needNullSelectOption
* @return filtered list of options (may be empty) or null if cannot use
* container filters
*/
protected List<?> getOptionsWithFilter(boolean needNullSelectOption) {
Container container = getContainerDataSource();
if (pageLength == 0) {
// no paging: return all items
filteredSize = container.size();
return new ArrayList<Object>(container.getItemIds());
}
if (!(container instanceof Filterable)
|| !(container instanceof Indexed)
|| getItemCaptionMode() != ITEM_CAPTION_MODE_PROPERTY) {
return null;
}
Filterable filterable = (Filterable) container;
Filter filter = buildFilter(filterstring, filteringMode);
// adding and removing filters leads to extraneous item set
// change events from the underlying container, but the ComboBox does
// not process or propagate them based on the flag filteringContainer
if (filter != null) {
filteringContainer = true;
filterable.addContainerFilter(filter);
}
Indexed indexed = (Indexed) container;
int indexToEnsureInView = -1;
// if not an option request (item list when user changes page), go
// to page with the selected item after filtering if accepted by
// filter
Object selection = getValue();
if (isScrollToSelectedItem() && !optionRequest && !isMultiSelect()
&& selection != null) {
// ensure proper page
indexToEnsureInView = indexed.indexOfId(selection);
}
filteredSize = container.size();
currentPage = adjustCurrentPage(currentPage, needNullSelectOption,
indexToEnsureInView, filteredSize);
int first = getFirstItemIndexOnCurrentPage(needNullSelectOption,
filteredSize);
int last = getLastItemIndexOnCurrentPage(needNullSelectOption,