Package org.openfaces.component.select

Examples of org.openfaces.component.select.TabAlignment


        List<UIComponent> tabChildren = tabSet.getChildren();

        TabPlacement tabPlacement = getTabPlacement(tabSet);
        boolean verticalTabs = tabPlacement.equals(TabPlacement.LEFT) || tabPlacement.equals(TabPlacement.RIGHT);

        TabAlignment tabAlign = tabSet.getAlignment();
        if (tabAlign == null) {
            tabAlign = TabAlignment.TOP_OR_LEFT;
        }

        List<Object> tabItems = getTabItems(tabSet);

        String emptySpaceClasses = getEmptySpaceClasses(tabSet, context);

        if (!verticalTabs) {
            writer.startElement("tr", tabSet);
            if (tabAlign.equals(TabAlignment.BOTTOM_OR_RIGHT)) {
                insertHorizontalSpacer(context, tabSet, emptySpaceClasses);
            }
        } else if (tabAlign.equals(TabAlignment.BOTTOM_OR_RIGHT)) {
            insertVerticalSpacer(context, tabSet, emptySpaceClasses);
        }

        String idPrefix = tabSet.getClientId(context) + Rendering.CLIENT_ID_SUFFIX_SEPARATOR;
        int gapWidth = tabSet.getGapWidth();

        int allTabCount = tabItems.size();
        List<Object> renderedTabItems = new ArrayList<Object>(allTabCount);
        int[] originalTabIndexes = new int[allTabCount];
        for (int i = 0, tabsAdded = 0; i < allTabCount; i++) {
            Object item = tabItems.get(i);
            if (isItemRendered(item)) {
                renderedTabItems.add(item);
                originalTabIndexes[tabsAdded++] = i;
            }
        }
        for (int i = 0, tabCount = renderedTabItems.size(); i < tabCount; i++) {

            Object item = renderedTabItems.get(i);
            if (!isItemRendered(item))
                continue;

            if (gapWidth > 0) {
                if (TabAlignment.TOP_OR_LEFT.equals(tabAlign)) {
                    if (verticalTabs) {
                        writeVerticalGap(writer, tabSet, gapWidth, emptySpaceClasses);
                    } else {
                        writeHorizontalGap(writer, tabSet, gapWidth, emptySpaceClasses);
                    }
                }
            }

            if (verticalTabs) {
                writer.startElement("tr", tabSet);
            }

            writer.startElement("td", tabSet);

            String attr = verticalTabs ? "align" : "valign";
            writer.writeAttribute(attr, tabPlacement.toString(), null);

            //        writer.startElement("div", tabSet);
            int absoluteTabIndex = originalTabIndexes[i];
            writer.writeAttribute("id", idPrefix + absoluteTabIndex, "id");

            if (tabSet.isFocusable()) {
                writer.startElement("div", tabSet);
                String defaultFocusedClass = Styles.getCSSClass(context, component,
                        !Environment.isExplorer6() ? "border: 1px solid transparent;" : "", StyleGroup.selectedStyleGroup(1));
                writer.writeAttribute("class", defaultFocusedClass, null);
            }
            /*...............*/
            if (item instanceof String) {
                writer.writeText(item, null);
            } else if (item instanceof UIComponent) {
                ((UIComponent) item).encodeAll(context);
            } else if (item != null) {
                writer.writeText(item.toString(), null);
            }
            /*                      */
            if (tabSet.isFocusable()) {
                writer.endElement("div");
            }
            //        writer.endElement("div");

            if (i == (tabCount - 1)) {
                encodeScriptsAndStyles(context, component);
            }

            writer.endElement("td");
            if (verticalTabs) {
                writer.endElement("tr");
            }

            if (gapWidth > 0) {
                if (TabAlignment.BOTTOM_OR_RIGHT.equals(tabAlign)) {
                    if (verticalTabs) {
                        writeVerticalGap(writer, tabSet, gapWidth, emptySpaceClasses);
                    } else {
                        writeHorizontalGap(writer, tabSet, gapWidth, emptySpaceClasses);
                    }
                }
            }
        }

        if (!verticalTabs) {
            if (tabAlign.equals(TabAlignment.TOP_OR_LEFT)) {
                insertHorizontalSpacer(context, tabSet, emptySpaceClasses);
            }
            writer.endElement("tr");
        } else if (tabAlign.equals(TabAlignment.TOP_OR_LEFT)) {
            insertVerticalSpacer(context, tabSet, emptySpaceClasses);
        }
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.select.TabAlignment

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.