use of org.apache.pivot.wtk.Component in project pivot by apache.
the class WindowSkin method getPreferredWidth.
@Override
public int getPreferredWidth(int height) {
Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredWidth(height) : 0;
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class WindowSkin method getPreferredHeight.
@Override
public int getPreferredHeight(int width) {
Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredHeight(width) : 0;
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class WindowSkin method getPreferredSize.
@Override
public Dimensions getPreferredSize() {
Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredSize() : Dimensions.ZERO;
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class WindowSkin method layout.
@Override
public void layout() {
Window window = (Window) getComponent();
Component content = window.getContent();
if (content != null) {
content.setSize(window.getSize());
}
}
use of org.apache.pivot.wtk.Component in project pivot by apache.
the class BoxPaneSkin method getPreferredHeight.
@Override
public int getPreferredHeight(int width) {
BoxPane boxPane = (BoxPane) getComponent();
int preferredHeight = 0;
Orientation orientation = boxPane.getOrientation();
if (orientation == Orientation.HORIZONTAL) {
// Preferred height is the maximum preferred height of all components
for (int i = 0, n = boxPane.getLength(); i < n; i++) {
Component component = boxPane.get(i);
if (component.isVisible()) {
preferredHeight = Math.max(preferredHeight, component.getPreferredHeight());
}
}
} else {
int widthUpdated = width;
// Include padding in constraint
if (widthUpdated != -1) {
widthUpdated = Math.max(widthUpdated - padding.getWidth(), 0);
}
// Preferred height is the sum of the preferred heights of all
// components
int j = 0;
for (int i = 0, n = boxPane.getLength(); i < n; i++) {
Component component = boxPane.get(i);
if (component.isVisible()) {
preferredHeight += component.getPreferredHeight(fill ? widthUpdated : -1);
j++;
}
}
// Include spacing
if (j > 1) {
preferredHeight += spacing * (j - 1);
}
}
// Include top and bottom padding values
preferredHeight += padding.getHeight();
return preferredHeight;
}
Aggregations