Search in sources :

Example 1 with AbstractFrame

use of com.haulmont.cuba.gui.components.AbstractFrame in project cuba by cuba-platform.

the class MigLayoutHelper method getConstraints.

public static CC getConstraints(Component component) {
    boolean expandX = false;
    boolean expandY = false;
    // for latter comparing with AutoExpanding
    if (component instanceof AbstractFrame) {
        component = (Component) ((AbstractFrame) component).getComponent();
    }
    if (component instanceof AutoExpanding) {
        expandX = ((AutoExpanding) component).expandsWidth();
        expandY = ((AutoExpanding) component).expandsHeight();
    }
    int width = (int) component.getWidth();
    int widthUnits = component.getWidthUnits();
    int height = (int) component.getHeight();
    int heightUnits = component.getHeightUnits();
    CC cc = new CC();
    applyWidth(cc, width, widthUnits, expandX);
    applyHeight(cc, height, heightUnits, expandY);
    applyAlignment(cc, component.getAlignment());
    return cc;
}
Also used : CC(net.miginfocom.layout.CC) AutoExpanding(com.haulmont.cuba.desktop.gui.components.AutoExpanding) AbstractFrame(com.haulmont.cuba.gui.components.AbstractFrame)

Aggregations

AutoExpanding (com.haulmont.cuba.desktop.gui.components.AutoExpanding)1 AbstractFrame (com.haulmont.cuba.gui.components.AbstractFrame)1 CC (net.miginfocom.layout.CC)1