Examples of JsFunction


Examples of org.ajax4jsf.javascript.JSFunction

   
    options.addOption("normalizedId", getNormalizedId(context, grid));
   
    composite.mergeScriptOptions(options, context, grid);
   
    JSFunction function = new JSFunction("new ClientUI.controls.grid.ScrollableGrid");
    function.addParameter(options);
    return function.toScript();
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

    ScrollableDataTableRendererState.restoreState(context);
  }
 
  public String getRowsAjaxUpdate(FacesContext context, UIScrollableDataTable grid){
   
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
    Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid);
    options.put("oncomplete", AjaxFunctionBuilder.getOnComplete(context, grid, AjaxFunctionBuilder.SCROLL));

    @SuppressWarnings("unchecked")
    Map<String, Object> parametersMap = (Map<String, Object>) options.get("parameters");
   
    parametersMap.put(grid.getBaseClientId(context) + ":scroll", "");
    function.addParameter(options);
    String completeFunction = function.toScript()+"; return false;";
   
    return completeFunction;
   
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

        String targetId = targetComponent.getClientId(context);

        Map attributes = component.getAttributes();
        StringBuffer script = new StringBuffer(" new ");
        // Build ajax function call
        JSFunction submitSuggest = AjaxRendererUtils.buildAjaxFunction(
                component, context, "RichFaces.Suggestion");
  submitSuggest.addParameter(targetId);
        submitSuggest.addParameter(component.getClientId(context));
        submitSuggest.addParameter(component.getAttributes().get("onsubmit"));
        Map options = AjaxRendererUtils.buildEventOptions(context, component);
        options.put("popup", component.getClientId(context));
        for (int i = 0; i < OPTIONS.length; i++) {
            String option = OPTIONS[i];
            Object value = attributes.get(option);
           
            if(option.equals("entryClass") && isDefOptionValue(value)) {
              value = "richfaces_suggestionEntry";
            }
           
            if(option.equals("selectValueClass") && isDefOptionValue(value)) {
              value = "richfaces_suggestionSelectValue";
            }
           
            if (null != value) {
                if (!"frequency".equals(option) || ((Double) value).doubleValue() > 1E-9) {
                 
                  options.put(option, value);
                }
            }
        }
        // If implicit ajax queue name not set, put clientId
        String implicitEventsQueue = (String) options.get("implicitEventsQueue");
        if (null == implicitEventsQueue) {
            options.put("implicitEventsQueue", component.getClientId(context));
        }
        String onselect = (String) attributes.get("onselect");
        if (null != onselect) {
            JSFunctionDefinition function = new JSFunctionDefinition(
                    "suggestion");
            function.addParameter("event");
            function.addToBody(onselect);

            options.put("onselect", function);

        }
        String onobjectchange = (String) attributes.get("onobjectchange");
        if (null != onobjectchange) {
            JSFunctionDefinition function = new JSFunctionDefinition(
                    "suggestion","event");
            function.addToBody(onobjectchange);

            options.put("onobjectchange", function);

        }
        if (component.getValueBinding("fetchValue") != null
                || attributes.get("fetchValue") != null) {
          Object select = attributes.get("selectValueClass");
          if (isDefOptionValue(select)) {
            select = "richfaces_suggestionSelectValue";
          }
            options.put("select", select);
        }
       
        UISuggestionBox suggestionBox = (UISuggestionBox) component;
        options.put("usingSuggestObjects", suggestionBox.isUsingSuggestObjects());

        // pass "zindex" attribute to js though the "options" attribute
        options.put("zindex", suggestionBox.getZindex());

        submitSuggest.addParameter(options);
        script.append(submitSuggest.toScript()).append(";\n");
        return "Richfaces.onAvailable('" + targetId + "', function() {" + script.toString() + "});";
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

    public JSFunctionDefinition createShowMenuEventFunction() {
        JSFunctionDefinition definition = new JSFunctionDefinition();
        definition.addParameter("event");
        definition.addParameter("columnId");
        definition.addParameter("menuId");
        JSFunction invocation = new JSFunction(
                "Richfaces.componentControl.performOperation");
        invocation.addParameter(new JSReference("event"));
        invocation.addParameter(new JSReference("menuId"));
        invocation.addParameter("show");
        // invocation.addParameter(new JSReference("{'columnId':columnId}"));
        invocation.addParameter(new JSReference("{}"));
        invocation.addParameter(Boolean.FALSE);
        definition.addToBody(invocation.toScript()).addToBody(";\n");
        return definition;
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

    if (preSendAjaxRequestFunction != null){
      definition.addToBody(preSendAjaxRequestFunction.toScript()).addToBody(";");
    }
    definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
   
    JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(column, context);
    dropFunction.addParameter(new JSReference("options"));
   
    definition.addToBody(dropFunction.toScript()).addToBody(";");
   
    definition.addToBody("};");
   
    definition.appendScript(result);
    result.append(";");
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

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

Examples of org.ajax4jsf.javascript.JSFunction

    }
    buffer.append(",\"" + PANEL_MENU_SPACER_ICON + "\"");
  }
     
  protected void addAjaxFunction(FacesContext context, UIComponent child, StringBuffer buffer) {
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(child,
                context);
        Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
            child);
        function.addParameter(eventOptions);
       
        buffer.append(",\"");
        function.appendScript(buffer);
        buffer.append("\"");
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

    UIProgressBar progressBar = (UIProgressBar) component;
    String clientId = component.getClientId(context);
    StringBuffer pollScript = new StringBuffer("\n");
    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 {
      pollScript.append(getStopPollScript(clientId));
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunction

      String action, Object oncomplete) throws IOException {
    ComponentVariables variables = ComponentsVariableResolver.getVariables(
        this, component);
    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);
    }
    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.JSFunction

            } else {
                String activeCheck = "if (RichFaces.isTabActive('" + clientId + LABEL_SUFFIX + "')) return false;";
                String eventCheck = " if (!RichFaces.onTabChange(event, '"+pane.getClientId(context)+"','"+clientId+"')) return false;";
               
                if (ajax) {
                    JSFunction function = AjaxRendererUtils.buildAjaxFunction(tab,
                            context);
                    Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
                            tab);
                    function.addParameter(eventOptions);

                    StringBuffer buffer = new StringBuffer();
                    function.appendScript(buffer);
                    //TODO remove this.onclick = null
                    buffer.append("; return false; this.onclick = null;");
                    String script = buffer.toString();
                    writer.writeAttribute(HTML.onclick_ATTRIBUTE, activeCheck + eventCheck +  script, null);
                } else /* TODO if server */ {
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.