Package org.richfaces.sandbox.component

Examples of org.richfaces.sandbox.component.AbstractTabPanel


    @Override
    protected void doEncodeBegin(ResponseWriter w, FacesContext context, UIComponent component) throws IOException {
        super.doEncodeBegin(w, context, component);

        AbstractTabPanel tabPanel = (AbstractTabPanel) component;
        if (tabPanel.isHeaderPositionedTop()) {
            writeTabsLine(w, context, component);
            writeTabsLineSeparator(w, component);
        }
    }
View Full Code Here


        writer.endElement(DIV);
    }

    private void writeTabsLine(final ResponseWriter w, final FacesContext context, UIComponent comp) throws IOException {
        w.startElement(DIV, comp);
        final AbstractTabPanel tabPanel = (AbstractTabPanel) comp;
        if (tabPanel.isHeaderPositionedTop()) {
            w.writeAttribute(CLASS, "rf-tab-hdr-tabline-vis rf-tab-hdr-tabline-top", null);
        } else {
            w.writeAttribute(CLASS, "rf-tab-hdr-tabline-vis rf-tab-hdr-tabline-btm", null);
        }
        w.startElement("table", comp);
        w.writeAttribute(CLASS_ATTRIBUTE, "rf-tab-hdr-tabs", null);
        w.writeAttribute("cellspacing", "0", null);
        w.startElement(TBODY_ELEMENT, comp);
        w.startElement(TR_ELEMENT, comp);

        writeTopTabFirstSpacer(w, comp);


        if (tabPanel.getValue() != null) {
            try {
                DataVisitor visitor = new AbstractTogglePanelItemVisitor(tabPanel, new AbstractTogglePanelItemVisitor.TabVisitorCallback() {
                    @Override
                    public DataVisitResult visit(AbstractTogglePanelItemInterface item)
                    {
                        AbstractTab tab = (AbstractTab) item;
                        try {
                            writeTopTabHeader(context, w, tab);
                            writeTopTabSpacer(w, tabPanel);
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                        return DataVisitResult.CONTINUE;
                    }
                });
                tabPanel.walk(context, visitor, null);
            } finally {
                tabPanel.setRowKey(context, null);
            }
        } else {
            for (AbstractTogglePanelItemInterface item : ((AbstractTogglePanel) comp).getRenderedItems()) {
                AbstractTab tab = (AbstractTab) item;
                writeTopTabHeader(context, w, tab);
View Full Code Here

        w.writeText(text, null);
        w.endElement(DIV_ELEM);
    }

    private void writeTopTabFirstSpacer(ResponseWriter w, UIComponent comp) throws IOException {
        AbstractTabPanel tabPanel = (AbstractTabPanel) comp;
        if (tabPanel.isHeaderAlignedLeft()) {
            writeTopTabSpacer(w, comp, "padding-left: 5px;", "rf-tab-hdr-spcr");
        } else {
            writeTopTabSpacer(w, comp, "padding-left: 5px; width:100%", "rf-tab-hdr-spcr");
        }
    }
View Full Code Here

    private void writeTopTabSpacer(ResponseWriter w, UIComponent comp) throws IOException {
        writeTopTabSpacer(w, comp, "", "rf-tab-hdr-spcr rf-tab-hortab-tabspcr-wdh");
    }

    private void writeTopTabLastSpacer(ResponseWriter w, UIComponent comp) throws IOException {
        AbstractTabPanel tabPanel = (AbstractTabPanel) comp;
        if (tabPanel.isHeaderAlignedLeft()) {
            writeTopTabSpacer(w, comp, "padding-right: 5px; width: 100%;", "rf-tab-hdr-spcr");
        } else {
            writeTopTabSpacer(w, comp, "padding-right: 5px;", "rf-tab-hdr-spcr");
        }
    }
View Full Code Here

    }

    @Override
    protected void doEncodeEnd(final ResponseWriter writer, final FacesContext context, UIComponent component) throws IOException
    {
        final AbstractTabPanel tabPanel = (AbstractTabPanel) component;
        if (!tabPanel.isHeaderPositionedTop()) {
            writeTabsLineSeparator(writer, component);
            writeTabsLine(writer, context, component);
        }
        if (tabPanel.getValue() != null) {
            try {
                final DataVisitor visitor = new AbstractTogglePanelItemVisitor(tabPanel, new AbstractTogglePanelItemVisitor.TabVisitorCallback() {
                    @Override
                    public DataVisitResult visit(AbstractTogglePanelItemInterface item)
                    {
                        AbstractTab tab = (AbstractTab) item;
                        TabRenderer renderer = (TabRenderer) tab.getRenderer(context);
                        try {
                            renderer.writeJavaScript(writer, context, tab);
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                        return DataVisitResult.CONTINUE;
                    }
                });
                tabPanel.walk(context, visitor, null);
            } finally {
                tabPanel.setRowKey(context, null);
            }
        } else {
            if (tabPanel.getChildCount() > 0) {
                for (UIComponent child : tabPanel.getChildren()) {
                    if (child instanceof AbstractTab) {
                        AbstractTab tab = (AbstractTab) child;
                        TabRenderer renderer = (TabRenderer) tab.getRenderer(context);
                        renderer.writeJavaScript(writer, context, tab);
                    }
View Full Code Here

        Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();

        AbstractTab tab = (AbstractTab) component;
        String compClientId = component.getClientId(context);
        if (requestMap.get(compClientId) != null) {
            AbstractTabPanel parentTabPanel = getParentTabPanel(tab);

            if (parentTabPanel.isImmediate()) {
                tab.setImmediate(true);
            }
            new ActionEvent(tab).queue();

            if (context.getPartialViewContext().isPartialRequest()) {
View Full Code Here

TOP

Related Classes of org.richfaces.sandbox.component.AbstractTabPanel

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.