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

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

Introduction

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

Prototype

public GQuery prev() 

Source Link

Document

Get a set of elements containing the unique previous siblings of each of the matched set of elements.

Usage

From source file:com.arcbees.chosen.client.ChosenImpl.java

License:Apache License

private void keyupArrow() {
    if (!resultsShowing) {
        resultsShow();// w w  w.j a v  a 2  s.com
    } else if (isNotResultHighlighted()) {
        activateLastResult();
    } else if (resultHighlight != null) {
        // TODO should be replaced by :
        // GQuery prevSibs = resultHighlight.prevAll("li." + css.activeResult());
        // but performance is bad... See http://code.google.com/p/gwtquery/issues/detail?id=146

        GQuery prevSibling = resultHighlight.prev();

        while (!prevSibling.isEmpty() && !prevSibling.is("li." + css.activeResult())) {
            prevSibling = prevSibling.prev();
        }

        if (prevSibling.length() > 0) {
            resultDoHighlight(prevSibling.first());
        } else {
            if (choices > 0) {
                resultsHide();
            }

            resultClearHighlight();
        }
    }
}

From source file:com.watopi.chosen.client.ChosenImpl.java

License:Open Source License

private void keyupArrow() {
    if (!resultsShowing && !isMultiple) {
        resultsShow();//w  w w . j  a va2  s.c o  m
    } else if (resultHighlight != null) {
        // TODO should be replaced by :
        // GQuery prevSibs = resultHighlight.prevAll("li." + css.activeResult());
        // but performance is bad... See http://code.google.com/p/gwtquery/issues/detail?id=146

        GQuery prevSibling = resultHighlight.prev();

        while (!prevSibling.isEmpty() && !prevSibling.is("li." + css.activeResult())) {
            prevSibling = prevSibling.prev();
        }

        if (prevSibling.length() > 0) {
            resultDoHighlight(prevSibling.first());
        } else {
            if (choices > 0) {
                resultsHide();
            }

            resultClearHighlight();
        }
    }

}