Package org.openfaces.component

Examples of org.openfaces.component.CaptionButton


        if (temporaryButton)
            table.getFacets().remove(FACET_COLUMN_MENU_BUTTON);
    }

    private CaptionButton createDefaultColumnMenuButton(FacesContext context) {
        CaptionButton captionButton = new CaptionButton();
        captionButton.setId("_columnMenuButton" + Rendering.SERVER_ID_SUFFIX_SEPARATOR);
        captionButton.setImageUrl(getDefaultColumnMenuBtnImage(context));
        return captionButton;
    }
View Full Code Here


    public static final String ATTR_DEFAULT_STYLE_CLASS = "_defaultStyleClass";

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered()) return;
        CaptionButton btn = (CaptionButton) component;
        ResponseWriter writer = context.getResponseWriter();

        writer.startElement("td", btn);
        Rendering.writeComponentClassAttribute(writer, btn, getDefaultStyleClass(btn));
        writeIdAttribute(context, btn);
        boolean ajaxJsRequired = writeEventsWithAjaxSupport(context, writer, btn);
        if (ajaxJsRequired)
            btn.getAttributes().put("_ajaxRequired", Boolean.TRUE);

        writer.startElement("img", btn);
        String hint = btn.getHint();
        if (hint != null && hint.length() > 0) {
            writeAttribute(writer, "title", hint);
        }

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

        if (buttonComponent != null && !(buttonComponent instanceof CaptionButton))
            throw new FacesException(
                    "The component inside of \"" + FACET_COLUMN_MENU_BUTTON + "\" facet must be a CaptionButton or descendant component, " +
                            "though the following component was found: " + buttonComponent.getClass().getName() +
                            ". table id: \"" + table.getClientId(context) + "\"");
        CaptionButton button = (CaptionButton) buttonComponent;
        boolean temporaryButton = false;
        if (button == null) {
            button = createDefaultColumnMenuButton(context);
            temporaryButton = true;
            table.getFacets().put(FACET_COLUMN_MENU_BUTTON, button);
        }
        if (button.getImageUrl() == null)
            button.setImageUrl(getDefaultColumnMenuBtnImage(context));

        button.getAttributes().put(CaptionButtonRenderer.ATTR_DEFAULT_STYLE_CLASS, "o_columnMenuInvoker");

        // Rendering captionButton.js in this place of the generated HTML markup is required for fixing OF-69.
        // The reason is that IE cannot find the <script> tag for captionButton.js via the getElementsByTagName("script")
        // call in O$._markPreloadedLibraries (this <script> entry is just missing in this case, which seems to be some
        // IE bug) -- the result prior to fix was that ajaxUtil waited for captionButton.js to load indefinitely and failed
        // to invoke initialization scripts. Rendering captionButton.js in a less "deep" place of DOM solves the problem.
        Resources.renderJSLinkIfNeeded(context, Resources.utilJsURL(context));
        Resources.renderJSLinkIfNeeded(context, Resources.internalURL(context, "captionButton.js"));

        ResponseWriter writer = context.getResponseWriter();
        // mock table/tr enclosing tags must be rendered for IE8 to process the button's td tag properly
        writer.startElement("table", table);
        writer.startElement("tr", table);
        button.encodeAll(context);
        writer.endElement("tr");
        writer.endElement("table");

        PopupMenu columnMenu = (PopupMenu) component;
        columnMenu.setStandalone(true);
View Full Code Here

TOP

Related Classes of org.openfaces.component.CaptionButton

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.