Package org.openfaces.component.command

Examples of org.openfaces.component.command.PopupMenu


            rowGroups.add(parentRowGroup);
            addContainingRowGroupsForThisRow(rowGroups, parentGroupRowInfo);
        }

        private PopupMenu getMenuWithFunctions(FacesContext context, List<SummaryFunction> applicableFunctions) {
            PopupMenu popupMenu = null;
            UIComponent popupMenuContainer = getPopupMenuContainer(context);
            List<UIComponent> children = popupMenuContainer.getChildren();
            final String summaryFunctionsAttribute = "_summaryFunctions";
            for (UIComponent child : children) {
                PopupMenu m = (PopupMenu) child;
                List<SummaryFunction> summaryFunctions = (List<SummaryFunction>) m.getAttributes().get(summaryFunctionsAttribute);
                if (applicableFunctions.equals(summaryFunctions)) {
                    popupMenu = m;
                }
            }
View Full Code Here


        public void encodeAfterCalculation(FacesContext context) throws IOException {
            UsageContext usageContext = getUsageContext();
            if (!usageContext.isApplicableInThisContext()) return;

            MenuItem selectedMenuItem = null;
            PopupMenu popupMenu;
            if (getSummary().getFunctionEditable()) {
                List<SummaryFunction> applicableFunctions = usageContext.getApplicableFunctions();
                popupMenu = getMenuWithFunctions(context, applicableFunctions);
                encodePopupMenu(context, popupMenu);

                SummaryFunction currentFunction = usageContext.getFunction();
                String currentFunctionName = currentFunction.getName();
                List<UIComponent> children = popupMenu.getChildren();
                for (UIComponent child : children) {
                    if (!(child instanceof MenuItem)) continue;
                    MenuItem menuItem = (MenuItem) child;
                    String functionName = (String) child.getAttributes().get(ATTR_FUNCTION_NAME);
                    if (functionName.equals(currentFunctionName)) {
View Full Code Here

        writer.startElement("tr", table);
        button.encodeAll(context);
        writer.endElement("tr");
        writer.endElement("table");

        PopupMenu columnMenu = (PopupMenu) component;
        columnMenu.setStandalone(true);
        columnMenu.encodeAll(context);

        // todo: move item identification responsibility to the items themselves
        MenuItem sortAscMenuItem = null, sortDescMenuItem = null, hideColumnMenuItem = null,
                groupByColumnMenuItem = null, removeFromGroupingMenuItem = null, cancelGroupingMenuItem = null,
                resetSortingMenuItem = null;
        for (UIComponent child : columnMenu.getChildren()) {
            if (child instanceof SortAscendingMenuItem)
                sortAscMenuItem = (MenuItem) child;
            else if (child instanceof SortDescendingMenuItem)
                sortDescMenuItem = (MenuItem) child;
            else if (child instanceof HideColumnMenuItem)
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered()) return;

        PopupMenu popupMenu = (PopupMenu) component;
        ResponseWriter writer = context.getResponseWriter();

        String styleClass = Styles.getCSSClass(context, popupMenu, popupMenu.getStyle(), StyleGroup.regularStyleGroup(),
                popupMenu.getStyleClass(), DEFAULT_CLASS/* + " " + DefaultStyles.getPopupMenuBackgroundColorClass()*/);

        writer.startElement("ul", popupMenu);
        writeAttribute(writer, "id", popupMenu.getClientId(context));

        Rendering.writeStandardEvents(writer, popupMenu);
        writeAttribute(writer, "class", styleClass);
    }
View Full Code Here

    @Override
    public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
        super.encodeEnd(facesContext, component);
        if (!component.isRendered()) return;

        PopupMenu popupMenu = (PopupMenu) component;

        ResponseWriter writer = facesContext.getResponseWriter();

        writer.endElement("ul");
View Full Code Here

        JSONObject eventsObj = new JSONObject();
        Rendering.addJsonParam(eventsObj, "onhide", popupMenu.getOnhide());
        Rendering.addJsonParam(eventsObj, "onshow", popupMenu.getOnshow());

        boolean isRootMenu = !(popupMenu.getParent() instanceof MenuItem);
        PopupMenu rootPopupMenu = getRootPopupMenu(popupMenu);
        String event = Rendering.getEventWithOnPrefix(context, popupMenu, "o:popupMenu");
        ScriptBuilder initScript = new ScriptBuilder();
        initScript.initScript(context, popupMenu, "O$.PopupMenu._init",
                Rendering.getRolloverClass(context, popupMenu),
                forId,
                event,
                popupMenu.isIndentVisible(),
                indentClass,
                defaultItemClass,
                defaultSelectedClass,
                defaultContentClass,
                defaultDisabledClass,

                popupMenu.getItemIconUrl(),
                popupMenu.getDisabledItemIconUrl(),
                popupMenu.getSelectedItemIconUrl(),
                popupMenu.getSelectedDisabledItemIconUrl(),

                submenuImageUrl,
                disabledSubmenuImageUrl,
                selectedSubmenuImageUrl,
                popupMenu.getSelectedDisabledSubmenuImageUrl(),

                isRootMenu,
                getMenuItemParameters(popupMenu),
                popupMenu.getSubmenuHorizontalOffset(),

                rootPopupMenu.getSubmenuShowDelay(),
                rootPopupMenu.getSubmenuHideDelay(),
                rootPopupMenu.isSelectDisabledItems(),

                eventsObj);

        Styles.renderStyleClasses(context, popupMenu);
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {

        MenuItem menuItem = (MenuItem) component;
        ResponseWriter writer = context.getResponseWriter();
        PopupMenu popupMenu = (PopupMenu) menuItem.getParent();

        writer.startElement("li", menuItem);
        writeAttribute(writer, "class", DEFAULT_LIST_ITEM_CLASS);
        writeAttribute(writer, "id", menuItem.getClientId(context));

        renderStartMenuItemSpan(context, menuItem, writer);

        renderStyleClass(context, menuItem, writer);

        addSelectedStyleClass(context, menuItem);

        renderMenuItemImage(context, menuItem, writer, popupMenu);
        //content span
        writer.startElement("span", menuItem);
        writeAttribute(writer, "id", menuItem.getClientId(context) + SPAN_SUFIX);

        String contentClass = Styles.getCSSClass(context, menuItem, menuItem.getContentAreaStyle(), StyleGroup.regularStyleGroup(),
                menuItem.getContentAreaClass(), Styles.getCSSClass(context, popupMenu, popupMenu.getItemContentStyle(), StyleGroup.regularStyleGroup(),
                        popupMenu.getItemContentClass(), DEFAULT_CONTENT_CLASS));

        writeAttribute(writer, "class", contentClass);

        renderContentStyleClass(context, menuItem, writer);
View Full Code Here

    private void encodeChartMenuSupport(FacesContext context, Chart chart, DynamicImage dynamicImage,
                                        ScriptBuilder buf) throws IOException {
        UIComponent component = chart.getChartMenu();
        if (component == null) return;

        PopupMenu chartMenu = (PopupMenu) component;
        chartMenu.encodeAll(context);

        buf.initScript(context, chartMenu, "O$.ChartMenu._init", chart, dynamicImage.getClientId(context));
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.command.PopupMenu

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.