Package org.openfaces.component.select

Examples of org.openfaces.component.select.TabPlacement


        ResponseWriter writer = context.getResponseWriter();
        TabSet tabSet = (TabSet) component;
        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");
View Full Code Here


        writer.endElement("td");
        writer.endElement("tr");
    }

    private String getEmptySpaceClasses(TabSet tabSet, FacesContext context) {
        TabPlacement placement = getTabPlacement(tabSet);

        String borderStyle = tabSet.getFrontBorderStyle();
        String style = tabSet.getEmptySpaceStyle();
        if (borderStyle != null && borderStyle.length() > 0) {
            if (style == null) {
                style = "";
            }
            style += " border-" + placement.getOppositeValue() + ": " + borderStyle + ";";
        }
        String defaultClass = DEFAULT_EMPTY_SPACE_CLASS_PREFIX + placement;
        return Styles.getCSSClass(context, tabSet, style, defaultClass, tabSet.getEmptySpaceClass());
    }
View Full Code Here

        String defaultClass = DEFAULT_EMPTY_SPACE_CLASS_PREFIX + placement;
        return Styles.getCSSClass(context, tabSet, style, defaultClass, tabSet.getEmptySpaceClass());
    }

    private TabPlacement getTabPlacement(TabSet tabSet) {
        TabPlacement placement = tabSet.getPlacement();
        if (placement == null) {
            placement = TabPlacement.TOP;
        }
        return placement;
    }
View Full Code Here

        Rendering.renderHiddenField(writer,
                component.getClientId(context) + SELECTED_INDEX_SUFFIX,
                String.valueOf(selectedIndex));

        TabPlacement placement = tabSet.getPlacement();
        if (placement == null) {
            placement = TabPlacement.TOP;
        }

        List<Object> borderSideNames = borderNames.getListWithFirst(placement, -1);
        String borderMask = "border-{0}: {4}; border-{1}: {4}; border-{2}: {4}; border-{3}: {5};";
        String frontBorderClass = FRONT_BORDER_CLASS_PREFIX + placement;

        int gapWidth = tabSet.getGapWidth();
        boolean hasGap = gapWidth > 0;

        String borderMaskPre;
        if (hasGap) {
            borderMaskPre = "border-{0}: {4}; border-{1}: {4}; border-{2}: {4}; border-{3}: {5};";
        } else {
            borderMaskPre = "border-{0}: {4}; border-{1}: {4}; border-{2}: 0px; border-{3}: {5};";
        }

        String backBorderClassPre = BACK_BORDER_CLASS_PREFIX + placement;

        String borderMaskPost;
        if (hasGap) {
            borderMaskPost = borderMaskPre;
        } else {
            borderMaskPost = "border-{0}: 0px;border-{1}: {4};border-{2}: {4};border-{3}: {5};";
        }
        String backBorderClassPost = backBorderClassPre;

        String frontBorderStyle = tabSet.getFrontBorderStyle();
        boolean frontBorderDefined = frontBorderStyle != null && frontBorderStyle.length() > 0;
        if (frontBorderDefined) {
            String frontBorder = formatBorderClassString(borderMask, borderSideNames, frontBorderStyle, "0px");
            frontBorderClass = Styles.getCSSClass(context, tabSet, frontBorder, frontBorderClass);
        }

        String backBorderStyle = tabSet.getBackBorderStyle();
        boolean backBorderDefined = backBorderStyle != null && backBorderStyle.length() > 0;
        if (backBorderDefined || frontBorderDefined) {
            String backBorderPre = formatBorderClassString(borderMaskPre, borderSideNames, backBorderStyle, frontBorderStyle);
            backBorderClassPre = Styles.getCSSClass(context, tabSet, backBorderPre, backBorderClassPre);

            String backBorderPost = formatBorderClassString(borderMaskPost, borderSideNames, backBorderStyle, frontBorderStyle);
            backBorderClassPost = Styles.getCSSClass(context, component, backBorderPost);
        }

        String defaultClass = DEFAULT_CLASS_PREFIX + placement;
        /**/
        String tabClass = Styles.getCSSClass(context, component, tabSet.getTabStyle(), defaultClass, tabSet.getTabClass());
        String defaultRolloverClass = DEFAULT_ROLLOVER_CLASS_PREFIX + placement;
        String rolloverClass = Styles.getCSSClass(context, component, tabSet.getRolloverTabStyle(), StyleGroup.rolloverStyleGroup(), tabSet.getRolloverTabClass(), defaultRolloverClass);
        String defaultSelectedClass = DEFAULT_SELECTED_STYLE.format(new Object[]{placement});
        String selectedClass = Styles.getStyleClassesStr(context, component, tabSet.getSelectedTabStyle(), tabSet.getSelectedTabClass(), defaultSelectedClass, StyleGroup.selectedStyleGroup());
        String defaultSelectedRolloverClass = DEFAULT_SELECTED_ROLLOVER_CLASS_PREFIX + placement.toString();
        String selectedRolloverClass = Styles.getCSSClass(context, component, tabSet.getRolloverSelectedTabStyle(), StyleGroup.selectedStyleGroup(1), tabSet.getRolloverSelectedTabClass(), defaultSelectedRolloverClass);
        String focusedTabClass = Styles.getStyleClassesStr(context, component, tabSet.getFocusedTabStyle(), tabSet.getFocusedTabClass(), null, StyleGroup.selectedStyleGroup(2));
        /// focus area style
        String defaultFocusedClass = Styles.getCSSClass(context, component, Rendering.DEFAULT_FOCUSED_STYLE, StyleGroup.selectedStyleGroup(1));
        String focusAreaClass = Styles.getCSSClass(context, component, tabSet.getFocusAreaStyle(),
View Full Code Here

        Rendering.writeComponentClassAttribute(writer, tabbedPane);

        Rendering.writeStandardEvents(writer, tabbedPane);

        TabPlacement tabPlacement = getTabPlacement(tabbedPane);

        boolean horizontalPlacement = TabPlacement.LEFT.equals(tabPlacement) || TabPlacement.RIGHT.equals(tabPlacement);
        boolean paneFirst = TabPlacement.RIGHT.equals(tabPlacement) || TabPlacement.BOTTOM.equals(tabPlacement);
        writer.startElement("tr", tabbedPane);
        writer.startElement("td", tabbedPane);
View Full Code Here

        writer.endElement("tr");
        writer.endElement("table");
    }

    private TabPlacement getTabPlacement(TabbedPane tabbedPane) {
        TabPlacement tabPlacement = tabbedPane.getTabPlacement();
        if (tabPlacement == null)
            tabPlacement = TabPlacement.TOP;
        return tabPlacement;
    }
View Full Code Here

    private void encodeTabSet(FacesContext context, TabbedPane tabbedPane, List<SubPanel> subPanels,
                              boolean isMirrorTabSet)
            throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        List<Integer> disabledPanels = new ArrayList<Integer>();
        TabPlacement tabPlacement = getTabPlacement(tabbedPane);
        boolean verticalPlacement = TabPlacement.LEFT.equals(tabPlacement) || TabPlacement.RIGHT.equals(tabPlacement);
        if (verticalPlacement) {
            writeAttribute(writer, "height", "100%");
        }
        TabSet innerTabSet;
View Full Code Here

        TabSetItems items = (TabSetItems) innerTabSet.getChildren().get(0);
        items.setValue(tabs);

        innerTabSet.setGapWidth(tabbedPane.getTabGapWidth());

        TabPlacement tabPlacement = getTabPlacement(tabbedPane);
        boolean verticalPlacement = TabPlacement.LEFT.equals(tabPlacement) || TabPlacement.RIGHT.equals(tabPlacement);
        innerTabSet.setStyle(verticalPlacement ? "height: 100%" : "width: 100%");

        innerTabSet.setSelectedIndex(getSelectedIndex(tabbedPane, subPanels));
        innerTabSet.setAlignment(tabbedPane.getTabAlignment());
View Full Code Here

TOP

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

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.