Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSFunctionDefinition.toScript()


        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


    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

      JSFunctionDefinition onPageChangeDef = new JSFunctionDefinition("event");
      onPageChangeDef.addToBody(onPageChange);
      onPageChangeDef.addToBody("; return true;");

      definition.addToBody("if (");
      definition.addToBody(onPageChangeDef.toScript());
      definition.addToBody("(event)) {");
      definition.addToBody(buffer.toString());
      definition.addToBody("}");
  } else {
      definition.addToBody(buffer.toString());
View Full Code Here

    JSFunctionDefinition function = new JSFunctionDefinition("uid");
    function.addParameter("formId");
    function.addParameter("event");
    function.addToBody(ajaxFunction.toScript());

    return function.toScript();
  }

  /**
   * Return accepted types map
   *
 
View Full Code Here

    JSReference requestValue = new JSReference("requestValue");
    ajaxFunction.addParameter(options);
    JSFunctionDefinition definition = new JSFunctionDefinition();
    definition.addParameter(requestValue);
    definition.addToBody(ajaxFunction);
    writer.write(definition.toScript());
  }

  public void writeEventHandlerFunction(FacesContext context,
      UIComponent component, String eventName) throws IOException {
View Full Code Here

    if (script != null && !script.equals("")) {
      JSFunctionDefinition onEventDefinition = new JSFunctionDefinition();
      onEventDefinition.addParameter("event");
      onEventDefinition.addToBody(script);
      writer.writeText(",\n" + eventName + ": "
          + onEventDefinition.toScript(), null);
    }
  }

  public String getInputValue(FacesContext context, UIComponent component) {
    UICalendar calendar = (UICalendar) component;
View Full Code Here

    while (iterator.hasNext()) {
      Entry<String, Object> entry = iterator.next();
      Object value = entry.getValue();
      if (value instanceof JSFunctionDefinition) {
        JSFunctionDefinition definition = (JSFunctionDefinition) value;
        entry.setValue(definition.toScript());
      }
    }
  }

  private ScriptOptions createOptions(FacesContext context, UITreeNode component, Class<?> clazz) {
View Full Code Here

      Object script = slider.getAttributes().get(eventName);
      if(script != null && !script.equals("")){
        JSFunctionDefinition jsFunctionDefinition  = new JSFunctionDefinition();
        jsFunctionDefinition.addParameter("event");
        jsFunctionDefinition.addToBody(script);
        returnScript = jsFunctionDefinition.toScript();
     
     
      return returnScript;
    }
View Full Code Here

    JSFunctionDefinition function = new JSFunctionDefinition("uid", "action", "callback");
    function.addParameter("event");
    function.addToBody(ajaxFunction.toScript());

    return function.toScript();
  }
 
  /**
   * https://jira.jboss.org/jira/browse/RF-8053 - public hook to change action URL in portlet environment.
   * @param context
View Full Code Here

    JSReference requestValue = new JSReference("requestValue");
    ajaxFunction.addParameter(options);
    JSFunctionDefinition definition = new JSFunctionDefinition();
    definition.addParameter(requestValue);
    definition.addToBody(ajaxFunction);
    writer.write(definition.toScript());
  }

  public void writeEventHandlerFunction(FacesContext context,
      UIComponent component, String eventName) throws IOException {
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.