Refine search
@Override public String serialize(Object data) { return ScriptUtils.toScript(data); } }
public void appendScript(Appendable target) throws IOException { ScriptUtils.appendScript(target, wrapped); } }
/** * Utility method which finds component's jQuery selector based on component's clientId. */ public static String jQuerySelector(FacesContext facesContext, UIComponent component) { if (facesContext == null) { throw new IllegalArgumentException("facesContext can't be null"); } if (component == null) { throw new IllegalArgumentException("component can't be null"); } String clientId = component.getClientId(facesContext); return "#" + ScriptUtils.escapeCSSMetachars(ScriptUtils.escapeCSSMetachars(clientId)); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { UIScripts validatorScript = (UIScripts) component; ResponseWriter responseWriter = context.getResponseWriter(); // TODO - change behavior for AJAX requests. Collection<Object> scripts = validatorScript.getScripts(); encodeDependentResources(context, component, scripts); Collection<Object> pageReadyScripts = validatorScript.getPageReadyScripts(); if (!pageReadyScripts.isEmpty()) { encodeResource(component, context, JQUERY); encodeDependentResources(context, component, pageReadyScripts); } responseWriter.startElement(SCRIPT, null); responseWriter.writeAttribute(TYPE, TEXT_JAVASCRIPT, null); for (Object script : scripts) { ScriptUtils.writeToStream(responseWriter, script); responseWriter.writeText("\n", null); } if (!pageReadyScripts.isEmpty()) { responseWriter.writeText("RichFaces.jQuery(document).ready(function() {\n", null); for (Object script : pageReadyScripts) { ScriptUtils.writeToStream(responseWriter, script); responseWriter.writeText("\n", null); } responseWriter.writeText("});\n", null); } responseWriter.endElement(SCRIPT); } }
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException { writer.startElement(HtmlConstants.TABLE_ELEMENT, component); String clientId = component.getClientId(context); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":r", null); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-rord rf-edt-tbl", null); writer.startElement(HtmlConstants.TR_ELEMENT, component); writer.startElement(HtmlConstants.TH_ELEM, component); .append(ajaxFunction.toScript()).append(";}"); if (!options.isEmpty()) { builder.append(",").append(ScriptUtils.toScript(options));
writer.endUpdate(); writer.startEval(); writer.write("jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(clientId)) + ").triggerHandler('rich:onajaxcomplete', {first: " + table.getClientFirst() + "});"); writer.endEval(); writer.startEval(); writer.write("jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(table.getClientId(context))) + ").triggerHandler('rich:onajaxcomplete', {reinitializeHeader: true});"); writer.endEval(); writer.endUpdate(); writer.startEval(); writer.write("jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(clientId)) + ").triggerHandler('rich:onajaxcomplete', {first: " + table.getClientFirst() + ", rowCount: " + getRowCount(component) + ", reinitializeBody: true});");
ret.append(','); ret.append(toScript(element)); first = false; ret.append(','); ret.append(toScript(element)); first = false; addEncodedString(ret, entry.getKey()); ret.append(":"); ret.append(toScript(entry.getValue())); first = false; addEncodedString(ret, obj); return ret.toString(); ret.append(','); addEncodedString(ret, key); ret.append(":"); ret.append(toScript(PropertyUtils.getProperty(obj, key))); first = false;
appendScript(appendable, element, cycleBusterMap); first = false; appendScript(appendable, element, cycleBusterMap); first = false; appendEncodedString(appendable, entry.getKey()); appendable.append(":"); appendScript(appendable, entry.getValue(), cycleBusterMap); first = false; appendEncodedString(appendable, obj); } else if (obj instanceof Character) { appendEncodedString(appendable, obj); } else if (obj instanceof Enum<?>) { appendEncodedString(appendable, obj); } else { appendEncodedString(appendable, key); appendable.append(":"); appendScript(appendable, propertyValue, cycleBusterMap); first = false;
String name = ScriptUtils.getValidJavascriptName(validatorScript.toScript()); validatorScript.setName(name); return validatorScript;
ResponseWriter writer = context.getResponseWriter(); writer.startElement(HtmlConstants.SCRIPT_ELEM, component); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context), null); writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.JAVASCRIPT_TYPE, null); writer.writeText(FUNCTION_NAME, null); ScriptUtils.writeToStream(writer, queueName); writer.writeText(":", null); ScriptUtils.writeToStream(writer, queueOptionsMap);
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException { writer.startElement(HtmlConstants.TABLE_ELEMENT, component); String clientId = component.getClientId(context); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":r", null); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-rord rf-edt-tbl", null); writer.startElement(HtmlConstants.TR_ELEMENT, component); writer.startElement(HtmlConstants.TH_ELEM, component); .append(ajaxFunction.toScript()).append(";}"); if (!options.isEmpty()) { builder.append(",").append(ScriptUtils.toScript(options));
writer.endUpdate(); writer.startEval(); writer.write("RichFaces.jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(clientId)) + ").triggerHandler('rich:onajaxcomplete', {first: " + table.getClientFirst() + "});"); writer.endEval(); writer.startEval(); writer.write("RichFaces.jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(table.getClientId(context))) + ").triggerHandler('rich:onajaxcomplete', {reinitializeHeader: true});"); writer.endEval(); writer.endUpdate(); writer.startEval(); writer.write("RichFaces.jQuery(" + ScriptUtils.toScript('#' + ScriptUtils.escapeCSSMetachars(clientId)) + ").triggerHandler('rich:onajaxcomplete', {first: " + table.getClientFirst() + ", rowCount: " + getRowCount(component) + ", reinitializeBody: true});");
ScriptUtils.addEncodedString(result, name); result.append(": "); result.append(ScriptUtils.toScript(escape ? value : new JSReference(value.toString())));
String name = ScriptUtils.getValidJavascriptName(validatorScript.toScript()); validatorScript.setName(name); return validatorScript;
ResponseWriter writer = context.getResponseWriter(); writer.startElement(HtmlConstants.SCRIPT_ELEM, component); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context), null); writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.JAVASCRIPT_TYPE, null); writer.writeText(FUNCTION_NAME, null); ScriptUtils.writeToStream(writer, queueName); writer.writeText(":", null); ScriptUtils.writeToStream(writer, queueOptionsMap);
public String asString(Object data) { return ScriptUtils.toScript(data); } }
public void appendScript(Appendable target) throws IOException { ScriptUtils.appendScript(target, options); }
/** * Utility method which finds component's jQuery selector based on component's clientId. */ public static String jQuerySelector(FacesContext facesContext, UIComponent component) { if (facesContext == null) { throw new IllegalArgumentException("facesContext can't be null"); } if (component == null) { throw new IllegalArgumentException("component can't be null"); } String clientId = component.getClientId(facesContext); return "#" + ScriptUtils.escapeCSSMetachars(ScriptUtils.escapeCSSMetachars(clientId)); }
ResponseWriter writer = context.getResponseWriter(); writer.startElement(HtmlConstants.SCRIPT_ELEM, component); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context), null); writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.JAVASCRIPT_TYPE, null); writer.writeText(FUNCTION_NAME, null); ScriptUtils.writeToStream(writer, queueName); writer.writeText(":", null); ScriptUtils.writeToStream(writer, queueOptionsMap);