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

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

Introduction

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

Prototype

public boolean isEmpty() 

Source Link

Document

Returns true if the number of matched elements is 0.

Usage

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

License:Apache License

protected void containerMouseDownImpl(Event e, GQuery element) {
    if (!activeField) {
        $(document).click(clickTestAction);
        resultsShow();//from w  w  w.  j a va2  s  . c o  m
    } else if (!element.isEmpty() && (element.get(0) == selectedItem.get(0)
            || element.parents("a." + css.chznSingle()).length() > 0)) {
        e.preventDefault();
        resultsToggle();
    }

    if (!element.hasClass(css.activeResult())) {
        activateField();
    }
}

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

License:Apache License

protected boolean searchResultsMouseUp(Event e) {
    Element targetEvent = e.getEventTarget().cast();
    GQuery $e = $(targetEvent);/* ww  w . ja  v  a 2s .c  o  m*/

    GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first();
    if (!target.isEmpty()) {
        resultHighlight = target;
        resultSelect(e);
    }

    return false;
}

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

License:Apache License

boolean searchResultsMouseOver(Event e) {
    Element targetEl = e.getEventTarget().cast();
    GQuery $e = $(targetEl);//from  ww  w . j a  v a2s.co  m

    GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first();
    if (!target.isEmpty()) {
        resultDoHighlight(target);
    }

    return false;
}

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

License:Apache License

private boolean containerMouseUp(Event e) {
    Element target = e.getEventTarget().cast();

    GQuery $e = $(target);

    if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) {
        resultsReset();/* ww  w  .  j av  a2 s  .  c om*/
        return false;
    }

    return true;
}

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

License:Apache License

private void keydownArrow() {
    if (isNotResultHighlighted()) {
        activateFirstResult();/* w  w w  . j a v  a2s .  c  o  m*/
    } else if (resultsShowing) {
        // TODO should be replaced by :
        // GQuery nextSibling = resultHighlight.nextAll("li."+css.activeResult()).first();
        // but performance is bad... See http://code.google.com/p/gwtquery/issues/detail?id=146

        GQuery nextSibling = resultHighlight.next();

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

        resultDoHighlight(nextSibling);
    }

    if (!resultsShowing) {
        resultsShow();
    }
}

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

License:Apache License

private void keyupArrow() {
    if (!resultsShowing) {
        resultsShow();/*from   w  w  w  . j  a va  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.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

@Override
protected com.google.gwt.user.client.Element getStyleElement() {
    GQuery chosenElement = getChosenElement();
    if (!chosenElement.isEmpty()) {
        return chosenElement.get(0).cast();
    }//from w  w  w.j  a v a 2  s  .c  o  m

    return super.getStyleElement();
}

From source file:com.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

private GQuery getFocusableElement() {
    GQuery chosen = getChosenElement();// ww  w  .  j ava2 s  . c  o m
    GQuery focusableElement = chosen.children("a");
    if (focusableElement.isEmpty()) {
        focusableElement = chosen.find("input");
    }

    return focusableElement;
}

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

License:Open Source License

private boolean containerMouseDown(Event e) {
    if (isDisabled) {
        return true;
    }/* www.  j  a  v a2s.  c o  m*/
    Element target = e.getEventTarget().cast();
    GQuery $e = $(target);

    boolean targetCloseLink = $e.hasClass(css.searchChoiceClose());

    if (!resultsShowing) {
        e.stopPropagation();
    }

    if (!pendingDestroyClick && !targetCloseLink) {
        if (!activeField) {
            if (isMultiple) {
                searchField.val("");
            }
            $(document).click(clickTestAction);
            resultsShow();
        } else if (!isMultiple && !$e.isEmpty()
                && ($e.get(0) == selectedItem.get(0) || $e.parents("a." + css.chznSingle()).length() > 0)) {
            e.preventDefault();
            resultsToggle();
        }

        activateField(e);

    } else {
        pendingDestroyClick = false;
    }

    return false;
}

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

License:Open Source License

private boolean containerMouseUp(Event e) {
    Element target = e.getEventTarget().cast();
    GQuery $e = $(target);

    if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) {
        resultsReset(e);//from  w w  w. j  av a 2s . co  m
        return false;
    }

    return true;
}