Java Examples for elemental.dom.NodeList

The following java examples will help you to understand the usage of elemental.dom.NodeList. These source code samples are taken from different open source projects.

Example 1
Project: plugin-editor-codemirror-master  File: ShowCompletion.java View source code
private static void removeStaleInfoPopups(final String markerClass) {
    final Document documentElement = Elements.getDocument();
    final NodeList markersToRemove = documentElement.getElementsByClassName(markerClass);
    for (int i = 0; i < markersToRemove.getLength(); i++) {
        final Node childToRemove = markersToRemove.item(i);
        final Node parent = childToRemove.getParentNode();
        if (parent != null) {
            parent.removeChild(childToRemove);
        }
    }
}
Example 2
Project: che-master  File: Tree.java View source code
/**
     * Gathers all visible nodes of subtree.
     *
     * @param node subtree parent
     * @return array containing all visible nodes of subtree
     */
public List<TreeNodeElement<D>> getVisibleTreeNodes(TreeNodeElement<D> node) {
    List<TreeNodeElement<D>> nodes = new ArrayList<>();
    nodes.add(node);
    if (node.isOpen() && node.hasChildNodes()) {
        NodeList children = node.getChildrenContainer().getChildNodes();
        for (int ci = 0; ci < children.getLength(); ci++) {
            TreeNodeElement<D> child = (TreeNodeElement<D>) children.item(ci);
            nodes.addAll(getVisibleTreeNodes(child));
        }
    }
    return nodes;
}
Example 3
Project: DevTools-master  File: Tree.java View source code
/**
     * Gathers all visible nodes of subtree.
     *
     * @param node subtree parent
     * @return array containing all visible nodes of subtree
     */
public List<TreeNodeElement<D>> getVisibleTreeNodes(TreeNodeElement<D> node) {
    List<TreeNodeElement<D>> nodes = new ArrayList<>();
    nodes.add(node);
    if (node.isOpen() && node.hasChildNodes()) {
        NodeList children = node.getChildrenContainer().getChildNodes();
        for (int ci = 0; ci < children.getLength(); ci++) {
            TreeNodeElement<D> child = (TreeNodeElement<D>) children.item(ci);
            nodes.addAll(getVisibleTreeNodes(child));
        }
    }
    return nodes;
}
Example 4
Project: platform-api-client-gwt-master  File: Tree.java View source code
/**
     * Gathers all visible nodes of subtree.
     *
     * @param node subtree parent
     * @return array containing all visible nodes of subtree
     */
public Array<TreeNodeElement<D>> getVisibleTreeNodes(TreeNodeElement<D> node) {
    Array<TreeNodeElement<D>> nodes = Collections.createArray();
    nodes.add(node);
    if (node.isOpen() && node.hasChildNodes()) {
        NodeList children = node.getChildrenContainer().getChildNodes();
        for (int ci = 0; ci < children.getLength(); ci++) {
            TreeNodeElement<D> child = (TreeNodeElement<D>) children.item(ci);
            nodes.addAll(getVisibleTreeNodes(child));
        }
    }
    return nodes;
}
Example 5
Project: xapi-master  File: ElementIterable.java View source code
public static Iterable<Element> forEach(NodeList children) {
    return new ElementIterable(children);
}
Example 6
Project: elemento-master  File: Elements.java View source code
/**
     * Returns an iterator over the given node list. The iterator will only iterate over elements while skipping nodes.
     * The iterator does <strong>not</strong> support the {@link Iterator#remove()} operation.
     */
public static Iterator<HTMLElement> iterator(NodeList<Node> nodes) {
    return nodes != null ? new NodeListIterator(nodes) : Collections.<HTMLElement>emptyList().iterator();
}