Examples of JSFunctionDefinition


Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    if (oncomplete != null) {
      options.put("onbeforedomupdate", oncomplete);
    }
    ajaxFunction.addParameter(options);

    JSFunctionDefinition function = new JSFunctionDefinition("uid");
    function.addParameter("formId");
    function.addParameter("event");
    function.addToBody(ajaxFunction.toScript());

    return function.toScript();
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

   * @return
   * @throws IOException
   */
  public String getStopScript(FacesContext context, UIComponent component)
      throws IOException {
    JSFunctionDefinition oncomplete = new JSFunctionDefinition();
    oncomplete.addParameter("request");
    oncomplete.addParameter("event");
    oncomplete.addParameter("data");
    StringBuffer body = new StringBuffer("$('");
    body.append(component.getClientId(context));
    body.append("').component.cancelUpload(data);");
    oncomplete.addToBody(body);
    return getActionScript(context, component, FileUploadConstants.FILE_UPLOAD_ACTION_STOP, oncomplete);
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

   * @return
   * @throws IOException
   */
  public String getFileSizeScript(FacesContext context, UIComponent component)
      throws IOException {
    JSFunctionDefinition oncomplete = new JSFunctionDefinition();
    oncomplete.addParameter("request");
    oncomplete.addParameter("event");
    oncomplete.addParameter("data");
    StringBuffer body = new StringBuffer("$('");
    body.append(component.getClientId(context));
    body.append("').component.getFileSize(data);");
    oncomplete.addToBody(body);
    return getActionScript(context, component, FileUploadConstants.FILE_UPLOAD_ACTION_PROGRESS, oncomplete);

  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

  public String getScriptContribution(FacesContext context, UIComponent component) {
    StringBuffer result = new StringBuffer();

    result.append(".drop = ");

    JSFunctionDefinition definition = new JSFunctionDefinition();
    definition.addParameter("event");
    definition.addParameter("drag");

    Map requestOpts = AjaxRendererUtils.buildEventOptions(context, component);
    definition.addToBody("var options = ").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
    definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
    //TODO nick - remove as legacy
    definition.addToBody("Object.extend(options.parameters, drag.getParameters());");
    definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
   
    JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
    dropFunction.addParameter(new JSReference("options"));
   
    definition.addToBody(dropFunction.toScript()).addToBody(";");
    definition.appendScript(result);
    result.append(";");

    return result.toString();
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    public String getItemsTextAsJSArray(FacesContext context, UIComponent component, List items) {
      return ScriptUtils.toScript(items);
    }

    public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
  JSFunctionDefinition script = getUtils().getAsEventHandler(context, component, attributeName, null)
  return ScriptUtils.toScript(script);
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

   
    Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, calendar, params);
    options.put("calendar", JSReference.THIS);

    String oncomplete = AjaxRendererUtils.getAjaxOncomplete(calendar);
    JSFunctionDefinition oncompleteDefinition = new JSFunctionDefinition();
    oncompleteDefinition.addParameter("request");
    oncompleteDefinition.addParameter("event");
    oncompleteDefinition.addParameter("data");
    oncompleteDefinition.addToBody("this.calendar.load(data, true);");
    if (oncomplete != null) {
      oncompleteDefinition.addToBody(oncomplete);
    }

    options.put("oncomplete", oncompleteDefinition);
    JSReference requestValue = new JSReference("requestValue");
    ajaxFunction.addParameter(options);
    JSFunctionDefinition definition = new JSFunctionDefinition();
    definition.addParameter(requestValue);
    definition.addToBody(ajaxFunction);
    writer.write(definition.toScript());
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

      UIComponent component, String eventName) throws IOException {

    ResponseWriter writer = context.getResponseWriter();
    Object script = component.getAttributes().get(eventName);
    if (script != null && !script.equals("")) {
      JSFunctionDefinition onEventDefinition = new JSFunctionDefinition();
      onEventDefinition.addParameter("event");
      onEventDefinition.addToBody(script);
      writer.writeText(",\n" + eventName + ": "
          + onEventDefinition.toScript(), null);
    }
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

     
      event = event.trim();
   
      if (event.length() != 0) {
       
          JSFunctionDefinition function = new JSFunctionDefinition();
        function.addParameter("event");
        function.addToBody(event);
       
        result = function;
        }
     
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    if (event != null) {
      event = event.trim();

      if (event.length() != 0) {
        JSFunctionDefinition function = new JSFunctionDefinition();
        function.addParameter("event");
        function.addToBody(event);

        result = function;
      }
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

            }
        }
    }
   
    private JSFunctionDefinition buildSetFocusFunctionDef(String elementId){
      JSFunctionDefinition function = new JSFunctionDefinition("request","event","data");
    function.addToBody(
        "var element = request.form.elements['" + elementId + "'];" +
        "if (!element) {element = document.getElementById('" + elementId + "')}" +
        "if (element) {" +
          "element.focus();" +
          //"if (element.createTextRange) { var r = (element.createTextRange());  r.collapse(false); r.select();}" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.