Example usage for com.vaadin.client Util measureHorizontalPaddingAndBorder

List of usage examples for com.vaadin.client Util measureHorizontalPaddingAndBorder

Introduction

In this page you can find the example usage for com.vaadin.client Util measureHorizontalPaddingAndBorder.

Prototype

@Deprecated
public static int measureHorizontalPaddingAndBorder(Element element, int paddingGuess) 

Source Link

Usage

From source file:org.vaadin.tepi.listbuilder.widgetset.client.ui.VListBuilder.java

License:Apache License

void setInternalWidths() {
    DOM.setStyleAttribute(getElement(), "position", "relative");
    int bordersAndPaddings = Util.measureHorizontalPaddingAndBorder(buttons.getElement(), 0)
            + Util.measureHorizontalPaddingAndBorder(moveButtons.getElement(), 0);
    int buttonWidth = Util.getRequiredWidth(buttons);
    int moveButtonWidth = Util.getRequiredWidth(moveButtons);
    int totalWidth = getOffsetWidth();

    int spaceForSelect = (totalWidth - buttonWidth - moveButtonWidth - bordersAndPaddings) / 2;

    options.setWidth(spaceForSelect + "px");
    if (optionsCaption != null) {
        optionsCaption.setWidth(spaceForSelect + "px");
    }//from  w ww . j  a  v  a  2s .com

    selections.setWidth(spaceForSelect + "px");
    if (selectionsCaption != null) {
        selectionsCaption.setWidth(spaceForSelect + "px");
    }
    int captionWidth = totalWidth - moveButtonWidth;
    captionWrapper.setWidth(captionWidth + "px");
}