renderInitScript(facesContext, checkbox, imagesObj, stylesObj, onchangeFunction, triStateAllowed);
}
@Override
public void decode(FacesContext context, UIComponent component) {
SelectBooleanCheckbox checkbox = (SelectBooleanCheckbox) component;
if (checkbox.isDisabled())
return;
Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
String clientId = checkbox.getClientId(context);
boolean triStateAllowed = checkbox.isTriStateAllowed();
if (isRenderedWithImage(checkbox, triStateAllowed)) {
clientId += STATE_SUFFIX;
}
BooleanObjectValue submittedValue;
if (requestMap.containsKey(clientId)) {
String requestValue = requestMap.get(clientId);
if (requestValue.equalsIgnoreCase(SELECTED_STATE) ||
requestValue.equalsIgnoreCase("yes") ||
requestValue.equalsIgnoreCase("on") ||
requestValue.equalsIgnoreCase("true")) {
submittedValue = BooleanObjectValue.TRUE;
} else if (triStateAllowed &&
(requestValue.equalsIgnoreCase(UNDEFINED_STATE) || requestValue.equalsIgnoreCase("null"))) {
submittedValue = BooleanObjectValue.NULL; // normal null means no value submitted
} else {
submittedValue = BooleanObjectValue.FALSE;
}
} else {
submittedValue = (triStateAllowed ? BooleanObjectValue.NULL : BooleanObjectValue.FALSE);
}
checkbox.setSubmittedValue(submittedValue);
}