Package org.richfaces.javascript

Examples of org.richfaces.javascript.JSFunction


     * @param time
     * @param data
     * @param builder
     */
    protected void ajax(int time, String data, ParametersBuilder builder) {
        JSFunction function = new JSFunction("simulationContext.ajax", time, data, builder.getParameters());

        page.executeJavaScript(function.toScript());
    }
View Full Code Here


        page.executeJavaScript(function.toScript());
    }

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

        page.executeJavaScript(function.toScript());
    }
View Full Code Here

    private String buildClickExpression(String id) {
        return "document.getElementById('" + id + "').click()";
    }

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

        page.executeJavaScript(function.toScript());
    }
View Full Code Here

        }
    }

    private final static class AjaxSubmitFunctionResourceRenderer extends Renderer implements UserResourceRenderer2 {
        public void encodeToHead(FacesContext facesContext, UIComponent component) throws IOException {
            JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
            Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component, true);

            options.put("requestDelay", new JSReference("options.requestDelay"));
            options.put("similarityGroupingId",
                    new JSReference("options.similarityGroupingId || '" + component.getClientId(facesContext)
                            + "'"));
            options.put("data", new JSReference("data"));
            options.put("requestTime", new JSReference("options.requestTime"));
            options.put("timeout", new JSReference("options.timeout"));
            options.put("eventsQueue", new JSReference("options.eventsQueue"));
            options.put("implicitEventsQueue", new JSReference("options.implicitEventsQueue"));
            options.put("ignoreDupResponses", new JSReference("options.ignoreDupResponses"));
            ajaxFunction.addParameter(options);

            ResponseWriter responseWriter = facesContext.getResponseWriter();

            responseWriter.startElement(HTML.SCRIPT_ELEM, component);
            responseWriter.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
            responseWriter.writeText("var " + AJAX_SUBMIT + " = function(data, options) {" + ajaxFunction.toScript()
                    + "};", null);
            responseWriter.endElement(HTML.SCRIPT_ELEM);
        }
View Full Code Here

        addOptionIfSetAndNotDefault("overlayOpacity", lightbox.getOverlayOpacity(), options);
        addOptionIfSetAndNotDefault("txtImage", lightbox.getTxtImage(), options);
        addOptionIfSetAndNotDefault("txtOf", lightbox.getTxtOf(), options);
        writer.startElement(HtmlConstants.DIV_ELEM, component);
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getUtils().clientId(context, component), "id");
        getUtils().writeScript(context, component, new JSFunction("RichFaces.Lightbox", lightbox.getSelector(), options));
        writer.endElement(HtmlConstants.DIV_ELEM);
    }
View Full Code Here

        }
        writer.startElement(HtmlConstants.SCRIPT_ELEM, null);
        writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", "type");
        writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId, HtmlConstants.ID_ATTRIBUTE);
        if (AbstractFocus.TIMING_ON_LOAD.equals(uiFocus.getTiming())) {
            writer.write(new JSFunction("RichFaces.ui.Focus.setFocus", targetClientId, priority).toScript());
            writer.write(";");
        } else {
            writer.write(new JSFunction("RichFaces.ui.Focus.setFocus", targetClientId, priority, clientId,
                    uiFocus.getTiming()).toScript());
            writer.write(";");
        }
        if (uiFocus.getName() != null && !uiFocus.getName().trim().equals("")) {
            final JSFunctionDefinition definition = new JSFunctionDefinition().addToBody(new JSFunction("RichFaces.ui.Focus.focusStored", clientId));
            definition.setName(uiFocus.getName());
            writer.write(definition.toScript());
            writer.write(";");
        }
        writer.endElement(HtmlConstants.SCRIPT_ELEM);
View Full Code Here

            AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(context, component);
            ajaxFunction.getOptions().getParameters().putAll(params);
            ajaxFunction.getOptions().set("complete", new JSReference(CALLBACK));
            jsFunction = ajaxFunction;
        } else if (SwitchType.server.equals(component.getSwitchType())) {
            jsFunction = new JSFunction("RichFaces.submitForm", "#"
                + RendererUtils.getInstance().getNestingForm(component).getClientId(context),
                params,
                "");
        } else {
            return null;
View Full Code Here

TOP

Related Classes of org.richfaces.javascript.JSFunction

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.