Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Accordion$Attributes


        return preferredHeight;
    }

    @Override
    public Dimensions getPreferredSize() {
        Accordion accordion = (Accordion)getComponent();

        int preferredHeight = 0;

        int maxPanelHeaderWidth = 0;
        for (PanelHeader panelHeader : panelHeaders) {
            Dimensions preferredSize = panelHeader.getPreferredSize();
            maxPanelHeaderWidth = Math.max(preferredSize.width, maxPanelHeaderWidth);
            preferredHeight += preferredSize.height - 1;
        }

        int maxPanelWidth = 0;
        int maxPanelHeight = 0;

        for (Component panel : accordion.getPanels()) {
            Dimensions preferredSize = panel.getPreferredSize();
            maxPanelWidth = Math.max(preferredSize.width, maxPanelWidth);
            maxPanelHeight = Math.max(maxPanelHeight, preferredSize.height);
        }
View Full Code Here


        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public void layout() {
        Accordion accordion = (Accordion)getComponent();

        int width = getWidth();
        int height = getHeight();

        int contentWidth = Math.max(width - (padding.left + padding.right + 2), 0);

        // Determine the content height
        int panelHeight = 0;
        int contentHeight = 0;

        if (selectionChangeTransition == null) {
            panelHeight = height;
            for (PanelHeader panelHeader : panelHeaders) {
                panelHeader.setSize(width, panelHeader.getPreferredHeight(width));
                panelHeight -= (panelHeader.getHeight() - 1);
            }

            panelHeight = Math.max(panelHeight - 1, 0);
            contentHeight = Math.max(panelHeight - (padding.top + padding.bottom), 0);
        } else {
            panelHeight = selectionChangeTransition.toPanel.getHeight()
                + (padding.top + padding.bottom);
        }

        // Lay out the components
        Accordion.PanelSequence panels = accordion.getPanels();

        int panelY = 0;
        for (int i = 0, n = panels.getLength(); i < n; i++) {
            Component panel = panels.get(i);

            PanelHeader panelHeader = panelHeaders.get(i);
            panelHeader.setLocation(0, panelY);
            panelY += (panelHeader.getHeight() - 1);

            if (selectionChangeTransition == null) {
                Component toPanel = accordion.getSelectedPanel();

                if (panel == toPanel) {
                    panel.setVisible(true);

                    panel.setSize(contentWidth, contentHeight);
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Accordion$Attributes

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.