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

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

Introduction

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

Prototype

public GQuery first() 

Source Link

Document

Reduce the set of matched elements to the first in the set.

Usage

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

License:Apache License

void winnowResultsSetHighlight() {
    if (resultHighlight == null) {
        GQuery selectedResults = querySelectedResults();

        GQuery doHigh = selectedResults != null && selectedResults.length() > 0 ? selectedResults.first()
                : getFirstActive();//from w  w  w  .  j av  a 2  s  .  com

        if (doHigh != null) {
            resultDoHighlight(doHigh);
        }
    }
}

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

License:Apache License

private void keyupArrow() {
    if (!resultsShowing) {
        resultsShow();//  w  ww  .ja v a2 s.  c  o m
    } 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();//from  www .  j  av  a  2 s  .co 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();
        }
    }

}

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

License:Open Source License

private void winnowResultsSetHighlight() {
    if (resultHighlight == null) {
        GQuery selectedResults = !isMultiple
                ? searchResults.find("." + css.resultSelected() + "." + css.activeResult())
                : null;//from w  w  w.j  a  va2s  . c  o m

        GQuery doHigh = selectedResults != null && selectedResults.length() > 0 ? selectedResults.first()
                : searchResults.find("." + css.activeResult()).first();

        if (doHigh != null) {
            resultDoHighlight(doHigh);
        }
    }

}