public void appendToResponse(WOResponse res, WOContext ctx) {
super.appendToResponse(res, ctx);
_trackerId = safeElementID() + "_tracker";
_handleId = safeElementID() + "_handle";
NSMutableDictionary options = new NSMutableDictionary();
new AjaxOption("axis", "orientation", null, AjaxOption.STRING).addToDictionary(this, options);
new AjaxOption("sliderValue", "value", null, AjaxOption.NUMBER).addToDictionary(this, options);
new AjaxOption("values", "possibleValues", null, AjaxOption.ARRAY).addToDictionary(this, options);
new AjaxOption("alignX", AjaxOption.NUMBER).addToDictionary(this, options);
new AjaxOption("alignY", AjaxOption.NUMBER).addToDictionary(this, options);
new AjaxOption("disabled", AjaxOption.BOOLEAN).addToDictionary(this, options);
new AjaxOption("handleImage", AjaxOption.STRING).addToDictionary(this, options);
new AjaxOption("handleDisabled", AjaxOption.STRING).addToDictionary(this, options);
new AjaxOption("increment", AjaxOption.NUMBER).addToDictionary(this, options);
new AjaxOption("restricted", AjaxOption.BOOLEAN).addToDictionary(this, options);
new AjaxOption("step", AjaxOption.NUMBER).addToDictionary(this, options);
if(hasBinding("onChangeServer")) {
String parent = (String) valueForBinding("onChange");
options.setObjectForKey("function(v) {new Ajax.Request('"+ AjaxUtils.ajaxComponentActionUrl(context())
+"', {parameters: '"+context().elementID()+"=' + v + '&ajaxSlideTrigger=onChange'})"
+(parent != null ? "; var parentFunction = " + parent + "; parentFunction(v);" : "")
+"}", "onChange");
} else {
new AjaxOption("onChange", AjaxOption.SCRIPT).addToDictionary(this, options);
}
if(hasBinding("onSlideServer")) {
String parent = (String) valueForBinding("onSlide");
options.setObjectForKey("function(v) {new Ajax.Request('"+ AjaxUtils.ajaxComponentActionUrl(context())
+"', {parameters: '"+context().elementID()+"=' + v + '&ajaxSlideTrigger=onSlide'})"
+(parent != null ? "; var parentFunction = " + parent + "; parentFunction(v);" : "")
+"}", "onSlide");
} else {
new AjaxOption("onSlide", AjaxOption.SCRIPT).addToDictionary(this, options);
}
Number min = (Number)valueForBinding("minimum", Integer.valueOf(0));
Number max = (Number)valueForBinding("maximum", Integer.valueOf(100));
options.setObjectForKey("$R(" + min + "," + max + ")", "range");
if (min != null && max != null && ERXComponentUtilities.booleanValueForBinding(this, "snap")) {
StringBuilder valuesBuffer = new StringBuilder();
valuesBuffer.append('[');
for (int i = min.intValue(); i <= max.intValue(); i ++ ) {
valuesBuffer.append(i);
if (i < max.intValue()) {
valuesBuffer.append(',');
}
}
valuesBuffer.append(']');
options.setObjectForKey(valuesBuffer.toString(), "values");
}
res.appendContentString("<div class=\"tracker\" id=\""+
_trackerId+"\"><div class=\"handle\" id=\""+
_handleId+"\"></div></div>");