use of org.apache.pivot.wtk.Palette in project pivot by apache.
the class TerraPaletteSkin method layout.
@Override
public void layout() {
Palette palette = (Palette) getComponent();
int width = getWidth();
int height = getHeight();
int clientX = 1;
int clientY = 1;
int clientWidth = Math.max(width - 2, 0);
int clientHeight = Math.max(height - 2, 0);
// Size/position title bar
titleBarTablePane.setLocation(clientX, clientY);
titleBarTablePane.setSize(clientWidth, titleBarTablePane.getPreferredHeight());
// Size/position resize handle
resizeHandle.setSize(resizeHandle.getPreferredSize());
resizeHandle.setLocation(clientWidth - resizeHandle.getWidth(), clientHeight - resizeHandle.getHeight());
resizeHandle.setVisible(palette.isPreferredWidthSet() || palette.isPreferredHeightSet());
// Size/position content
Component content = palette.getContent();
if (content != null) {
content.setLocation(padding.left + 1, titleBarTablePane.getHeight() + padding.top + 3);
int contentWidth = Math.max(width - (padding.getWidth() + 2), 0);
int contentHeight = Math.max(height - (titleBarTablePane.getHeight() + padding.getHeight() + 4), 0);
content.setSize(contentWidth, contentHeight);
}
}
use of org.apache.pivot.wtk.Palette in project pivot by apache.
the class TerraPaletteSkin method install.
@Override
public void install(Component component) {
super.install(component);
Palette palette = (Palette) component;
palette.add(titleBarTablePane);
if (!themeIsFlat()) {
// Attach the drop-shadow decorator
dropShadowDecorator = new DropShadowDecorator();
palette.getDecorators().add(dropShadowDecorator);
}
palette.add(resizeHandle);
titleChanged(palette, null);
}
use of org.apache.pivot.wtk.Palette in project pivot by apache.
the class TerraPaletteSkin method getPreferredHeight.
@Override
public int getPreferredHeight(int width) {
int preferredHeight = 0;
Palette palette = (Palette) getComponent();
Component content = palette.getContent();
if (width != -1) {
width = Math.max(width - 2, 0);
}
preferredHeight = titleBarTablePane.getPreferredHeight(width);
if (content != null) {
if (width != -1) {
width = Math.max(width - padding.getWidth(), 0);
}
preferredHeight += content.getPreferredHeight(width);
}
preferredHeight += padding.getHeight() + 4;
return preferredHeight;
}
Aggregations