Search in sources :

Example 6 with Accordion

use of org.apache.pivot.wtk.Accordion in project pivot by apache.

the class TerraAccordionSkin method getPreferredHeight.

@Override
public int getPreferredHeight(int width) {
    Accordion accordion = (Accordion) getComponent();
    int preferredHeight = 0;
    // 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.getWidth() + 2));
    }
    int maxPanelHeight = 0;
    for (Component panel : accordion.getPanels()) {
        maxPanelHeight = Math.max(maxPanelHeight, panel.getPreferredHeight(width));
    }
    preferredHeight += (maxPanelHeight + padding.getHeight() + 2);
    return preferredHeight;
}
Also used : Accordion(org.apache.pivot.wtk.Accordion) Component(org.apache.pivot.wtk.Component) GradientPaint(java.awt.GradientPaint)

Example 7 with Accordion

use of org.apache.pivot.wtk.Accordion in project pivot by apache.

the class TerraAccordionSkin method install.

@Override
public void install(Component component) {
    super.install(component);
    Accordion accordion = (Accordion) component;
    accordion.getAccordionListeners().add(this);
    accordion.getAccordionSelectionListeners().add(this);
    accordion.getAccordionAttributeListeners().add(this);
}
Also used : Accordion(org.apache.pivot.wtk.Accordion)

Aggregations

Accordion (org.apache.pivot.wtk.Accordion)7 GradientPaint (java.awt.GradientPaint)5 Component (org.apache.pivot.wtk.Component)5 Vote (org.apache.pivot.util.Vote)1 AccordionSelectionListener (org.apache.pivot.wtk.AccordionSelectionListener)1 Dimensions (org.apache.pivot.wtk.Dimensions)1 Keyboard (org.apache.pivot.wtk.Keyboard)1 Modifier (org.apache.pivot.wtk.Keyboard.Modifier)1