Package org.openfaces.util

Examples of org.openfaces.util.ScriptBuilder


        List<String> params = new ArrayList<String>();
        params.add(fieldText);
        params.addAll(getInputStyles(context, dropDown));
        params.add(promptText);
        params.add(promptTextClass);
        ScriptBuilder buf = new ScriptBuilder().initScript(context, dropDown, "O$.DropDown._initInput", params.toArray());

        InitScript commonInitScript = new InitScript(buf, new String[]{
                Resources.utilJsURL(context),
                getDropdownJsURL(context)
        });
View Full Code Here


            * */
            @SuppressWarnings(value = "unchecked") List<Integer> selectedRowIndexes = (List<Integer>) selectedRows.encodeSelectionIntoIndexes();
            AbstractTable table = getTable();
            List<BaseColumn> renderedColumns = table.getRenderedColumns();
            int columnIndex = renderedColumns.indexOf(this);
            ScriptBuilder buf = new ScriptBuilder().functionCall("O$.Table._setCheckboxColValues",
                    table,
                    columnIndex,
                    selectedRowIndexes
            ).semicolon();
            Rendering.renderInitScript(context, buf,
View Full Code Here

                for (int i = 0, count = applicableFunctions.size(); i < count; i++) {
                    SummaryFunction function = applicableFunctions.get(i);
                    MenuItem menuItem = Components.createComponent(context, MenuItem.COMPONENT_TYPE, MenuItem.class, popupMenu, "item" + i);
                    String functionName = function.getName();
                    menuItem.setValue(functionName);
                    menuItem.setOnclick(new ScriptBuilder().functionCall(
                            "O$.Summary._setFunction", functionName.toLowerCase()
                    ).toString());
                    menuItem.setIconUrl(Resources.internalURL(context, null,
                            SelectBooleanCheckboxImageManager.DEFAULT_UNSELECTED_IMAGE, false));
                    menuItem.getAttributes().put(ATTR_FUNCTION_NAME, functionName);
View Full Code Here

            } else {
                popupMenu = null;
            }

            ScriptBuilder sb = new ScriptBuilder();
            if (globalCalculationContext != null) {
                if (globalCalculationContext.getRenderedSummaryClientId() == null) {
                    // this case might take place when this <o:summary> component is inserted into the "below" facet of
                    // <o:dataTable>, in which case it didn't have a chance to be rendered up to this moment and so its
                    // client id has not been initialized yet
View Full Code Here

    public void encodeOnAjaxNodeFolding(FacesContext context) throws IOException {
        AbstractTable table = getTable();

        List<?> selectedRowIndexes = encodeSelectionIntoIndexes();
        ScriptBuilder buf = new ScriptBuilder().functionCall("O$.TreeTable._setSelectedNodeIndexes",
                table,
                selectedRowIndexes).semicolon();

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

                    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),
                Resources.internalURL(context, "chart/chart.js"));
        AjaxUtil.renderJSLinks(context);
View Full Code Here

        String clientId = getClientId(context);
        Rendering.renderHiddenField(writer, clientId, scrollPosStr);

        String scrollableComponentId = Components.referenceIdToClientId(context, this, getFor());

        ScriptBuilder buf = new ScriptBuilder();
        buf.initScript(context, this, "O$.initScrollPosition",
                getAutoSaveScrollPos(),
                scrollableComponentId);

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

    }

    @Override
    public void encodeBegin(FacesContext context) throws IOException {
        ScriptBuilder scriptBuilder = new ScriptBuilder();
        scriptBuilder.initScript(context, this, "O$.KeepVisible._init",
                (getForElement() != null) ? getForElement() : getFor(),
                getTopMargin(),
                getBottomMargin());

        Rendering.renderInitScript(context, scriptBuilder,
View Full Code Here

        String clientId = getClientId(context);
        Rendering.renderHiddenField(writer, clientId, componentId);

        Rendering.renderInitScript(context,
                new ScriptBuilder().initScript(context, this, "O$.initFocus", getAutoSaveFocus()).semicolon(),
                Resources.utilJsURL(context));
    }
View Full Code Here

        Action action = (Action) ouiClientAction;

        if (action.isDisabled()) {
            return null;
        }
        ScriptBuilder buf = new ScriptBuilder();

        buf.functionCall("O$._submitAction", action.getId(), extractActionStr(action, "action"), extractActionStr(action, "listener"));
        return buf.toString();
    }
View Full Code Here

TOP

Related Classes of org.openfaces.util.ScriptBuilder

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.