Package com.vaadin.client.ui.VAccordion

Examples of com.vaadin.client.ui.VAccordion.StackItem


        /*
         * Render content after all tabs have been created and we know how large
         * the content area is
         */
        if (getWidget().selectedItemIndex >= 0) {
            StackItem selectedItem = getWidget().getStackItem(
                    getWidget().selectedItemIndex);

            getWidget().open(getWidget().selectedItemIndex);

            ComponentConnector contentConnector = getChildComponents().get(0);
            if (contentConnector != null) {
                selectedItem.setContent(contentConnector.getWidget());
            }
        } else if (getWidget().getOpenStackItem() != null) {
            getWidget().close(getWidget().getOpenStackItem());
        }
        getLayoutManager().setNeedsVerticalLayout(this);
View Full Code Here


        /* Accordion does not render its children's captions */
    }

    @Override
    public void layout() {
        StackItem openTab = getWidget().getOpenStackItem();
        if (openTab == null) {
            return;
        }

        // WIDTH
        if (!isUndefinedWidth()) {
            openTab.setWidth("100%");
        } else {
            int maxWidth = 40;
            for (StackItem si : getWidget().getStackItems()) {
                int captionWidth = si.getCaptionWidth();
                if (captionWidth > maxWidth) {
                    maxWidth = captionWidth;
                }
            }
            int widgetWidth = openTab.getWidgetWidth();
            if (widgetWidth > maxWidth) {
                maxWidth = widgetWidth;
            }
            openTab.setWidth(maxWidth);
        }

        // HEIGHT
        if (!isUndefinedHeight()) {
            int usedPixels = 0;
            for (StackItem item : getWidget().getStackItems()) {
                if (item == openTab) {
                    usedPixels += item.getCaptionHeight();
                } else {
                    // This includes the captionNode borders
                    usedPixels += Util.getRequiredHeight(item.getElement());
                }
            }
            int rootElementInnerHeight = getLayoutManager().getInnerHeight(
                    getWidget().getElement());
            int spaceForOpenItem = rootElementInnerHeight - usedPixels;

            if (spaceForOpenItem < 0) {
                spaceForOpenItem = 0;
            }

            openTab.setHeight(spaceForOpenItem);
        } else {
            openTab.setHeightFromWidget();
        }
    }
View Full Code Here

TOP

Related Classes of com.vaadin.client.ui.VAccordion.StackItem

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.