Examples of JSFunctionDefinition


Examples of org.ajax4jsf.javascript.JSFunctionDefinition

        Object eventHandler = ScriptHashVariableWrapper.eventHandler.wrap("abc");

        assertTrue(eventHandler instanceof JSFunctionDefinition);

        JSFunctionDefinition handlerFunction = (JSFunctionDefinition) eventHandler;
        assertEquals("function(event){abc}", dehydrate(handlerFunction.toScript()));

        Object arrayObject = ScriptHashVariableWrapper.asArray.wrap("header, footer");
        assertEquals("[\"header\",\"footer\"]", dehydrate(ScriptUtils.toScript(arrayObject)));
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

        executeJavaScriptLogged(function.toScript());
    }

    protected void executeOnTime(int time, String expression) {
        JSFunction function = new JSFunction("simulationContext.executeOnTime", time,
            new JSFunctionDefinition().addToBody(expression));

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

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

        return "document.getElementById('" + id + "').click()";
    }

    protected void clickOnTime(int time, String id) {
        JSFunction function = new JSFunction("simulationContext.executeOnTime", time,
            new JSFunctionDefinition().addToBody(buildClickExpression(id)));

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

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

        handlersChain.addBehaviors(eventName);
        // handlersChain.addAjaxSubmitFunction();

        String handler = handlersChain.toScript();
        if (handler != null) {
            options.put(ON + eventName, new JSFunctionDefinition(JSReference.EVENT).addToBody(handler));
        }
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

        target.append(RIGHT_SQUARE_BRACKET);
        appendAjaxParameter(target);
        if (oninvalid != null && oninvalid.trim().length() > 0) {
            target.append(COMMA);
            target.append("oninvalid:");
            target.append(new JSFunctionDefinition("messages").addToBody(oninvalid).toScript());
        }
        if (onvalid != null && onvalid.trim().length() > 0) {
            target.append(COMMA);
            target.append("onvalid:");
            target.append(new JSFunctionDefinition().addToBody(onvalid).toScript());
        }
    }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) {
        Map<String, Object> options = new HashMap<String, Object>();

        if (component instanceof AbstractDropTarget) {
            JSReference dragSourceId = new JSReference("dragSourceId");
            JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId);

            AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component);
            ajaxFunction.getOptions().setParameter("dragSource", dragSourceId);
            ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext));
            ajaxFunction.setSource(new JSReference("event", "target"));
            ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext));
            function.addToBody(ajaxFunction);

            AbstractDropTarget dropTarget = (AbstractDropTarget) component;
            Set<String> acceptedTypes = Sets.asSet(dropTarget.getAcceptedTypes());

            if (acceptedTypes != null) {
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    }
    return statusId;
  }

  public static JSFunctionDefinition buildAjaxOncomplete(String body) {
    JSFunctionDefinition function = new JSFunctionDefinition("request", "event", "data");
    function.addToBody(body);

    return function;
  }
View Full Code Here

Examples of org.ajax4jsf.javascript.JSFunctionDefinition

    return function;
  }
 
  public static JSFunctionDefinition buildAjaxOnBeforeDomUpdate(String body) {
    JSFunctionDefinition function = new JSFunctionDefinition("request", "event", "data");
    function.addToBody(body);

    return function;
  }
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(eventName + ": "
          + onEventDefinition.toScript(), null);
    }else{
      writer.writeText(eventName + ": ''", null);
    }
  }
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");
        if(null!=append && append.length()>0){
          function.addToBody(event+append);
        }else{
          function.addToBody(event);
        }
      return  function;
      }
    }
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.