Examples of JsNodeArray


Examples of com.google.gwt.query.client.js.JsNodeArray

   */
  public void setSnap(List<Widget> snapWidgets) {
    if (snapWidgets == null) {
      return;
    }
    JsNodeArray snapElements = JsNodeArray.create();
    for (Widget w : snapWidgets) {
      snapElements.addNode(w.getElement());
    }
    options.setSnap($(snapElements));
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   */
  public void setStack(List<Widget> stackWidgets) {
    if (stackWidgets == null) {
      return;
    }
    JsNodeArray stackElements = JsNodeArray.create();
    for (Widget w : stackWidgets) {
      stackElements.addNode(w.getElement());
    }
    options.setStack($(stackElements));
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  }

  public void testUnique() {
    SelectorEngineImpl selSizz = new SelectorEngineSizzle();
    GQuery g = $(e).html("<div><p></p><p></p><span></span><p></p>");
    JsNodeArray a;
    a = selSizz.select("p", e).cast();
    assertEquals(3, a.getLength());
    a.addNode(a.getNode(0));
    a.addNode(a.getNode(3));
    assertEquals(5, a.getLength());
    a = g.unique(a);
    assertEquals(3, a.getLength());
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

    GQuery $html = $("<div>div1</div><div>div2</div><div>div3</div><span>span1</span>");
    assertEquals(3, $html.filter("div").length());
    assertEquals(1, $html.filter("span").length());

    JsNodeArray array = JsNodeArray.create();
    for (int i = 0 ; i < 3; i++){
          array.addNode(DOM.createDiv());
     }
     assertEquals(3, $(array).filter("div").length());


     String content2 = "<div><div class='inner first'>Hello</div><div class='inner second'>And</div><div class='inner third'>Goodbye</div></div>";
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

      return $();
    }
    // Wraps a native array like jquery does
    if (!JsUtils.isWindow(jso) && !JsUtils.isElement(jso) && JsUtils.isArray(jso)) {
      JsArrayMixed c = jso.cast();
      JsNodeArray elms = JsNodeArray.create();
      for (int i = 0; i < c.length(); i++) {
        Object obj = c.getObject(i);
        if (obj instanceof Node) {
          elms.addNode((Node) obj);
        }
      }
      return $(elms);
    }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Create a new GQuery given a list of nodes, elements or widgets
   */
  public static GQuery $(List<?> nodesOrWidgets) {
    JsNodeArray elms = JsNodeArray.create();
    if (nodesOrWidgets != null) {
      for (Object o : nodesOrWidgets) {
        if (o instanceof Node) {
          elms.addNode((Node) o);
        } else if (o instanceof IsWidget) {
          elms.addNode(((IsWidget)o).asWidget().getElement());
        }
      }
    }
    return new GQuery(elms);
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   * Get a set of elements containing all of the unique immediate children of each of the matched
   * set of elements. Also note: while parents() will look at all ancestors, children() will only
   * consider immediate child elements.
   */
  public GQuery children() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allNextSiblingElements(e.getFirstChildElement(), result, null, null, null);
    }
    return new GQuery(unique(result));
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Clone matched DOM Elements and select the clones. This is useful for moving copies of the
   * elements to another location in the DOM.
   */
  public GQuery clone() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      result.addNode(e.cloneNode(true));
    }
    GQuery ret = new GQuery(result);
    ret.currentContext = currentContext;
    ret.currentSelector = currentSelector;
    return ret;
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

    if (context == null) {
      context = currentContext;
    }

    GQuery pos = posRegex.test(selector) ? $(selector, context) : null;
    JsNodeArray result = JsNodeArray.create();

    for (Element e : elements) {
      Element current = e;
      while (current != null && current.getOwnerDocument() != null && current != context) {
        boolean match = pos != null ? pos.index(current) > -1 : $(current).is(selector);
        if (match) {
          result.addNode(current);
          break;
        } else {
          current = current.getParentElement();
        }
      }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

          GQuery pos = matches.get(selector);
          boolean match = pos != null ? pos.index(current) > -1 : $(current).is(selector);

          if (match) {
            JsNodeArray elementsMatchingSelector = results.get(selector).cast();
            if (elementsMatchingSelector == null) {
              elementsMatchingSelector = JsNodeArray.create();
              results.put(selector, elementsMatchingSelector);
            }
            elementsMatchingSelector.addNode(current);
          }
        }

        current = current.getParentElement();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.