Package org.openfaces.component.panel

Examples of org.openfaces.component.panel.SidePanel


    public static final String SIDE_PANEL_UTIL_JS = "panel/sidePanelUtil.js";

    @Override
    public void decode(FacesContext context, UIComponent component) {
        SidePanel sidePanel = (SidePanel) component;
        String clientId = sidePanel.getClientId(context);
        String key = clientId + "state";
        String value = context.getExternalContext().getRequestParameterMap().get(key);
        if (value == null)
            return;
        int index = value.indexOf(';');
        String size = value.substring(0, index);
        String collapsed = value.substring(index + 1);
        sidePanel.setSize(size);
        sidePanel.setCollapsed(Boolean.valueOf(collapsed));
    }
View Full Code Here


    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered()) return;
        super.encodeBegin(context, component);
        ResponseWriter writer = context.getResponseWriter();
        SidePanel sidePanel = (SidePanel) component;
        String clientId = sidePanel.getClientId(context);
        writer.startElement("div", sidePanel);
        writer.writeAttribute("id", clientId, null);
        writer.writeAttribute("class", "o_sidepanel_container o_sidepanel_container_" + sidePanel.getAlignment().toString(), null);

        //splitter
        writer.startElement("div", sidePanel);
        writer.writeAttribute("id", clientId + SPLITTER_SUFFIX, null);
        String splitterDefaultClass = Styles.getCSSClass(context,
                sidePanel, sidePanel.getSplitterStyle(),
                "o_sidepanel_splitter o_sidepanel_splitter_" + sidePanel.getAlignment().toString(), sidePanel.getSplitterClass()
        );
        writer.writeAttribute("class", splitterDefaultClass, null);
        writer.endElement("div");

        //panel
        writer.startElement("div", sidePanel);
        writer.writeAttribute("id", clientId + PANEL_SUFFIX, null);
        Rendering.writeStandardEvents(writer, sidePanel);
        String panelDefaultClass = Styles.getCSSClass(context,
                sidePanel, sidePanel.getStyle(),
                "o_sidepanel_panel o_sidepanel_panel_" + sidePanel.getAlignment().toString(), sidePanel.getStyleClass()
        );
        writer.writeAttribute("class", panelDefaultClass, null);
        UIComponent captionFacet = sidePanel.getCaptionFacet();
        String caption = sidePanel.getCaption();
        if (captionFacet != null || caption != null) {
            writer.startElement("div", sidePanel);
            writer.writeAttribute("id", clientId + CAPTION_SUFFIX, null);
            panelDefaultClass = Styles.getCSSClass(context,
                    sidePanel, sidePanel.getCaptionStyle(),
                    "o_sidepanel_caption", sidePanel.getCaptionClass()
            );
            writer.writeAttribute("class", panelDefaultClass, null);
            if (captionFacet != null)
                captionFacet.encodeAll(context);
            else
                writer.writeText(caption, null);
            writer.endElement("div");
        }

        //content
        writer.startElement("div", sidePanel);
        writer.writeAttribute("id", clientId + CONTENT_SUFFIX, "id");
        String contentDefaultClass = Styles.getCSSClass(context,
                sidePanel, sidePanel.getContentStyle(),
                "o_sidepanel_content", sidePanel.getContentClass()
        );
        writer.writeAttribute("class", contentDefaultClass, null);

        encodeInitScript(context, component);
    }
View Full Code Here

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

        SidePanel sidePanel = (SidePanel) component;
        if (sidePanel.getFacet("content") != null) {
            sidePanel.getFacet("content").encodeAll(context);
        } else {
            List<UIComponent> children = component.getChildren();
            Rendering.renderComponents(context, children);
        }
    }
View Full Code Here

            Rendering.renderComponents(context, children);
        }
    }

    private void encodeInitScript(FacesContext context, UIComponent component) throws IOException {
        SidePanel sidePanel = (SidePanel) component;
        String clientId = sidePanel.getClientId(context);

        JSEventsObject events = new JSEventsObject();
        events.putOpt("onsplitterdrag", sidePanel.getOnsplitterdrag());
        events.putOpt("oncollapse", sidePanel.getOncollapse());
        events.putOpt("onrestore", sidePanel.getOnrestore());
        events.putOpt("onmaximize", sidePanel.getOnmaximize());

        ScriptBuilder initScript = new ScriptBuilder();
        if (Environment.isMozillaFF2(context)) { //fix bug with FF2 and Facelets 1.2 context  //todo add isFacelets() filter
            initScript.append("O$('").append(clientId).append("').style.visibility = 'hidden';\n");
            initScript.append("O$.addLoadEvent( function() {\n");
        }

        initScript.initScript(context, sidePanel, "O$._initSidePanel",
                sidePanel.getAlignment(),
                sidePanel.getSize(),
                sidePanel.getMinSize(),
                sidePanel.getMaxSize(),
                sidePanel.isCollapsible(),
                sidePanel.isResizable(),
                sidePanel.getCollapsed(),
                getRolloverClass(context, sidePanel),
                getSplitterRolloverClass(context, sidePanel),
                new RawScript(events.toString()));

        if (Environment.isMozillaFF2(context)) { //fix bug with FF2 and Facelets 1.2 context  //todo add isFacelets() filter
View Full Code Here

TOP

Related Classes of org.openfaces.component.panel.SidePanel

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.