Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSReference


   
    StringBuilder builder = new StringBuilder();
        Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(context, tree, true);
        Map<String, Object> parameters = (Map<String, Object>) eventOptions.get("parameters");
        parameters.remove(id);
        parameters.put(id + UITree.SELECTED_NODE_PARAMETER_NAME, new JSReference("event.selectedNode"));
        eventOptions.put("parameters", new JSReference("params"));
       
    builder.append("var params = ").append(ScriptUtils.toScript(parameters)).append(";\n");
    builder.append("if (!params.").append(AjaxRendererUtils.AJAX_SINGLE_PARAMETER_NAME)
               .append(" && event.ajaxSingle) {\n");
    builder.append("params.").append(AjaxRendererUtils.AJAX_SINGLE_PARAMETER_NAME).append(" = event.ajaxSingle;\n");
    builder.append("}\n");
    if (!eventOptions.containsKey("oncomplete")) {
        eventOptions.put("oncomplete", new JSReference("event.oncomplete"));
    }
   
    JSFunction function = AjaxRendererUtils.buildAjaxFunction(tree, context);
    function.addParameter(eventOptions);
    builder.append(function);
View Full Code Here


      if (slider.isSubmitOnSlide()) {
      options.append(",onSlideSubmit: function(event, v) { updateSlider1(event, v);}");
  }
        options.append("}");

        JSReference reference = new JSReference(options.toString());
       
      JSFunction function = new JSFunction("Richfaces.DFSControl.Slider");
      function.addParameter(clientId + "slider-handle");
      function.addParameter(clientId + "slider-track");
      function.addParameter(reference);
View Full Code Here

    JSFunctionDefinition namedFunction = null;
    JSFunction eventFunction = null;

    if (name.trim().length() != 0) {
      JSFunction subFunction = new JSFunction("Richfaces.componentControl.performOperation");
      subFunction.addParameter(new JSReference("event"));
      componentControl.addOptions(subFunction, event, forAttr, operation);

      namedFunction = new JSFunctionDefinition("event");
      namedFunction.setName(name);
      namedFunction.addToBody(subFunction);
View Full Code Here

    public String getOnClick(FacesContext context, UIComponent component) {
        UISimpleTogglePanel tgComp = (UISimpleTogglePanel) component;

        String switchType = tgComp.getSwitchType();
        StringBuffer onClick = new StringBuffer();
      JSReference eventRef = new JSReference("event");
      String panelId = tgComp.getClientId(context);

  if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
            // Client
            JSFunction function = new JSFunction("SimpleTogglePanelManager.toggleOnClient");
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

  public JSReference getIsDayEnabled(FacesContext context, UIComponent component) {
    UICalendar calendar = (UICalendar) component;
    String isDayEnabled = (String) calendar.getAttributes().get(
        "isDayEnabled");
    if (isDayEnabled != null && isDayEnabled.length() != 0) {
      return new JSReference(isDayEnabled); //new JSFunction(isDayEnabled);
    }
   
    return null;
  }
View Full Code Here

  public JSReference getDayStyleClass(FacesContext context, UIComponent component) {
    UICalendar calendar = (UICalendar) component;
    String dayStyleClass = (String) calendar.getAttributes().get(
        "dayStyleClass");
    if (dayStyleClass != null && dayStyleClass.length() != 0) {
      return new JSReference(dayStyleClass);
    }
   
    return null;
 
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);
    return definition;
View Full Code Here

  public String getActionScript(FacesContext context, UIComponent component) throws IOException {
    String clientId = component.getClientId(context);
    JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, context);

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(FileUploadConstants.FILE_UPLOAD_ACTION, new JSReference("action"));
    parameters.put(FileUploadConstants.UPLOAD_FILES_ID, new JSReference("uid"));
    parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
   
    Map options = AjaxRendererUtils.buildEventOptions(context, component, parameters, true);
    options.put("onbeforedomupdate", new JSReference("callback"));
   
    ajaxFunction.addParameter(options);

    JSFunctionDefinition function = new JSFunctionDefinition("uid", "action", "callback");
    function.addParameter("event");
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.