Package org.openfaces.component.panel

Examples of org.openfaces.component.panel.FoldingPanel


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

        FoldingPanel foldingPanel = (FoldingPanel) component;
        ResponseWriter writer = context.getResponseWriter();
        if (!foldingPanel.isExpanded() && (foldingPanel.getLoadingMode().equals(LoadingMode.AJAX_LAZY) ||
                                           foldingPanel.getLoadingMode().equals(LoadingMode.AJAX_ALWAYS))) {
            AjaxUtil.prepareComponentForAjax(context, component);
        }
        writer.startElement("table", foldingPanel);

        writeIdAttribute(context, foldingPanel);
        Rendering.writeComponentClassAttribute(writer, foldingPanel, "o_folding_panel");
        writer.writeAttribute("cellpadding", "0", null);
        writer.writeAttribute("border", "0", null);
        writer.writeAttribute("cellspacing", "0", null);
        Rendering.writeStandardEvents(writer, foldingPanel);
        writer.startElement("tr", foldingPanel);
        writer.startElement("td", foldingPanel);
        List<CaptionArea> captionAreas = getCaptionAreas(foldingPanel);
        for (CaptionArea captionArea : captionAreas) {
            List<ExpansionToggleButton> expansionToggleButtons = Components.findChildrenWithClass(captionArea, ExpansionToggleButton.class);
            for (ExpansionToggleButton expansionToggleButton : expansionToggleButtons) {
                prepareToggleButton(foldingPanel, expansionToggleButton);
            }
        }

        FoldingDirection foldingDirection = foldingPanel.getFoldingDirection();
        if (!FoldingDirection.UP.equals(foldingDirection)) {
            renderCaption(context, foldingPanel);

            writer.endElement("td");
            writer.endElement("tr");
View Full Code Here


        String value = context.getExternalContext().getRequestParameterMap().get(key);
        if (value == null)
            return;

        boolean newExpanded = Boolean.valueOf(value);
        FoldingPanel panel = (FoldingPanel) component;
        if (panel.isExpanded() != newExpanded) {
            panel.setExpanded(newExpanded);
            component.queueEvent(new StateChangeEvent(component));
        }
    }
View Full Code Here

    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        if (AjaxUtil.getSkipExtraRenderingOnPortletsAjax(context))
            return;

        ResponseWriter writer = context.getResponseWriter();
        FoldingPanel panel = (FoldingPanel) component;
        FoldingDirection foldingDirection = panel.getFoldingDirection();
        if (FoldingDirection.UP.equals(foldingDirection)) {
            writer.endElement("td");
            writer.endElement("tr");

            writer.startElement("tr", panel);
View Full Code Here

    }


    private void renderStateField(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        FoldingPanel foldingPanel = (FoldingPanel) component;
        String value = String.valueOf(foldingPanel.isExpanded());
        Rendering.renderHiddenField(writer, component.getClientId(context) + STATE_SUFFIX, value);
    }
View Full Code Here

        String value = String.valueOf(foldingPanel.isExpanded());
        Rendering.renderHiddenField(writer, component.getClientId(context) + STATE_SUFFIX, value);
    }

    private void renderInitScript(FacesContext context, UIComponent component) throws IOException {
        FoldingPanel foldingPanel = (FoldingPanel) component;

        LoadingMode loadingMode = foldingPanel.getLoadingMode();
        String defaultClass = Styles.getCSSClass(context, foldingPanel, Rendering.DEFAULT_FOCUSED_STYLE, StyleGroup.selectedStyleGroup(0));
        String focusedClass = Styles.getCSSClass(context,
                foldingPanel,
                foldingPanel.getFocusedStyle(), StyleGroup.selectedStyleGroup(1), foldingPanel.getFocusedClass(), defaultClass);
        String focusedContentClass = Styles.getCSSClass(context, foldingPanel,
                foldingPanel.getFocusedContentStyle(), StyleGroup.selectedStyleGroup(0), foldingPanel.getFocusedContentClass(), null);

        String focusedCaptionClass = Styles.getCSSClass(context, foldingPanel,
                foldingPanel.getFocusedCaptionStyle(), StyleGroup.selectedStyleGroup(0), foldingPanel.getFocusedCaptionClass(), null);

        String rolloverTogglableCaptionClass = Styles.getCSSClass(context, foldingPanel,
                foldingPanel.getRolloverTogglableCaptionStyle(), StyleGroup.rolloverStyleGroup(),
                foldingPanel.getRolloverTogglableCaptionClass(),
                DEFAULT_CAPTION_TOGGLABLE_ROLLOVER_CLASS);

        ScriptBuilder sb = new ScriptBuilder();
        sb.initScript(context, foldingPanel, "O$.FoldingPanel._init",
                foldingPanel.isExpanded(),
                foldingPanel.getFoldingDirection(),
                Rendering.getRolloverClass(context, foldingPanel),
                loadingMode,
                foldingPanel.isFocusable(),
                focusedClass,
                focusedContentClass,
                focusedCaptionClass,
                foldingPanel.getToggleOnCaptionClick(),
                rolloverTogglableCaptionClass);

        Rendering.renderInitScript(context, sb, Resources.utilJsURL(context),
                Resources.internalURL(context, "panel/foldingPanel.js"));
    }
View Full Code Here

                Resources.internalURL(context, "panel/foldingPanel.js"));
    }

    @Override
    protected void writeAdditionalCaptionCellContent(ResponseWriter writer, ComponentWithCaption component) throws IOException {
        FoldingPanel panel = (FoldingPanel) component;
        FoldingDirection foldingDirection = panel.getFoldingDirection();
        if (!panel.isExpanded() &&
                (FoldingDirection.LEFT.equals(panel.getFoldingDirection()) || FoldingDirection.RIGHT.equals(foldingDirection))) {
            writer.writeAttribute("style", "display: none;", null);
        }
    }
View Full Code Here

    @Override
    protected CaptionArea getDefaultButtonsArea(ComponentWithCaption component) {
        CaptionArea area = super.getDefaultButtonsArea(component);

        FoldingPanel foldingPanel = (FoldingPanel) component;
        FoldingDirection foldingDirection = foldingPanel.getFoldingDirection();
        boolean horizontalFoldingDirection =
                FoldingDirection.LEFT.equals(foldingDirection) || FoldingDirection.RIGHT.equals(foldingDirection);
        boolean buttonsOnTheLeft = horizontalFoldingDirection && FoldingDirection.RIGHT.equals(foldingDirection);
        area.setAlignment(buttonsOnTheLeft ? Side.LEFT : Side.RIGHT);
        return area;
View Full Code Here

TOP

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

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.