Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSFunctionDefinition


            writer.endElement("li");
        }
    }// encodeMenuItem

    public JSFunctionDefinition createShowMenuEventFunction() {
        return new JSFunctionDefinition();
    }
View Full Code Here


    public String  getEventHandlerFunction(UIDataFltrSlider slider,String eventName){
     
      String returnScript = null;      
      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

    private String createCss(UIComponent component, States state, String suffix) {
  return state.createCss(component, suffix);
    }
   
    public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
  JSFunctionDefinition script = getUtils().getAsEventHandler(context, component, attributeName, null)
  return ScriptUtils.toScript(script);
    }
View Full Code Here

        return getSortFunctionDef(context, table, null);
    }

    protected JSFunctionDefinition getSortFunctionDef(FacesContext context,
            UIDataTable table, Boolean asc) {
        JSFunctionDefinition definition = new JSFunctionDefinition();
        definition.addParameter("event");
        definition.addParameter("columnId");
        String id = table.getClientId(context);
        Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
                context, table);
        @SuppressWarnings("unchecked")
        Map<String, Object> parameters = (Map<String, Object>) eventOptions
                .get("parameters");
        parameters.put(id, SORT_FILTER_PARAMETER);
        if (asc != null) {
            parameters.put(SORT_DIR_PARAMETER, asc ? SORT_DIR_PARAMETER_ASC
                    : SORT_DIR_PARAMETER_DESC);
        }
        // parameters.put(SORT_FILTER_PARAMETER, column.getClientId(context));
        JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
                context, table);
        if (onAjaxCompleteFunction != null) {
            eventOptions.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
                    onAjaxCompleteFunction);
        }
View Full Code Here

        Map<String, Object> parameters = (Map<String, Object>) requestOpts
                .get("parameters");
        parameters.put(id, SORT_FILTER_PARAMETER);
        parameters.put(SORT_DIR_PARAMETER, "{sortDirection}");
        parameters.put(SORT_FILTER_PARAMETER, "{columnId}");
        JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
                context, table);
        if (onAjaxCompleteFunction != null) {
            requestOpts.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
                    onAjaxCompleteFunction);
        }
View Full Code Here

        return ajaxFunction;
    }// getSortFunction

    protected JSFunctionDefinition getOnGroupToggleFunctionDef(
            FacesContext context, UIDataTable table) {
        JSFunctionDefinition definition = new JSFunctionDefinition();
        definition.addParameter("event");
        definition.addParameter("groupIndex");
        Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
                context, table);
        @SuppressWarnings("unchecked")
        Map<String, Object> parameters = (Map<String, Object>) eventOptions
                .get("parameters");
        parameters.put(GROUP_TOGGLE_ACTION_NAME, GROUP_TOGGLE_ACTION_NAME);
        definition.addToBody("var options = ").addToBody(
                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;
    }// getSortFunction
View Full Code Here

        @SuppressWarnings("unchecked")
        Map<String, Object> parameters = (Map<String, Object>) requestOpts
                .get("parameters");
        parameters.put(id, GROUP_FILTER_PARAMETER);
        parameters.put(GROUP_FILTER_PARAMETER, "{columnId}");
        JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
                context, table);
        if (onAjaxCompleteFunction != null) {
            requestOpts.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
                    onAjaxCompleteFunction);
        }
View Full Code Here

        return ajaxFunction;
    }// getSortFunction

    protected JSFunctionDefinition getOnResizeFunctionDef(FacesContext context,
            UIDataTable table) {
        JSFunctionDefinition definition = new JSFunctionDefinition();
        definition.addParameter("event");
        definition.addParameter("columnWidths");

        Map<String, Object> eventOptions = AjaxRendererUtils.buildEventOptions(
                context, table);
        @SuppressWarnings("unchecked")
        Map<String, Object> parameters = (Map<String, Object>) eventOptions
                .get("parameters");
        parameters.put(COL_RESIZE_ACTION_NAME, COL_RESIZE_ACTION_NAME);
        definition.addToBody("var options = ").addToBody(
                ScriptUtils.toScript(eventOptions)).addToBody(";\n");
        definition
                .addToBody("options.parameters['columnWidths'] = columnWidths;\n");

        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }
View Full Code Here

            FacesContext context, UIDataTable table) {
        boolean ajaxSingle = true;
        Map<String, Object> requestOpts = AjaxRendererUtils.buildEventOptions(
                context, table);

        JSFunctionDefinition onAjaxCompleteFunction = getOnAjaxCompleteFunction(
                context, table);
        if (onAjaxCompleteFunction != null)
            requestOpts.put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
                    onAjaxCompleteFunction);
View Full Code Here

  ScriptString result = JSReference.NULL;

  if (event != null) {
      event = event.trim();
      if (event.length() != 0) {
    JSFunctionDefinition function = new JSFunctionDefinition();
    function.addParameter("event");
    function.addToBody(event);
    result = function;
      }
  }

  return ScriptUtils.toScript(result);
View Full Code Here

TOP

Related Classes of org.ajax4jsf.javascript.JSFunctionDefinition

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.