当前位置: 首页>>代码示例>>Java>>正文


Java NodeList.getLength方法代码示例

本文整理汇总了Java中elemental.dom.NodeList.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java NodeList.getLength方法的具体用法?Java NodeList.getLength怎么用?Java NodeList.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elemental.dom.NodeList的用法示例。


在下文中一共展示了NodeList.getLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printStructure

import elemental.dom.NodeList; //导入方法依赖的package包/类
private void printStructure(Element element) {
	console.log("<" + element.getNodeName());
	NamedNodeMap attributes = element.getAttributes();
	if (attributes != null) {
		for (int x = 0; x < attributes.length(); x++) {
			Node attr = attributes.item(x);
			console.log(" " + attr.getNodeName() + "=" + attr.getNodeValue());
		}
	}
	console.log(">");
	if (element.getTextContent() != null) {
		console.log(element.getTextContent());
	}
	NodeList children = element.getChildNodes();
	for (int x = 0; x < children.getLength(); x++) {
		printStructure((Element) children.at(x));
	}
	console.log("</" + element.getNodeName() + ">");
}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:20,代码来源:AnotherTest.java

示例2: rightArrowPressed

import elemental.dom.NodeList; //导入方法依赖的package包/类
/**
 * Handles pressing the Right arrow button. Does nothing when user selected a file. Expands a
 * folder if the user has selected one. Selects the first child if the folder is already selected
 * and expanded.
 */
public void rightArrowPressed() {
  if (getModel().getRoot() == null
      || getSelectionModel().getSelectedNodes().isEmpty()
      || getModel().dataAdapter.getChildren(getModel().getRoot()).isEmpty()) {
    return;
  }

  D selected = getSelectionModel().getSelectedNodes().get(0);
  TreeNodeElement<D> selectedTreeNodeElement =
      getModel().dataAdapter.getRenderedTreeNode(selected);

  if (selectedTreeNodeElement.hasChildrenContainer()) {
    if (selectedTreeNodeElement.isOpen()) {
      // Select the first child
      NodeList children = selectedTreeNodeElement.getChildrenContainer().getChildNodes();
      if (children.getLength() > 0) {
        TreeNodeElement<D> firstChild = (TreeNodeElement<D>) children.item(0);
        selectSingleNode(firstChild);
      }
    } else {
      // Open the folder
      expandNode(selectedTreeNodeElement, true, true);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:Tree.java

示例3: getVisibleTreeNodes

import elemental.dom.NodeList; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:Tree.java

示例4: removeStaleInfoPopups

import elemental.dom.NodeList; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:codenvy-legacy,项目名称:plugin-editor-codemirror,代码行数:12,代码来源:ShowCompletion.java


注:本文中的elemental.dom.NodeList.getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。