Example usage for com.google.gwt.query.client.js JsObjectArray add

List of usage examples for com.google.gwt.query.client.js JsObjectArray add

Introduction

In this page you can find the example usage for com.google.gwt.query.client.js JsObjectArray add.

Prototype

public void add(T... vals) 

Source Link

Usage

From source file:jdramaix.client.ShowMorePagerPanel.java

License:Apache License

private void update() {
    int currentTopScroll = scrollable.getVerticalScrollPosition();
    int bottomScroll = $scrollable.offset().top + $scrollable.innerHeight() + currentTopScroll;

    JsObjectArray<GQuery> pastElements = JsObjectArray.create();
    JsObjectArray<GQuery> futureElements = JsObjectArray.create();

    // update current elements
    GQuery pastElement = $("." + resources.style().item() + ":not(." + resources.style().future() + ")",
            scrollable);//w  ww.ja v a  2  s.  com
    for (int i = pastElement.length() - 1; i > 0; i--) {
        GQuery element = pastElement.eq(i);

        if (isPast(element, bottomScroll)) {
            break;
        } else {
            futureElements.add(element);
        }
    }

    GQuery futureElement = $("." + resources.style().future(), scrollable);
    for (int i = 0; i < futureElement.length(); i++) {
        GQuery element = futureElement.eq(i);
        if (isPast(element, bottomScroll)) {
            pastElements.add(element);
        } else {
            break;
        }
    }

    // avoid browser reflows
    for (int i = 0; i < pastElements.length(); i++) {
        pastElements.get(i).removeClass(resources.style().future());
    }

    for (int i = 0; i < futureElements.length(); i++) {
        futureElements.get(i).addClass(resources.style().future());
    }
}