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