Package pivot.wtk

Examples of pivot.wtk.Accordion$AccordionAttributeListenerList


            panel.getComponentStateListeners().add(panelStateListener);
        }
    }

    public void uninstall() {
        Accordion accordion = (Accordion)getComponent();

        // Remove this as a listener on the accordion
        accordion.getAccordionListeners().remove(this);
        accordion.getAccordionSelectionListeners().remove(this);
        accordion.getAccordionAttributeListeners().remove(this);

        for (PanelHeader panelHeader : panelHeaders) {
            // Stop listening for state changes on the panel
            Component panel = (Component)panelHeader.getButtonData();
            panel.getComponentStateListeners().remove(panelStateListener);

            // Remove the header
            accordion.remove(panelHeader);
        }

        super.uninstall();
    }
View Full Code Here


        super.uninstall();
    }

    public int getPreferredWidth(int height) {
        Accordion accordion = (Accordion)getComponent();

        // The preferred width is the maximum unconstrained preferred width of
        // the headers and the panels, plus border
        int maxPanelHeaderWidth = 0;
        for (PanelHeader panelHeader : panelHeaders) {
            maxPanelHeaderWidth = Math.max(panelHeader.getPreferredWidth(), maxPanelHeaderWidth);
        }

        int maxPanelWidth = 0;
        for (Component panel : accordion.getPanels()) {
            maxPanelWidth = Math.max(panel.getPreferredWidth(), maxPanelWidth);
        }

        int preferredWidth = Math.max(maxPanelHeaderWidth, maxPanelWidth
            + (padding.left + padding.right + 2));
View Full Code Here

        return preferredWidth;
    }

    public int getPreferredHeight(int width) {
        Accordion accordion = (Accordion)getComponent();

        int preferredHeight = 0;

        // The preferred height is the sum of the constrained preferred heights
        // of the headers and selected panel, plus border
        for (PanelHeader panelHeader : panelHeaders) {
            preferredHeight += panelHeader.getPreferredHeight(width) - 1;
        }

        if (width != -1) {
            width = Math.max(0, width - (padding.left + padding.right + 2));
        }

        int maxPanelHeight = 0;
        for (Component panel : accordion.getPanels()) {
            maxPanelHeight = Math.max(maxPanelHeight, panel.getPreferredHeight(width));
        }

        preferredHeight += (maxPanelHeight + padding.top + padding.bottom);
View Full Code Here

        return preferredHeight;
    }

    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);
    }

    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 pivot.wtk.Accordion$AccordionAttributeListenerList

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.