List of usage examples for com.google.gwt.dom.client NodeList getLength
public int getLength()
From source file:org.chromium.distiller.SchemaOrgParser.java
License:Open Source License
private void parse(Element root) { NodeList<Element> allProp = DomUtil.querySelectorAll(root, "[ITEMPROP],[ITEMSCOPE]"); // Root node (html) is not included in the result of querySelectorAll, so need to // handle it explicitly here. parseElement(root, null);//from w ww . ja v a 2 s . c o m for (int i = 0; i < allProp.getLength(); i++) { Element e = allProp.getItem(i); parseElement(e, getItemScopeParent(e)); } // As per http://schema.org/author (or http://schema.org/Article and search for "author" // property), if <a> or <link> tags specify rel="author", extract it. allProp = DomUtil.querySelectorAll(root, "A[rel=author],LINK[rel=author]"); for (int i = 0; i < allProp.getLength(); i++) { Element e = allProp.getItem(i); if (mAuthorFromRel.isEmpty()) mAuthorFromRel = getAuthorFromRelAttribute(e); } }
From source file:org.chromium.distiller.TableClassifier.java
License:Open Source License
private static List<Element> getDirectDescendants(Element t) { List<Element> directDescendants = new ArrayList<Element>(); NodeList<Element> allDescendants = t.getElementsByTagName("*"); if (!hasNestedTables(t)) { for (int i = 0; i < allDescendants.getLength(); i++) { directDescendants.add(allDescendants.getItem(i)); }//from w w w . ja v a 2 s . c om } else { for (int i = 0; i < allDescendants.getLength(); i++) { // Check if the current element is a direct descendant of the |t| table element in // question, as opposed to being a descendant of a nested table in |t|. Element e = allDescendants.getItem(i); Element parent = e.getParentElement(); while (parent != null) { if (parent.hasTagName("TABLE")) { if (parent == t) directDescendants.add(e); break; } parent = parent.getParentElement(); } } } return directDescendants; }
From source file:org.cruxframework.crux.core.client.utils.ScriptTagHandler.java
License:Apache License
/** * Evaluates any script inserted on the given element using element.innerHTML. * @param element//from ww w .j ava 2 s .c o m */ public static void evaluateScripts(Element element, ScriptLoadCallback callback) { if (scripts == null) { scripts = new ArrayList<Element>(); } NodeList<Element> scriptElements = element.getElementsByTagName("script"); if (scriptElements != null) { for (int i = 0; i < scriptElements.getLength(); i++) { scripts.add(scriptElements.getItem(i)); } } processNextScript(callback); }
From source file:org.cruxframework.crux.widgets.client.grid.GridFlexTable.java
License:Apache License
public void joinCells(int row) { TableRowElement tr = this.getRowElement(row).cast(); NodeList<TableCellElement> cells = tr.getCells(); int numTds = cells.getLength(); if (numTds > 1) { for (int i = 1; i < numTds; i++) { // We always remove the second cell. // This is because we want to keep the first one // and the cell indexes are in movement due // to the removing process. tr.removeChild(cells.getItem(1)); }/*from w w w .j ava 2s.c om*/ TableCellElement td = this.getCellElement(row, 0).cast(); td.setAttribute("colSpan", "" + numTds); td.setInnerHTML("."); } }
From source file:org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartView.java
License:Apache License
@Override public void fixAreaOpacity() { // This is a workaround for: https://github.com/c3js/c3/issues/2551 if (chart != null) { NodeList<Element> paths = chart.getElement().getElementsByTagName("path"); int n = paths.getLength(); for (int i = 0; i < n; i++) { Element child = paths.getItem(i); String className = child.getAttribute("class"); if (className != null && className.contains("c3-area-")) { child.getStyle().setOpacity(0.2); }/* www . ja v a 2 s.co m*/ } } }
From source file:org.datacleaner.monitor.shared.widgets.FileUploadFunctionHandler.java
License:Open Source License
private static InputElement getFileInput(Element element) { if (element == null) { return null; }/* w w w . j a v a 2 s . c o m*/ if (InputElement.TAG.equalsIgnoreCase(element.getTagName())) { final InputElement input = InputElement.as(element); if ("file".equals(input.getType())) { return input; } } final NodeList<Node> nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { final Node node = nodes.getItem(i); if (Element.is(node)) { InputElement input = getFileInput(Element.as(node)); if (input != null) { return input; } } } return null; }
From source file:org.eclipse.che.ide.console.OutputConsoleViewImpl.java
License:Open Source License
@Override public String getText() { String text = ""; NodeList<Node> nodes = consoleLines.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); Element element = node.cast(); text += element.getInnerText() + "\r\n"; }/*from w w w .j a v a 2 s . c o m*/ return text; }
From source file:org.eclipse.che.ide.extension.machine.client.processes.ConsolesPanelViewImpl.java
License:Open Source License
/** * Improves splitter visibility.//from ww w .j av a2 s . c om */ private void tuneSplitter() { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { com.google.gwt.dom.client.Element el = node.getFirstChild().cast(); if ("gwt-SplitLayoutPanel-HDragger".equals(el.getClassName())) { tuneSplitter(el); return; } } } }
From source file:org.eclipse.che.ide.extension.machine.client.processes.container.ConsolesContainerViewImpl.java
License:Open Source License
/** * Improves splitter visibility.//from ww w . j ava 2 s. c om */ private void tuneSplitter() { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { Element el = node.getFirstChild().cast(); String className = el.getClassName(); if (HORIZONTAL_DRAGGER_CLASS.equals(className)) { tuneVerticalSplitter(el); } else if (VERTICAL_DRAGGER_CLASS.equals(className)) { tuneHorizontalSplitter(el); } } } }
From source file:org.eclipse.che.ide.part.editor.multipart.SplitEditorPartViewImpl.java
License:Open Source License
/** * Improves splitter visibility.//from w w w .ja v a 2 s. c o m */ private void tuneSplitter(SplitLayoutPanel splitLayoutPanel) { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { Element el = node.getFirstChild().cast(); String className = el.getClassName(); if (HORIZONTAL_DRAGGER_CLASS.equals(className)) { tuneVerticalSplitter(el); } else if (VERTICAL_DRAGGER_CLASS.equals(className)) { tuneHorizontalSplitter(el); } } } }