Package org.ajax4jsf.javascript

Examples of org.ajax4jsf.javascript.JSReference


    }

    public JSReference getDayEnabled(FacesContext facesContext, UIComponent component) {
        AbstractCalendar calendar = (AbstractCalendar) component;
        String dayEnabled = calendar.getDayDisableFunction();
        return ((dayEnabled != null && dayEnabled.trim().length() != 0)) ? new JSReference(dayEnabled) : null;
    }
View Full Code Here


    }

    public JSReference getDayStyleClass(FacesContext context, UIComponent component) {
        AbstractCalendar calendar = (AbstractCalendar) component;
        String dayStyleClass = calendar.getDayClassFunction();
        return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ? new JSReference(dayStyleClass) : null;
    }
View Full Code Here

        writer.write(function.toString());
    }

    public JSFunctionDefinition getSubmitFunction(FacesContext facesContext, UIComponent component) {
        JSFunctionDefinition definition = new JSFunctionDefinition(JSReference.EVENT, new JSReference("element"),
            new JSReference("data"));

        AjaxFunction function = AjaxRendererUtils.buildAjaxFunction(facesContext, component);

        Map<String, Object> parameters = function.getOptions().getParameters();
        parameters.put(component.getClientId(facesContext) + ":page", new JSLiteral("data.page"));
View Full Code Here

            throw new IllegalArgumentException(
                "One of the necessary attributes is null or empty. Check operation attribute and selector or target attributes.");
        }

        JSFunctionDefinition callback = new JSFunctionDefinition();
        callback.addParameter(new JSReference(REF_EVENT));
        callback.addParameter(new JSReference(REF_COMPONENT));

        // create callback function
        StringBuffer script = new StringBuffer();
        script.append(REF_COMPONENT).append("['").append(apiFunctionName).append("'].").append("apply").append("(");

        // get client api function parameters
        List<Object> apiFunctionParams = createSignature(controlBehavior);
        script.append(REF_COMPONENT).append(",").append(ScriptUtils.toScript(apiFunctionParams.toArray())).append(");");
        callback.addToBody(script);

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put(PARAM_CALLBACK, callback);
        parameters.put(PARAM_TARGET, resolveTargets(facesContext, targetSourceString));
        parameters.put(PARAM_SELECTOR, selector);

        String onBeforeOperation = controlBehavior.getOnbeforeoperation();
        if (null != onBeforeOperation && !onBeforeOperation.isEmpty()) {
            JSFunctionDefinition onBeforeOperationFunction = new JSFunctionDefinition(new JSReference(REF_EVENT));
            onBeforeOperationFunction.addToBody(onBeforeOperation);
            parameters.put(PARAM_ONBEFOREOPERATION, onBeforeOperationFunction);
        }

        // execution function
        JSFunction eventFunction = new JSFunction(FUNC_NAME);
        eventFunction.addParameter(new JSReference(REF_EVENT));
        eventFunction.addParameter(parameters);

        StringBuffer execution = new StringBuffer();
        execution.append(eventFunction.toScript());
        execution.append("; return false;");
View Full Code Here

        UIParameter parameter = (UIParameter) kid;
        String name = parameter.getName();
        Object value = parameter.getValue();

        if ((parameter instanceof JavaScriptParameter) && ((JavaScriptParameter) parameter).isNoEscape()) {
      value = new JSReference(String.valueOf(value));
        }

        params.put(name, value);
    }
      }
View Full Code Here

            "  options.parameters['" + SORT_DIR_PARAMETER + "'] = (ascending ? '"+SORT_DIR_PARAMETER_ASC+"':'"+SORT_DIR_PARAMETER_DESC+"');"+
            "}"
        );
        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }// getSortFunctionDef
View Full Code Here

                ScriptUtils.toScript(eventOptions)).addToBody(";\n");
        definition.addToBody("options.parameters['" + GROUP_FILTER_PARAMETER
                + "'] = columnId;\n");
        JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table,
                context);
        ajaxFunction.addParameter(new JSReference("options"));
        definition.addToBody(ajaxFunction.toScript()).addToBody(";\n");
        return definition;
    }// getGroupFunctionDef
View Full Code Here

                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;
    }// getOnGroupToggleFunctionDef
View Full Code Here

        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

    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);
    }
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.