static boolean matchValue(FacesContext ctx,
UIComponent component,
Object value,
Iterator<SelectItem> items,
Converter converter) {
while (items.hasNext()) {
SelectItem item = items.next();
if (item instanceof SelectItemGroup) {
SelectItem subitems[] =
((SelectItemGroup) item).getSelectItems();
if ((subitems != null) && (subitems.length > 0)) {
if (matchValue(ctx, component, value, new ArrayIterator(subitems), converter)) {
return (true);
}
}
} else {
Object compareValue = null;
try {
compareValue = doConversion(ctx, component, item, value,
converter);
} catch (IllegalStateException ise) {
continue;
}
if (null == compareValue && null == value) {
return true;
}
if (value.equals(compareValue)) {
return (true);
}
}
}
return (false);
}
Return true if the specified value matches one of the
available options, performing a recursive search if if a javax.faces.model.SelectItemGroup instance is detected.
|