spinner.setConverter(numberConverter);
}
}
protected InitScript renderInitScript(FacesContext context, DropDownComponent dropDown) throws IOException {
Spinner spinner = (Spinner) dropDown;
if (spinner.getStep().doubleValue() <= 0) {
throw new FacesException("The 'step' attribute of <o:spinner> with id " + spinner.getClientId(context) +
" should be greater then 0, but was " + spinner.getStep());
}
String buttonStyle = (String) dropDown.getAttributes().get("buttonStyle");
String buttonClass = (String) dropDown.getAttributes().get("buttonClass");
String buttonStyleClass = Styles.getCSSClass(context, dropDown, buttonStyle, DEFAULT_BUTTON_CLASS, buttonClass);
String rolloverButtonStyle = (String) dropDown.getAttributes().get("rolloverButtonStyle");
String rolloverButtonClass = (String) dropDown.getAttributes().get("rolloverButtonClass");
String buttonRolloverStyleClass = Styles.getCSSClass(context, dropDown, rolloverButtonStyle, StyleGroup.rolloverStyleGroup(), rolloverButtonClass, DEFAULT_BUTTON_ROLLOVER_CLASS);
String pressedButtonStyle = (String) dropDown.getAttributes().get("pressedButtonStyle");
String pressedButtonClass = (String) dropDown.getAttributes().get("pressedButtonClass");
String buttonPressedStyleClass = Styles.getCSSClass(context, dropDown, pressedButtonStyle, StyleGroup.rolloverStyleGroup(2), pressedButtonClass, DEFAULT_BUTTON_PRESSED_CLASS);
if (dropDown.isDisabled()) {
buttonRolloverStyleClass = "";
String disabledButtonStyle = (String) dropDown.getAttributes().get("disabledButtonStyle");
String disabledButtonClass = (String) dropDown.getAttributes().get("disabledButtonClass");
String disabledButtonStyleClass = Styles.getCSSClass(context, dropDown, disabledButtonStyle,
StyleGroup.disabledStyleGroup(), disabledButtonClass, DEFAULT_DISABLED_BUTTON_CLASS);
if (Rendering.isNullOrEmpty(disabledButtonStyle) && Rendering.isNullOrEmpty(disabledButtonClass)) {
buttonStyleClass = Styles.mergeClassNames(disabledButtonStyleClass, buttonStyleClass);
} else {
buttonStyleClass = Styles.mergeClassNames(disabledButtonStyleClass, Styles.getCSSClass(context,
dropDown, null, StyleGroup.regularStyleGroup(), null, DEFAULT_BUTTON_CLASS));
}
}
JSONObject options;
try {
options = createFormatOptions(context, spinner);
} catch (JSONException e) {
throw new FacesException(e);
}
ScriptBuilder sb = new ScriptBuilder().initScript(context, spinner, "O$.Spinner._init",
spinner.getMinValue(),
spinner.getMaxValue(),
spinner.getStep(),
spinner.isCycled(),
buttonStyleClass,
buttonRolloverStyleClass,
buttonPressedStyleClass,
spinner.isDisabled(),
spinner.isRequired(),
spinner.getOnchange(),
options);
return new InitScript(sb, new String[]{
Resources.utilJsURL(context),
getDropdownJsURL(context),