Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSReference


      if (child instanceof UIParameter) {
        UIParameter parameter = ((UIParameter) child);
        String name = parameter.getName();
        func.addParameter(name);
        // Put parameter name to AJAX.Submit parameter, with default value.
        JSReference reference = new JSReference(name);
        if (null != parameter.getValue()) {
          reference = new JSReference(name + "||"
              + ScriptUtils.toScript(parameters.get(name)));

        }
        // Replace parameter value to reference.
        parameters.put(name, reference);
View Full Code Here


  public static JSFunction buildAjaxFunction(UIComponent uiComponent,
      FacesContext facesContext) {
    JSFunction ajaxFunction = buildAjaxFunction(uiComponent, facesContext,
        AJAX_FUNCTION_NAME);
    // client-side script must have reference to event-enabled object.
    ajaxFunction.addParameter(new JSReference("event"));
    return ajaxFunction;
  }
View Full Code Here

          escape = !actionParam.isNoEscape();
        }
        if (escape) {
          parameters.put(name, value);
        } else {
          parameters.put(name, new JSReference(value.toString()));
          // if(it.hasNext()){onEvent.append(',');};
          // renderAjaxLinkParameter( name,
          // value, onClick, jsForm, nestingForm);
        }
      }
View Full Code Here

  public String getActionScript(FacesContext context, UIComponent component) throws IOException {
    String clientId = component.getClientId(context);
    JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, context);

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(FileUploadConstants.FILE_UPLOAD_ACTION, new JSReference("action"));
    parameters.put(FileUploadConstants.UPLOAD_FILES_ID, new JSReference("uid"));
    parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
   
    Map options = AjaxRendererUtils.buildEventOptions(context, component, parameters, true);
    options.put("onbeforedomupdate", new JSReference("callback"));
   
    ajaxFunction.addParameter(options);

    JSFunctionDefinition function = new JSFunctionDefinition("uid", "action", "callback");
    function.addParameter("event");
View Full Code Here

       
        JSFunction function = new JSFunction("new RichFaces.SortControl");
       
        function.addParameter(control.getClientId(context));
        function.addParameter(table.getClientId(context));
        function.addParameter(sortBy == null ? JSReference.NULL: new JSReference(sortBy));
        function.addParameter(control.getParent().getClientId(context));
        writeScript(context, control, function);
      }
    };
    commands[SERVER.ordinal()] = new RendererCommand() {
View Full Code Here

    Map options = AjaxRendererUtils.buildEventOptions(facesContext, uiComponent);
    onEvent.append("var options=").append(ScriptUtils.toScript(options)).append(";");
    onEvent.append("if(this.posReferenceId) { options.parameters.posReferenceId=this.posReferenceId;this.posReferenceId=null; }");

    JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(uiComponent, facesContext);
    ajaxFunction.addParameter(new JSReference("options"));

    // appendAjaxSubmitParameters(facesContext, uiComponent, onEvent);
    onEvent.append("try {");
    ajaxFunction.appendScript(onEvent);
    onEvent.append("} catch (e) {alert('Error in onclick: ' + e.message);}");
View Full Code Here

          if(value == null) {
            value = "";
          }
          parameters.put(name, value);
        } else {
          parameters.put(name, new JSReference(value.toString()));
          // if(it.hasNext()){onEvent.append(',');};
          // renderAjaxLinkParameter( name,
          // value, onClick, jsForm, nestingForm);
        }
      }
View Full Code Here

  public static JSFunction buildAjaxFunction(UIComponent uiComponent,
      FacesContext facesContext) {
    JSFunction ajaxFunction = buildAjaxFunction(uiComponent, facesContext,
        AJAX_FUNCTION_NAME);
    // client-side script must have reference to event-enabled object.
    ajaxFunction.addParameter(new JSReference("event"));
    return ajaxFunction;
  }
View Full Code Here

    public void encodeToHead(FacesContext facesContext, UIComponent component)
        throws IOException {
      JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
      Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component, true);
      options.put("requestDelay", new JSReference("options.requestDelay"));
      options.put("similarityGroupingId", new JSReference("options.similarityGroupingId || '" +
          component.getClientId(facesContext) + "'"));
      options.put("data", new JSReference("data"));
      options.put("requestTime", new JSReference("options.requestTime"));
      options.put("timeout", new JSReference("options.timeout"));
      options.put("eventsQueue", new JSReference("options.eventsQueue"));
      options.put("implicitEventsQueue", new JSReference("options.implicitEventsQueue"));
      options.put("ignoreDupResponses", new JSReference("options.ignoreDupResponses"));
     
      ajaxFunction.addParameter(options);
     
      ResponseWriter responseWriter = facesContext.getResponseWriter();
      responseWriter.startElement(HTML.SCRIPT_ELEM, component);
View Full Code Here

          if(value == null) {
            value = "";
          }
          parameters.put(name, value);
        } else {
          parameters.put(name, new JSReference(value.toString()));
          // if(it.hasNext()){onEvent.append(',');};
          // renderAjaxLinkParameter( name,
          // value, onClick, jsForm, nestingForm);
        }
      }
View Full Code Here

TOP

Related Classes of org.ajax4jsf.javascript.JSReference

Copyright © 2018 www.massapicom. 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.