dennis hoersch created MYFACES-3710:
---------------------------------------
Summary: Create SelectItemsIterator only one in
UISelectOne.validateValue()
Key: MYFACES-3710
URL: https://issues.apache.org/jira/browse/MYFACES-3710
Project: MyFaces Core
Issue Type: Improvement
Affects Versions: 2.1.11
Reporter: dennis hoersch
Creating the SelectItemsIterator seams to be a bit slow when using a big
collection. (At least using the Tomahawk UISlectItems and transforming a list
of Objects to SelectItems with evaluating expressions on each item.)
UISelectMany stores the Iterator in a local collection to use that twice. I
think the same could be done in UISelectOne:
Collection<SelectItem> items = new ArrayList<SelectItem>();
for (Iterator<SelectItem> iter = new _SelectItemsIterator(this,
context); iter.hasNext();)
{
items.add(iter.next());
}
// selected value must match to one of the available options
// and if required is true it must not match an option with
noSelectionOption set to true (since 2.0)
Converter converter = getConverter();
if (_SelectItemsUtil.matchValue(context, this, value, items.iterator(),
converter))
{
if (! this.isRequired())
{
return; // Matched & Required false, so return ok.
}
if (! _SelectItemsUtil.isNoSelectionOption(context, this, value,
items.iterator(), converter))
{
return; // Matched & Required true & No-selection did NOT
match, so return ok.
}
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira