Search in sources :

Example 6 with Palette

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);
    }
}
Also used : Palette(org.apache.pivot.wtk.Palette) Component(org.apache.pivot.wtk.Component) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Example 7 with Palette

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);
}
Also used : Palette(org.apache.pivot.wtk.Palette) DropShadowDecorator(org.apache.pivot.wtk.effects.DropShadowDecorator)

Example 8 with Palette

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;
}
Also used : Palette(org.apache.pivot.wtk.Palette) Component(org.apache.pivot.wtk.Component) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Aggregations

Palette (org.apache.pivot.wtk.Palette)8 GradientPaint (java.awt.GradientPaint)6 Point (org.apache.pivot.wtk.Point)6 Component (org.apache.pivot.wtk.Component)5 Color (java.awt.Color)2 Dimensions (org.apache.pivot.wtk.Dimensions)2 BasicStroke (java.awt.BasicStroke)1 Bounds (org.apache.pivot.wtk.Bounds)1 ComponentListener (org.apache.pivot.wtk.ComponentListener)1 Cursor (org.apache.pivot.wtk.Cursor)1 Dialog (org.apache.pivot.wtk.Dialog)1 Display (org.apache.pivot.wtk.Display)1 Frame (org.apache.pivot.wtk.Frame)1 Label (org.apache.pivot.wtk.Label)1 Sheet (org.apache.pivot.wtk.Sheet)1 DropShadowDecorator (org.apache.pivot.wtk.effects.DropShadowDecorator)1 ReflectionDecorator (org.apache.pivot.wtk.effects.ReflectionDecorator)1