Search in sources :

Example 91 with Component

use of org.apache.pivot.wtk.Component in project pivot by apache.

the class TerraPaletteSkin method getPreferredSize.

@Override
public Dimensions getPreferredSize() {
    int preferredWidth = 0;
    int preferredHeight = 0;
    Palette palette = (Palette) getComponent();
    Component content = palette.getContent();
    Dimensions preferredTitleBarSize = titleBarTablePane.getPreferredSize();
    preferredWidth = preferredTitleBarSize.width;
    preferredHeight = preferredTitleBarSize.height;
    if (content != null) {
        Dimensions preferredContentSize = content.getPreferredSize();
        preferredWidth = Math.max(preferredWidth, preferredContentSize.width);
        preferredHeight += preferredContentSize.height;
    }
    preferredWidth += padding.getWidth() + 2;
    preferredHeight += padding.getHeight() + 4;
    return new Dimensions(preferredWidth, preferredHeight);
}
Also used : Palette(org.apache.pivot.wtk.Palette) Dimensions(org.apache.pivot.wtk.Dimensions) Component(org.apache.pivot.wtk.Component) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Example 92 with Component

use of org.apache.pivot.wtk.Component in project pivot by apache.

the class TerraPaletteSkin method getPreferredWidth.

@Override
public int getPreferredWidth(int height) {
    int preferredWidth = 0;
    Palette palette = (Palette) getComponent();
    Component content = palette.getContent();
    Dimensions preferredTitleBarSize = titleBarTablePane.getPreferredSize();
    preferredWidth = preferredTitleBarSize.width;
    if (content != null) {
        if (height != -1) {
            height = Math.max(height - preferredTitleBarSize.height - 4 - padding.getHeight(), 0);
        }
        preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
    }
    preferredWidth += padding.getWidth() + 2;
    return preferredWidth;
}
Also used : Palette(org.apache.pivot.wtk.Palette) Dimensions(org.apache.pivot.wtk.Dimensions) Component(org.apache.pivot.wtk.Component) Point(org.apache.pivot.wtk.Point) GradientPaint(java.awt.GradientPaint)

Example 93 with Component

use of org.apache.pivot.wtk.Component in project pivot by apache.

the class TerraPanoramaSkin method getPreferredHeight.

@Override
public int getPreferredHeight(int width) {
    int preferredHeight = 0;
    // The panorama's preferred height is the preferred height of the view
    Panorama panorama = (Panorama) getComponent();
    Component view = panorama.getView();
    if (view != null) {
        preferredHeight = view.getPreferredHeight(width);
    }
    return preferredHeight;
}
Also used : Panorama(org.apache.pivot.wtk.Panorama) Component(org.apache.pivot.wtk.Component)

Example 94 with Component

use of org.apache.pivot.wtk.Component in project pivot by apache.

the class TerraPanoramaSkin method getMaxScrollLeft.

protected int getMaxScrollLeft() {
    int maxScrollLeft = 0;
    Panorama panorama = (Panorama) getComponent();
    int width = getWidth();
    Component view = panorama.getView();
    if (view != null) {
        maxScrollLeft = Math.max(view.getWidth() - width, 0);
    }
    return maxScrollLeft;
}
Also used : Panorama(org.apache.pivot.wtk.Panorama) Component(org.apache.pivot.wtk.Component)

Example 95 with Component

use of org.apache.pivot.wtk.Component in project pivot by apache.

the class TerraPanoramaSkin method getPreferredSize.

@Override
public Dimensions getPreferredSize() {
    Dimensions preferredSize = null;
    // The panorama's preferred size is the preferred size of the view
    Panorama panorama = (Panorama) getComponent();
    Component view = panorama.getView();
    if (view == null) {
        preferredSize = Dimensions.ZERO;
    } else {
        preferredSize = view.getPreferredSize();
    }
    return preferredSize;
}
Also used : Panorama(org.apache.pivot.wtk.Panorama) Dimensions(org.apache.pivot.wtk.Dimensions) Component(org.apache.pivot.wtk.Component)

Aggregations

Component (org.apache.pivot.wtk.Component)209 Dimensions (org.apache.pivot.wtk.Dimensions)40 Point (org.apache.pivot.wtk.Point)38 GradientPaint (java.awt.GradientPaint)33 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)24 TextInput (org.apache.pivot.wtk.TextInput)21 Label (org.apache.pivot.wtk.Label)20 BoxPane (org.apache.pivot.wtk.BoxPane)18 Paint (java.awt.Paint)17 Button (org.apache.pivot.wtk.Button)15 PushButton (org.apache.pivot.wtk.PushButton)14 ScrollPane (org.apache.pivot.wtk.ScrollPane)14 TablePane (org.apache.pivot.wtk.TablePane)14 Window (org.apache.pivot.wtk.Window)14 IOException (java.io.IOException)13 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)13 Frame (org.apache.pivot.wtk.Frame)13 FlowPane (org.apache.pivot.wtk.FlowPane)12 ComponentStateListener (org.apache.pivot.wtk.ComponentStateListener)11 ComponentMouseButtonListener (org.apache.pivot.wtk.ComponentMouseButtonListener)10