ResponseWriter writer = context.getResponseWriter();
String clientId = slider.getClientId(context);
boolean range = slider.isRange();
UIComponent output = getTarget(context, slider, slider.getDisplay());
WidgetBuilder wb = getWidgetBuilder(context);
wb.initWithDomReady("Slider", slider.resolveWidgetVar(), clientId);
if(range) {
String[] inputIds = slider.getFor().split(",");
UIComponent inputMin = getTarget(context, slider, inputIds[0].trim());
UIComponent inputMax = getTarget(context, slider, inputIds[1].trim());
String inputMinValue = ComponentUtils.getValueToRender(context, inputMin);
String inputMaxValue = ComponentUtils.getValueToRender(context, inputMax);
wb.attr("input", inputMin.getClientId(context) + "," + inputMax.getClientId(context))
.append(",values:[").append(inputMinValue).append(",").append(inputMaxValue).append("]");
}
else {
UIComponent input = getTarget(context, slider, slider.getFor());
wb.attr("value", ComponentUtils.getValueToRender(context, input))
.attr("input", input.getClientId(context));
}
wb.attr("min", slider.getMinValue())
.attr("max", slider.getMaxValue())
.attr("animate", slider.isAnimate())
.attr("step", slider.getStep())
.attr("orientation", slider.getType())
.attr("disabled", slider.isDisabled(), false)
.attr("range", range)
.attr("displayTemplate", slider.getDisplayTemplate(), null)
.callback("onSlideStart", "function(event,ui)", slider.getOnSlideStart())
.callback("onSlide", "function(event,ui)", slider.getOnSlide())
.callback("onSlideEnd", "function(event,ui)", slider.getOnSlideEnd());
if(output != null) {
wb.attr("display", output.getClientId(context));
}
encodeClientBehaviors(context, slider);
wb.finish();
}