Package org.openfaces.util

Examples of org.openfaces.util.Script


            options = createFormatOptions(context, slider);
        } catch (JSONException e) {
            throw new FacesException(e);
        }

        Script initScript = new ScriptBuilder().initScript(context, slider, "O$.Slider._init",
                slider.getValue(), slider.getMinValue(), slider.getMaxValue(),
                slider.getMinorTickSpacing(), slider.getMajorTickSpacing(),
                slider.getOrientation(), slider.getFillDirection(),
                slider.isDisabled(), slider.isTooltipEnabled(),
                slider.isBarCanChangeValue(), slider.isBarVisible(),
View Full Code Here


        return true;
    }

    private void encodeScriptAndStyles(FacesContext context, FileAttachments fileAttachments) throws IOException {

        Script initScript = new ScriptBuilder().initScript(context, fileAttachments, "O$.FileAttachments._init");

        Rendering.renderInitScript(context, initScript,
                Resources.utilJsURL(context),
                Resources.internalURL(context, JS_SCRIPT_URL)
        );
View Full Code Here

                defStopUrl = Resources.getURL(context, null, null, DEFAULT_STOP_URL);
                listOfImages.add(defStopUrl);
                Rendering.renderPreloadImagesScript(context, listOfImages, false);
            }
        }
        Script initScript = new ScriptBuilder().initScript(context, fileUpload, "O$.SingleFileUpload._init",
                uploadedSize,
                fileUpload.getNotUploadedStatusText(),
                fileUpload.getInProgressStatusText(),
                fileUpload.getUploadedStatusText(),
                fileUpload.getFileSizeLimitErrorText(),
View Full Code Here

        Position popupPosition = abstractFileUpload.getPosition();
        String browseButtonId = clientId + (multipleFileUpload.getExternalBrowseButton() == null || multipleFileUpload.getShowInPopup() ?
                DIV_HEADER_ID : FOOTER_DIV_ID) + BROWSE_BTN_ID;

        Script initScript = new ScriptBuilder().initScript(context, multipleFileUpload, "O$.FileUpload._init",
                multipleFileUpload.getMinQuantity(),
                multipleFileUpload.getMaxQuantity(),
                uploadedSize,
                fileInfoClass,
                infoTitleClass,
View Full Code Here

        String focusedClass = Styles.getCSSClass(context, inputText, inputText.getFocusedStyle(), StyleGroup.regularStyleGroup(3), inputText.getFocusedClass(), null);

        String value = Rendering.convertToString(context, inputText, inputText.getValue());
        boolean promptVisible = value == null || value.length() == 0;
       
        Script initScript = new ScriptBuilder().initScript(context, inputText, "O$.InputText._init",
                promptText,
                promptTextClass,
                rolloverClass,
                focusedClass,
                inputText.isDisabled(),
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context) throws IOException {
        super.encodeBegin(context);

        String onchange = getOnchange();
        Script automaticChangeHandler = null;
        Iterable<String> render = getRender();
        Iterable<String> execute = getExecute();
        final Chart chart = (Chart) getParent();

        if (render != null || (execute != null && execute.iterator().hasNext())) {
            AjaxInitializer initializer = new AjaxInitializer();
            JSONObject ajaxParams = initializer.getAjaxParams(context, this);
            MethodExpression actionExpression = getActionExpression();
            if (actionExpression != null) {
                String expr = actionExpression.getExpressionString().trim();
                if (!expr.startsWith("#{")) throw new FacesException("<o:selection> action expression is expected to start with #{ symbols: " + expr);
                expr = expr.substring(2, expr.length() - 1);
                try {
                    ajaxParams.put("_action", expr);
                } catch (JSONException e) {
                    throw new RuntimeException(e);
                }
            }
            automaticChangeHandler = new ScriptBuilder().functionCall("O$._ajaxReload",
                    initializer.getRenderArray(context, this, render),
                    ajaxParams).semicolon().append("return false;");
        } else {
            MethodExpression actionExpression = getActionExpression();
            if (actionExpression != null) {
                automaticChangeHandler = new ScriptBuilder().functionCall("O$.submitWithParam",
                        new ScriptBuilder().O$(chart), getActionFieldName(), "true");
            }
        }

        onchange = Rendering.joinScripts(onchange,
                automaticChangeHandler != null ? automaticChangeHandler.toString() : null);

        ScriptBuilder buf = new ScriptBuilder().initScript(context, chart, "O$.Chart._initSelection", onchange);

        Rendering.renderInitScript(context, buf,
                Resources.utilJsURL(context),
View Full Code Here

        inputText.setStyle(paginator.getPageNumberFieldStyle());
        String fieldClass = Styles.getCSSClass(
                context, component, null, DEFAULT_FIELD_CLASS, paginator.getPageNumberFieldClass());
        inputText.setStyleClass(fieldClass);
        inputText.setOnkeypress("if (event.keyCode == 13) {this.onchange(); O$.stopEvent();}");
        Script selectPageNoScript = getSubmitComponentWithParamScript(
                useAjax, table, actionFieldName, new RawScript("'selectPageNo:' + this.value"), false);
        inputText.setOnchange(selectPageNoScript.toString());
        children.add(inputText);
        if (paginator.getShowPageCount()) {
            String pageCountPreposition = paginator.getPageCountPreposition();
            if (pageCountPreposition == null)
                pageCountPreposition = DEFAULT_PAGE_COUNT_PREPOSITION;
View Full Code Here

            UIComponent componentToReload, boolean linkActive) {
        HtmlGraphicImage image = createGraphicImage(context, imageUrl);
        if (!linkActive)
            return image;

        Script submitScript = getSubmitComponentWithParamScript(useAjax, componentToReload, fieldName, fieldValue, true);
        image.setOnclick(submitScript + "event.cancelBubble = true; return false;");
        image.setId(Components.generateIdWithSuffix(eventReceiver, idSuffix));
        image.setStyleClass(DEFAULT_IMAGE_CLASS);
        image.setTitle(text);
        image.setAlt(text);
View Full Code Here


    private static Script getSubmitComponentWithParamScript(
            boolean useAjax, UIComponent table, String paramName, Object paramValue,
            boolean focusTable) {
        Script submitScript = useAjax
                ? new ScriptBuilder().functionCall("O$.Table._performPaginatorAction",
                table, new RawScript(focusTable ? "null" : "this"), paramName, paramValue).semicolon()
                : new ScriptBuilder().functionCall("O$.submitWithParam",
                new RawScript("this"), paramName, paramValue).semicolon();
        return submitScript;
View Full Code Here

            }
        };

        JSONArray renderArray = ajaxInitializer.getRenderArray(context, (OUICommand) action, ajax.getRender());
        String idExpression = "O$._renderIds['" + id + "']";
        Script render = new RawScript("(" + idExpression + " ? " + idExpression + " : " + renderArray.toString() + ")");

        buf.functionCall("O$._ajaxReload",
                render,
                ajaxInitializer.getAjaxParams(context, ajax)).semicolon();
        return buf.toString();
View Full Code Here

TOP

Related Classes of org.openfaces.util.Script

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.