Package org.openfaces.util

Examples of org.openfaces.util.ScriptBuilder


    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


        final List<BaseColumn> allColumns = table.getAllColumns();
        final List<String> allColumnsIds = new ArrayList<String>(allColumns.size());
        for (BaseColumn each : allColumns) {
            allColumnsIds.add(each.getId());
        }
        Rendering.renderInitScript(context, new ScriptBuilder().initScript(context,
                component, "O$.ColumnMenu._initColumnVisibilityMenu", table, allColumnsIds),
                AbstractTableRenderer.getTableJsURL(context));
        cvm.getChildren().clear();
    }
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        MenuItem menuItem = (MenuItem) component;
        if (menuItem.getValue() == null)
            menuItem.setValue("Remove from Grouping");
        menuItem.setOnclick(new ScriptBuilder().functionCall("O$.ColumnMenu._removeFromGrouping",
                getTable("<o:sortDescendingMenuItem>", menuItem)).toString());
        if (menuItem.getIconUrl() == null)
            menuItem.setIconUrl(Resources.internalURL(
                    context, null, "table/removeFromGrouping.png", false));
        super.encodeBegin(context, component);
View Full Code Here

        Ajax ajax = (Ajax) action;

        if (ajax.isDisabled()) {
            return null;
        }
        ScriptBuilder buf = new ScriptBuilder();
        String onevent = ajax.getOnevent();
        if (onevent != null) {
            buf.append(onevent);
            buf.semicolon();
        }

        final String id = ajax.getId();
        AjaxInitializer ajaxInitializer = new AjaxInitializer() {
            @Override
            protected Object getAjaxComponentParam(FacesContext context, OUICommand ajax) {
                return new RawScript("O$._actionIds['" + id + "']");
            }

            @Override
            protected Object getExecuteParam(FacesContext context, OUICommand ajax, Iterable<String> execute) {
                return new RawScript("O$._executeIds['" + id + "']");
            }
        };

        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

        }
        if (renderedMessages.contains(message))
            return new RawScript("");
        renderedMessages.add(message);

        return new ScriptBuilder().functionCall("O$.addMessageById",
                clientId,
                message.getSummary(),
                message.getDetail(),
                getMessageSeverity(message)).semicolon();
    }
View Full Code Here

    }

    public static Script getScriptAddGlobalMessage(FacesMessage message) {
        if (message == null)
            return null;
        return new ScriptBuilder().functionCall("O$.addGlobalMessage",
                message.getSummary(),
                message.getDetail(),
                getMessageSeverity(message)).semicolon();
    }
View Full Code Here

        return true;
    }

    private void renderInitScript(FacesContext context) throws IOException {
        boolean useDisplayNoneByDefault = getUseDisplayNoneByDefault();
        Script initScript = new ScriptBuilder().initScript(context, this, "O$.Popup._init",
                useDisplayNoneByDefault).semicolon();
        Rendering.renderInitScript(context, initScript,
                Resources.utilJsURL(context),
                Resources.internalURL(context, "popup.js"));
    }
View Full Code Here

        writer.writeAttribute("style", styleBuilder.toString(), null);
        writer.writeText(weightFormat.format(getWeight()), null);
        writer.endElement("span");

        Script initScript = new ScriptBuilder().initScript(context, this, "O$.TagCloudItem._init",
                styleClass,
                rolloverStyleClass,
                tagCloud.getClientId(context),
                tagCloud.getStyle(),
                tagCloud.getStyleClass()
View Full Code Here

                getValidatorUtilJsUrl(context));
    }

    public static void renderPresentationExistsForComponent(String componentClientId, FacesContext context) throws IOException {
        Rendering.renderInitScript(context,
                new ScriptBuilder().functionCall("O$._presentationExistsForComponent", componentClientId).semicolon(),
                Resources.utilJsURL(context),
                getValidatorUtilJsUrl(context));
    }
View Full Code Here

        Styles.renderStyleClasses(context, messageComponent);
    }

    private Script getClientScript(FacesContext context, UIComponent messageComponent, String css) {
        String messageClientId = messageComponent.getClientId(context);
        return new ScriptBuilder().functionCall("O$.addMessagesRenderer", new NewInstanceScript("O$._MessagesRenderer",
                messageClientId,
                getTitle(messageComponent),
                isTooltip(messageComponent),
                isShowSummary(messageComponent),
                isShowDetail(messageComponent),
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.