use of org.apache.pivot.wtk.FillPane in project pivot by apache.
the class FillPaneSkin method getBaseline.
@Override
public int getBaseline(int width, int height) {
FillPane fillPane = (FillPane) getComponent();
int baseline = -1;
int contentHeight = 0;
switch(fillPane.getOrientation()) {
case HORIZONTAL:
{
int clientHeight = Math.max(height - padding.getHeight(), 0);
for (Component component : fillPane) {
if (component.isVisible()) {
int componentWidth = component.getPreferredWidth(clientHeight);
baseline = Math.max(baseline, component.getBaseline(componentWidth, clientHeight));
}
}
break;
}
case VERTICAL:
{
int clientWidth = Math.max(width - padding.getWidth(), 0);
for (Component component : fillPane) {
if (component.isVisible()) {
Dimensions size;
size = new Dimensions(clientWidth, component.getPreferredHeight(clientWidth));
if (baseline == -1) {
baseline = component.getBaseline(size.width, size.height);
if (baseline != -1) {
baseline += contentHeight;
}
}
contentHeight += size.height + spacing;
}
}
break;
}
default:
{
break;
}
}
if (baseline != -1) {
baseline += padding.top;
}
return baseline;
}
Aggregations