Search in sources :

Example 6 with Rollup

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

the class TerraRollupSkin method install.

@Override
public void install(Component component) {
    super.install(component);
    Rollup rollup = (Rollup) component;
    // Add the rollup button
    rollupButton = new RollupButton();
    rollup.add(rollupButton);
    Theme theme = currentTheme();
    theme.setDefaultStyles(this);
    // Initialize state
    headingChanged(rollup, null);
    contentChanged(rollup, null);
    collapsibleChanged(rollup);
}
Also used : Rollup(org.apache.pivot.wtk.Rollup) Theme(org.apache.pivot.wtk.Theme)

Example 7 with Rollup

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

the class TerraRollupSkin method getPreferredHeight.

@Override
public int getPreferredHeight(int width) {
    Rollup rollup = (Rollup) getComponent();
    Component heading = rollup.getHeading();
    Component content = rollup.getContent();
    int preferredHeight = 0;
    // Calculate our internal width constraint
    if (fill && width >= 0) {
        width = Math.max(width - rollupButton.getPreferredWidth(-1) - buffer, 0);
    } else {
        width = -1;
    }
    if (heading != null) {
        preferredHeight += heading.getPreferredHeight(width);
    }
    if (content != null) {
        if (expandTransition == null) {
            if (rollup.isExpanded()) {
                preferredHeight += spacing + content.getPreferredHeight(width);
            }
        } else {
            float scale = expandTransition.getScale();
            preferredHeight += (int) (scale * (spacing + content.getPreferredHeight(width)));
        }
    }
    preferredHeight = Math.max(preferredHeight, rollupButton.getPreferredHeight(-1));
    return preferredHeight;
}
Also used : Rollup(org.apache.pivot.wtk.Rollup) Component(org.apache.pivot.wtk.Component)

Aggregations

Rollup (org.apache.pivot.wtk.Rollup)7 Component (org.apache.pivot.wtk.Component)4 Dimensions (org.apache.pivot.wtk.Dimensions)2 Theme (org.apache.pivot.wtk.Theme)1