Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSReference


       
        String eventShow = (toolTip.isAttached()) ? toolTip.getShowEvent() : "";
        if (eventShow.startsWith("on")) {
            eventShow = eventShow.substring(2);
        }
        eventsMap.put(new JSReference("showEvent"), eventShow);

        String eventHide = (toolTip.isAttached()) ? toolTip.getHideEvent() : "";
        if (eventHide.startsWith("on")) {
            eventHide = eventHide.substring(2);
        }
        eventsMap.put(new JSReference("hideEvent"), eventHide);

        eventsMap.put(new JSReference("delay"), new Integer(toolTip.getShowDelay()));
        eventsMap.put(new JSReference("hideDelay"), new Integer(toolTip.getHideDelay()));
       
        JSFunctionDefinition ajaxFunc = null;
        if (AJAX_MODE.equalsIgnoreCase(toolTip.getMode())) {
            ajaxFunc = new JSFunctionDefinition("event", "ajaxOptions");
            JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
            JSReference ref = new JSReference("ajaxOptions");
            function.addParameter(ref);
            ajaxFunc.addToBody(function);
        }
       
        Map<String, Object> ajaxOptions = buildEventOptions(context, toolTip, targetClientId);
        ajaxOptions.putAll(getParamsMap(context, toolTip));
       
        Map<JSReference, Object> funcMap = new HashMap<JSReference, Object>();
        JSFunctionDefinition completeFunc = getUtils().getAsEventHandler(
                context, component, "oncomplete", "; return true;");
        funcMap.put(new JSReference("oncomplete"), completeFunc);

        JSFunctionDefinition hideFunc = getUtils().getAsEventHandler(
                context, component, "onhide", "; return true;");
        funcMap.put(new JSReference("onhide"), hideFunc);

        JSFunctionDefinition showFunc = getUtils().getAsEventHandler(
                context, component, "onshow", "; return true;");
        funcMap.put(new JSReference("onshow"), showFunc);
       
        StringBuffer ret = new StringBuffer();
        ret.append("new ToolTip(").append(ScriptUtils.toScript(eventsMap)).append(COMMA)
           .append(ScriptUtils.toScript(funcMap)).append(COMMA)
           .append(QUOT).append(toolTip.getClientId(context)).append(QUOT_COMMA)
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

    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(FileUploadConstants.FILE_UPLOAD_ACTION, action);
    parameters.put(FileUploadConstants.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

       
        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

            }
           
            ScriptUtils.addEncodedString(result, name);
            result.append(": ");
            result.append(ScriptUtils.toScript(escape ? value
                    : new JSReference(value.toString())));
           
            shouldClose = true;
        }
       
        return result.toString();
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 (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

            "  options.parameters['" + SORT_DIR_PARAMETER + "'] = (ascending ? '"+SORT_DIR_PARAMETER_ASC+"':'"+SORT_DIR_PARAMETER_DESC+"');"+
            "}"
        );
        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }// getSortFunctionDef
View Full Code Here

                ScriptUtils.toScript(eventOptions)).addToBody(";\n");
        definition.addToBody("options.parameters['" + GROUP_FILTER_PARAMETER
                + "'] = columnId;\n");
        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }// getGroupFunctionDef
View Full Code Here

                ScriptUtils.toScript(eventOptions)).addToBody(";\n");
        definition
                .addToBody("options.parameters['groupIndex'] = groupIndex;\n");
        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }// getOnGroupToggleFunctionDef
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.