ソースコードを掘り下げるRadioRenderer
と、次のことに気付きました。
方法
@Override
protected void renderOption(FacesContext context,
UIComponent component,
Converter converter,
SelectItem curItem,
Object currentSelections,
Object[] submittedValues,
boolean alignVertical,
int itemNumber,
OptionComponentInfo optionInfo) throws IOException
クラスでオーバーライドされたRadioRenderer
ものは、標準の public void encodeEnd(FacesContext context, UIComponent component)
Renderer メソッドから呼び出されています。しかし、次のコードがありました。
Iterator<SelectItem> items =
RenderKitUtils.getSelectItems(context, component);
//some code
while (items.hasNext()) {
SelectItem curItem = items.next();
idx++;
// If we come across a group of options, render them as a nested
// table.
if (curItem instanceof SelectItemGroup) {
// do some
else {
// do another
}
}
だから、私は例でそれを試しました:
<h:selectOneRadio>
<f:selectItem />
<f:selectItems value="#{myBean.vals}" />
<f:selectItems value="#{myBean.valss}" />
</h:selectOneRadio>
およびes は、 のインスタンスではないと見なされましselectItem
た。それは完全に明らかですが、インスタンスにマップされると予想していました。selectItems
SelectItemGroup
selectItem
selectItems
SelectItemGroup
そのことを少し明確にしていただけませんか?