&& !ids.contains(getNullSelectionItemId())) {
// Gets the option attribute values
final Object id = getNullSelectionItemId();
final String key = itemIdMapper.key(id);
final String caption = getItemCaption(id);
final Resource icon = getItemIcon(id);
// Paints option
target.startTag("so");
if (icon != null) {
target.addAttribute("icon", icon);
}
target.addAttribute("caption", caption);
target.addAttribute("nullselection", true);
target.addAttribute("key", key);
if (isSelected(id)) {
target.addAttribute("selected", true);
selectedKeys[keyIndex++] = key;
}
target.endTag("so");
}
final Iterator i = getItemIds().iterator();
// Paints the available selection options from data source
while (i.hasNext()) {
// Gets the option attribute values
final Object id = i.next();
if (!isNullSelectionAllowed() && id != null
&& id.equals(getNullSelectionItemId())) {
// Remove item if it's the null selection item but null
// selection is not allowed
continue;
}
final String key = itemIdMapper.key(id);
final String caption = getItemCaption(id);
// add listener for each item, to cause repaint if an item changes
getCaptionChangeListener().addNotifierForItem(id);
final Resource icon = getItemIcon(id); // Paints the option
target.startTag("so");
if (icon != null) {
target.addAttribute("icon", icon);
}
target.addAttribute("caption", caption);