Example usage for com.google.gwt.query.client GQuery innerWidth

List of usage examples for com.google.gwt.query.client GQuery innerWidth

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery innerWidth.

Prototype

public int innerWidth() 

Source Link

Document

Returns the inner width of the first matched element, including padding but not the vertical scrollbar width, border, or margin.

Usage

From source file:com.arcbees.gquery.elastic.client.ElasticImpl.java

License:Apache License

void update(boolean fullUpdate) {
    int prevColumnNumber = columnHeights.size();
    columnHeights.clear();//from  ww  w.  j a  va  2  s .com
    columnPriorities.clear();
    ignoredColumn.clear();

    GQuery $container = $(container);
    // check if children returns text elements
    GQuery items = $container.children();

    containerPaddingLeft = $container.cur("paddingLeft", true);
    containerPaddingRight = $container.cur("paddingRight", true);
    containerPaddingTop = $container.cur("paddingTop", true);
    containerPaddingBottom = $container.cur("paddingBottom", true);

    double totalColumnWidth = $container.innerWidth() - containerPaddingLeft - containerPaddingRight;

    int colNumber = calculateNumberOfColumn(totalColumnWidth);

    columnWidth = (totalColumnWidth - ((colNumber - 1) * options.getInnerColumnMargin())) / colNumber;
    columnWidth = max(columnWidth, options.getMinimumColumnWidth());
    if (options.getMaximumColumnWidth() != -1) {
        int maxWidth = max(options.getMinimumColumnWidth(), options.getMaximumColumnWidth());
        columnWidth = min(columnWidth, maxWidth);
    }

    double initialTop = useTranslate3d ? 0 : containerPaddingTop;
    for (int i = 0; i < colNumber; i++) {
        columnHeights.add(initialTop);
        columnPriorities.add(i);
        ignoredColumn.add(false);
    }

    // Use four different loops in order to avoid browser reflows
    if (fullUpdate) {
        for (Element e : items.elements()) {
            initItem(e);
        }
    }

    if (!canUseCalc() || prevColumnNumber != colNumber) {
        for (Element e : items.elements()) {
            setItemWidth(e, colNumber);
        }
    }

    for (Element e : items.elements()) {
        readItemHeight(e);
    }

    for (Element e : items.elements()) {
        placeItem(e, colNumber);
    }

    setHeightContainer();
}