Example usage for com.vaadin.client ComputedStyle getBorder

List of usage examples for com.vaadin.client ComputedStyle getBorder

Introduction

In this page you can find the example usage for com.vaadin.client ComputedStyle getBorder.

Prototype

public final int[] getBorder() 

Source Link

Document

Get current border values from the DOM.

Usage

From source file:info.magnolia.ui.vaadin.gwt.client.layout.thumbnaillayout.widget.ThumbnailsSizeKeeper.java

License:Open Source License

private void updateCalculatedOffsetSizes() {
    ComputedStyle cs;

    int[] padding;
    int[] border;
    int[] margin;

    if (thumbnailParent.getChildCount() > 0) {
        final Element firstThumbnail = Element.as(thumbnailParent.getFirstChild());
        cs = new ComputedStyle(firstThumbnail);

        padding = cs.getPadding();//from ww w. j  a va 2 s  .com
        border = cs.getBorder();
        margin = cs.getMargin();
    } else {
        final Element stub = Element.as(DOM.createDiv());
        stub.addClassName("thumbnail");
        thumbnailParent.appendChild(stub);
        cs = new ComputedStyle(stub);
        padding = cs.getPadding();
        border = cs.getBorder();
        margin = cs.getMargin();

        thumbnailParent.removeChild(stub);
    }

    horizontalDecorations = padding[1] + padding[3] + border[1] + border[3] + margin[1] + margin[3];
    verticalDecorations = padding[0] + padding[2] + border[0] + border[2] + margin[0] + margin[2];

    this.unscaledWidth = baseWidth + horizontalDecorations;
    this.unscaledHeight = baseHeight + verticalDecorations;

    this.calculatedWidth = scaleDimension(baseWidth, ratio);
    this.calculatedHeight = scaleDimension(baseHeight, ratio);

}