@Override
public void encodeBegin(FacesContext context)
throws IOException
{
// add label and input components when the view is loaded for the first time
UIInput inputComponent = null;
TextResolver textResolver = FacesUtils.getTextResolver(context);
if (getChildCount() > 0)
{
inputComponent = getInputComponent();
if (inputComponent instanceof HtmlSelectOneMenu)
{
SelectInputControl control = (SelectInputControl)InputControlManager.getControl(SelectInputControl.NAME);
// disabled
boolean disabled = isDisabled();
((HtmlSelectOneMenu)inputComponent).setDisabled(disabled);
// Options (sync)
Options options = getOptionList();
boolean hasEmpty = isAllowNull() && !options.contains("");
control.syncOptions((HtmlSelectOneMenu)inputComponent, textResolver, options, hasEmpty, getNullText());
setInputValue((HtmlSelectOneMenu)inputComponent);
}
else
{ // Something's wrong here?
log.warn("WARN: Unexpected child node for {}! Child item type is {}.", getClass().getName(), inputComponent.getClass().getName());
inputComponent = null;
}
}
if (inputComponent == null)
{
inputComponent = createSelectOneMenu(textResolver);
this.getChildren().add(0, inputComponent);
}
// render components
inputComponent.encodeAll(context);
// default
super.encodeBegin(context);
}