List of usage examples for com.google.gwt.dom.client NodeList getLength
public int getLength()
From source file:com.sencha.gxt.core.client.util.Util.java
License:sencha.com license
/** * Converts a node list to an element array. * //from w w w .j av a 2 s.c o m * @param nodes the nodes * @return the element array */ public static Element[] toElementArray(NodeList<Element> nodes) { Element[] e = new Element[nodes.getLength()]; for (int i = 0; i < nodes.getLength(); i++) { e[i] = nodes.getItem(i); } return e; }
From source file:com.sencha.gxt.dnd.core.client.DropTarget.java
License:sencha.com license
private XElement elementFromPoint(XElement element, int x, int y) { if (!element.getBounds().contains(x, y)) { return null; }/*from ww w. j a v a 2s . c om*/ if (!element.hasChildNodes()) { return element; } NodeList<Node> childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.getItem(i); if (node.getNodeType() == Node.ELEMENT_NODE) { XElement child = node.cast(); if (child.getBounds().contains(x, y)) { return elementFromPoint(child, x, y); } } } // children are not within bounds, return this return element; }
From source file:com.sencha.gxt.fx.client.Shim.java
License:sencha.com license
protected void shim(NodeList<Element> elements) { for (int i = 0; i < elements.getLength(); i++) { XElement e = elements.getItem(i).<XElement>cast(); Rectangle bounds = e.getBounds(true); if (bounds.getHeight() > 0 && bounds.getWidth() > 0 && e.isVisible()) { shims.add(createShim(e, bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight())); }//from ww w . ja v a2s .c o m } }
From source file:com.sencha.gxt.theme.base.client.colorpalette.ColorPaletteBaseAppearance.java
License:sencha.com license
private static int indexOf(NodeList<Element> elements, Element elem) { for (int i = 0; i < elements.getLength(); i++) { if (elements.getItem(i) == elem) { return i; }//from w ww . j a va 2 s . co m } return -1; }
From source file:com.sencha.gxt.theme.base.client.colorpalette.ColorPaletteBaseAppearance.java
License:sencha.com license
@Override public String getAboveColor(XElement parent, String value) { if (value == null) { return null; }//from www .j a va 2 s .c om Element a = getChildElement(XElement.as(parent), value); int row = getRow(a); if (row > 0) { NodeList<Element> colorElements = getColorElements(parent); int idx = indexOf(colorElements, a); idx = idx - getColumnCount(); if (idx >= 0 && idx < colorElements.getLength()) { a = colorElements.getItem(idx); return stripColorName(a.getClassName()); } } return null; }
From source file:com.sencha.gxt.theme.base.client.colorpalette.ColorPaletteBaseAppearance.java
License:sencha.com license
@Override public String getBelowColor(XElement parent, String value) { NodeList<Element> colorElements = getColorElements(parent); if (value == null) { return stripColorName(colorElements.getItem(0).getClassName()); }// w w w . java2 s . co m Element a = getChildElement(parent, value); int row = getRow(a); if (row < (getRowCount(parent) - 1)) { int idx = indexOf(colorElements, a); idx = idx + getColumnCount(); if (idx >= 0 && idx < colorElements.getLength()) { a = colorElements.getItem(idx); return stripColorName(a.getClassName()); } } return null; }
From source file:com.sencha.gxt.theme.base.client.colorpalette.ColorPaletteBaseAppearance.java
License:sencha.com license
@Override public String getLeftColor(XElement parent, String value) { if (value == null) { return null; }//from w ww. ja va 2s . c o m Element a = getChildElement(XElement.as(parent), value); int col = getCol(a); if (col == 0) { return null; } NodeList<Element> colorElements = getColorElements(parent); int idx = indexOf(colorElements, a); if (idx > 0 && idx < colorElements.getLength()) { a = colorElements.getItem(idx - 1); return stripColorName(a.getClassName()); } return null; }
From source file:com.sencha.gxt.theme.base.client.colorpalette.ColorPaletteBaseAppearance.java
License:sencha.com license
@Override public String getRightColor(XElement parent, String value) { NodeList<Element> colorElements = getColorElements(parent); if (value == null) { return stripColorName(colorElements.getItem(0).getClassName()); }/*from w w w . java 2 s . c o m*/ Element a = getChildElement(XElement.as(parent), value); int col = getCol(a); if (col == getColumnCount() - 1) { return null; } int idx = indexOf(colorElements, a); if (idx < colorElements.getLength() - 1) { a = colorElements.getItem(idx + 1); return stripColorName(a.getClassName()); } return null; }
From source file:com.sencha.gxt.theme.base.client.frame.DivFrame.java
License:sencha.com license
@Override public void onHideHeader(XElement parent, boolean hide) { XElement header = getHeaderElem(parent); if (header != null && header.hasChildNodes()) { NodeList<Node> children = header.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node node = children.getItem(i); if (Element.is(node)) { Element.as(node).getStyle().setDisplay(hide ? Display.NONE : Display.BLOCK); }/*from w w w . jav a 2 s .co m*/ } } }
From source file:com.sencha.gxt.theme.base.client.frame.NestedDivFrame.java
License:sencha.com license
@Override public void onHideHeader(XElement parent, boolean hide) { XElement header = getHeaderElem(parent); if (header != null) { header.setClassName("x-hide-header", hide); }//from w w w. j a v a 2 s. co m if (header != null && header.hasChildNodes()) { NodeList<Node> children = header.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node node = children.getItem(i); if (Element.is(node)) { Element.as(node).getStyle().setDisplay(hide ? Display.NONE : Display.BLOCK); } } } }