Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSReference


    if(eventHide.startsWith("on")){
      eventHide = eventHide.substring(2);
    }
   
    Map<JSReference, Object> eventsMap = new HashMap<JSReference, Object>();
    eventsMap.put(new JSReference("showEvent"), eventShow);
    eventsMap.put(new JSReference("hideEvent"), eventHide);
    eventsMap.put(new JSReference("delay"), new Integer(toolTip.getShowDelay()));
    eventsMap.put(new JSReference("hideDelay"), new Integer(toolTip.getHideDelay()));
   
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
    JSReference ref = new JSReference("ajaxOptions");
    function.addParameter(ref);
    String ajaxFunc = function.toScript();
       
    Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip, targetClientId);
    ajaxOptions.putAll(getParamsMap(context, toolTip));
    JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(context, component, "oncomplete", "; return true;");
    JSFunctionDefinition hideFunc = getUtils().getAsEventHandler(context, component,"onhide", "; return true;");
    JSFunctionDefinition showFunc = getUtils().getAsEventHandler(context, component,"onshow", "; return true;");
   
    Map<JSReference, Object> funcMap = new HashMap<JSReference, Object>();
    funcMap.put(new JSReference("oncomplete"), completeFunc);
    funcMap.put(new JSReference("onhide"), hideFunc);
    funcMap.put(new JSReference("onshow"), showFunc);
   
   
    ret.append("new ToolTip(" + ScriptUtils.toScript(eventsMap)).append(comma).append(ScriptUtils.toScript(funcMap))
    .append(comma).append(quot).append( toolTip.getClientId(context)).append(quot).append(comma).
    append(quot).append(targetClientId).append(quot).append(comma).
View Full Code Here


    String clientId = component.getClientId(context);
    String containerId = (String) variables.getVariable("containerId");
    JSFunction ajaxFunction = new JSFunction(
        AjaxRendererUtils.AJAX_FUNCTION_NAME);
    ajaxFunction.addParameter(containerId);
    ajaxFunction.addParameter(new JSReference("formId"));
    ajaxFunction.addParameter(new JSReference("event"));
    // AjaxRendererUtils.buildAjaxFunction(
    // component, context);

    Map options = AjaxRendererUtils.buildEventOptions(context, component);
    Map parameters = (Map) options.get("parameters");
    parameters.put("action", action);
    parameters.put(Filter.UPLOAD_FILES_ID, new JSReference("uid"));
    parameters.put(clientId, clientId);
    parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
    if (oncomplete != null) {
      options.put("onbeforedomupdate", oncomplete);
    }
View Full Code Here

    //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(";");
View Full Code Here

      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

    String targetId = HtmlUtil.idsToIdSelector(getFor());

    targetId = HtmlUtil.expandIdSelector(targetId, this, FacesContext.getCurrentInstance());
   
    JSFunction invocation = new JSFunction("Richfaces.componentControl.performOperation");
    invocation.addParameter(new JSReference("event"));
    invocation.addParameter(targetId);
    invocation.addParameter(getOperation());
    invocation.addParameter(new JSReference("{" + getEncodedParametersMap() + "}"));
    invocation.addParameter(Boolean.valueOf(isDisableDefault()));
   
    return invocation.toScript();

View Full Code Here

          result.append(", ");
        }

        ScriptUtils.addEncodedString(result, name);
        result.append(": ");
        result.append(ScriptUtils.toScript(escape ? value : new JSReference(value.toString())));
       
        shouldClose = true;
      }
    }
   
View Full Code Here

    StringBuffer script = new StringBuffer("\n");
    if (isAjaxMode(component) && progressBar.isEnabled()) {
      JSFunction function = AjaxRendererUtils.buildAjaxFunction(
          component, context, AJAX_POLL_FUNCTION);

      function.addParameter(new JSReference("$('" + clientId
          + "').component.options"));
      function.appendScript(script);

      pollScript.append(script);
    } else {
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 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 JSReference getClientFilterFunction(UIComponent component) {
        AbstractSelect select = (AbstractSelect) component;
        String clientFilter = (String) select.getAttributes().get("clientFilterFunction");
        if (clientFilter != null && clientFilter.length() != 0) {
            return new JSReference(clientFilter);
        }

        return null;
    }
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.