Example usage for com.google.gwt.dom.client NodeList getLength

List of usage examples for com.google.gwt.dom.client NodeList getLength

Introduction

In this page you can find the example usage for com.google.gwt.dom.client NodeList getLength.

Prototype

public int getLength() 

Source Link

Usage

From source file:com.extjs.gxt.ui.client.widget.grid.GroupingView.java

License:sencha.com license

/**
 * Toggles all groups.//from w w w . j a  v  a 2 s  .c  o  m
 * 
 * @param expanded true to expand
 */
public void toggleAllGroups(boolean expanded) {
    NodeList<Element> groups = getGroups();
    for (int i = 0, len = groups.getLength(); i < len; i++) {
        toggleGroup(groups.getItem(i), expanded);
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.GroupingView.java

License:sencha.com license

@Override
protected NodeList<Element> getRows() {
    if (!enableGrouping) {
        return super.getRows();
    }//from   w w w . j  a  v a  2s . com
    if (!hasRows()) {
        return new JsArray().getJsObject().cast();
    }

    NodeList<Element> gs = getGroups();
    JsArray rows = new JsArray();
    for (int i = 0, len = gs.getLength(); i < len; i++) {
        NodeList<Element> g = gs.getItem(i).getChildNodes().getItem(1).getChildNodes().cast();
        for (int j = 0, len2 = g.getLength(); j < len2; j++) {
            rows.add(g.getItem(j));
        }
    }
    return rows.getJsObject().cast();
}

From source file:com.extjs.gxt.ui.client.widget.grid.GroupingView.java

License:sencha.com license

private void updateGroupWidths() {
    if (!enableGrouping || ds.getCount() < 1) {
        return;/*from w w  w  .  ja  v  a 2 s  . c  om*/
    }
    String tw = Math.max(cm.getTotalWidth(), el.dom.getOffsetWidth() - getScrollAdjust()) + "px";
    NodeList<Element> gs = getGroups();
    for (int i = 0, len = gs.getLength(); i < len; i++) {
        Element e = gs.getItem(i).getFirstChild().cast();
        e.getStyle().setProperty("width", tw);
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.GroupSummaryView.java

License:sencha.com license

protected void doAllWidths(List<Integer> ws, int tw) {
    if (!enableGrouping)
        return;//www  .j  a  v a2 s  .  c o m
    NodeList<Element> gs = getGroups();
    for (int i = 0, len = gs.getLength(); i < len; i++) {
        Element s = gs.getItem(i).getChildNodes().getItem(2).cast();
        El.fly(s).setWidth(tw);
        if (s.getFirstChild() == null)
            return;
        El.fly(s.getFirstChildElement()).setWidth(tw);
        TableSectionElement tse = s.getFirstChildElement().cast();
        NodeList<Element> cells = tse.getRows().getItem(0).getChildNodes().cast();
        for (int j = 0, wlen = ws.size(); j < wlen; j++) {
            El.fly(cells.getItem(j)).setWidth(ws.get(j));
        }
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.GroupSummaryView.java

License:sencha.com license

protected void doWidth(int col, int w, int tw) {
    if (!enableGrouping)
        return;/*from  w w  w .j a  v a 2  s  . c  o  m*/
    NodeList<Element> gs = getGroups();
    for (int i = 0, len = gs.getLength(); i < len; i++) {
        Element s = gs.getItem(i).getChildNodes().getItem(2).cast();
        El.fly(s).setWidth(tw);
        El.fly(s.getFirstChildElement()).setWidth(tw);

        TableSectionElement tse = s.getFirstChildElement().cast();
        Element e = tse.getRows().getItem(0).getChildNodes().getItem(col).cast();
        El.fly(e).setWidth(w);
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.GroupSummaryView.java

License:sencha.com license

@Override
protected void templateOnColumnHiddenUpdated(int col, boolean hidden, int tw) {
    if (!enableGrouping)
        return;/*from  www.  j  av a  2 s . c  o  m*/
    NodeList<Element> gs = getGroups();
    String display = hidden ? "none" : "";
    for (int i = 0, len = gs.getLength(); i < len; i++) {
        Element s = gs.getItem(i).getChildNodes().getItem(2).cast();
        El.fly(s).setWidth(tw);
        El.fly(s.getFirstChildElement()).setWidth(tw);
        TableSectionElement tse = s.getFirstChildElement().cast();
        Element e = tse.getRows().getItem(0).getChildNodes().getItem(col).cast();
        e.getStyle().setProperty("display", display);
    }
}

From source file:com.extjs.gxt.ui.client.widget.layout.MenuLayout.java

License:sencha.com license

protected void cleanup(El target) {
    NodeList<Node> cn = target.dom.getChildNodes();
    for (int i = cn.getLength() - 1; i >= 0; i--) {
        if (!cn.getItem(i).hasChildNodes()) {
            target.dom.removeChild(cn.getItem(i));
        }/*from   w w  w. j  a va  2 s. co  m*/
    }
}

From source file:com.extjs.gxt.ui.client.widget.layout.ToolBarLayout.java

License:sencha.com license

protected void cleanup(El row) {
    NodeList<Node> cn = row.dom.getChildNodes();
    for (int i = cn.getLength() - 1; i >= 0; i--) {
        Element td = (Element) cn.getItem(i);
        if (!td.hasChildNodes()) {
            row.dom.removeChild(td);/*  w  ww . ja v  a2 s  .c om*/
        }
    }
}

From source file:com.extjs.gxt.ui.client.widget.menu.Menu.java

License:sencha.com license

protected void constrainScroll(int y) {
    int full = ul.setHeight("auto").getHeight();

    int max = maxHeight != Style.DEFAULT ? maxHeight : (XDOM.getViewHeight(false) - y);
    if (full > max && max > 0) {
        activeMax = max - 10 - scrollerHeight * 2;
        ul.setHeight(activeMax, true);//from   ww  w .  j a va2  s . com
        createScrollers();
    } else {
        ul.setHeight(full, true);
        NodeList<Element> nodes = el().select(".x-menu-scroller");
        for (int i = 0; i < nodes.getLength(); i++) {
            fly(nodes.getItem(i)).hide();
        }
    }
    ul.setScrollTop(0);
}

From source file:com.extjs.gxt.ui.client.widget.menu.Menu.java

License:sencha.com license

private void clearGroups() {
    NodeList<Element> groups = el().select(".x-menu-radio-group");
    for (int i = 0; i < groups.getLength(); i++) {
        Element e = groups.getItem(i);
        El.fly(e).removeFromParent();//w  ww.j  a v  a2  s.  c  o  m
    }
}