Package pivot.wtk

Examples of pivot.wtk.Accordion$AccordionSelectionListenerList


  }

  public void install(Component component) {
        super.install(component);

        Accordion accordion = (Accordion)component;

        // Add this as a listener on the accordion
        accordion.getAccordionListeners().add(this);
        accordion.getAccordionSelectionListeners().add(this);
        accordion.getAccordionAttributeListeners().add(this);

        // Add header buttons for all existing panels
        for (Component panel : accordion.getPanels()) {
            PanelHeader panelHeader = new PanelHeader(new ButtonData(Accordion.getIcon(panel),
                Accordion.getName(panel)));
            panelHeader.setGroup(panelHeaderGroup);
            accordion.add(panelHeader);
            panelHeaders.add(panelHeader);
        }

        selectedIndexChanged(accordion, -1);
    }
View Full Code Here


        selectedIndexChanged(accordion, -1);
    }

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

        // Remove the header buttons
        for (int i = 0, n = panelHeaders.getLength(); i < n; i++) {
            accordion.remove(panelHeaders.get(i));
        }

        super.uninstall();
    }
View Full Code Here

    }

    public int getPreferredWidth(int height) {
      int preferredWidth;
      if (selectionChangeTransition == null) {
            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);
            }

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

        int preferredHeight;
        if (selectionChangeTransition == null) {
          preferredHeight = getHeight();
        } else {
          preferredHeight = 0;
            Accordion accordion = (Accordion)getComponent();

            // 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

        // TODO Optimize
        return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
    }

    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.selectedPanel.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 selectedPanel = accordion.getSelectedPanel();

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

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

    public final void setButtonPadding(int buttonPadding) {
        setButtonPadding(new Insets(buttonPadding));
    }

    protected void updateButtonData(Component panel) {
        Accordion accordion = (Accordion)getComponent();
        int panelIndex = accordion.getPanels().indexOf(panel);

        if (panelIndex != -1) {
            PanelHeader panelHeader = panelHeaders.get(panelIndex);
            panelHeader.setButtonData(new ButtonData(Accordion.getIcon(panel),
                Accordion.getName(panel)));
View Full Code Here

    // Button group events
    public void selectionChanged(Group group, Button previousSelection) {
        Button button = panelHeaderGroup.getSelection();
        int index = (button == null) ? -1 : panelHeaders.indexOf((PanelHeader)button);

        Accordion accordion = (Accordion)getComponent();
        accordion.setSelectedIndex(index);
    }
View Full Code Here

            setSkin(new PanelHeaderSkin());
        }

        @Override
        public boolean isEnabled() {
            Accordion accordion = (Accordion)TerraAccordionSkin.this.getComponent();
            return accordion.isEnabled();
        }
View Full Code Here

        panelHeaderGroup.getGroupListeners().add(new Button.GroupListener() {
            public void selectionChanged(Group group, Button previousSelection) {
                Button button = panelHeaderGroup.getSelection();
                int index = (button == null) ? -1 : panelHeaders.indexOf((PanelHeader)button);

                Accordion accordion = (Accordion)getComponent();
                accordion.setSelectedIndex(index);
            }
        });
    }
View Full Code Here

    }

    public void install(Component component) {
        super.install(component);

        Accordion accordion = (Accordion)component;

        // Add this as a listener on the accordion
        accordion.getAccordionListeners().add(this);
        accordion.getAccordionSelectionListeners().add(this);
        accordion.getAccordionAttributeListeners().add(this);

        // Add headers for all existing panels
        for (Component panel : accordion.getPanels()) {
            PanelHeader panelHeader = new PanelHeader(panel);
            panelHeader.setGroup(panelHeaderGroup);
            panelHeaders.add(panelHeader);
            accordion.add(panelHeader);

            // Listen for state changes on the panel
            panelHeader.setEnabled(panel.isEnabled());
            panel.getComponentStateListeners().add(panelStateListener);
        }
View Full Code Here

TOP

Related Classes of pivot.wtk.Accordion$AccordionSelectionListenerList

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.