• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NodeList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: divsWithDOM

import elemental.dom.NodeList; //导入依赖的package包/类
public void divsWithDOM() {

		// Create a view and controller without ajax action
		View view = new View();

		Controller controller = new ControllerMock();
		view.start(controller);

		// after viewing
		NodeList divs = Fluent.document.getElementsByTagName("DIV");
		assertEquals("there should be one DIV", divs.length(), 1);
		assertTrue("which contains the inner text 'Hi'", divs.item(0).getTextContent().contains("Hi"));

		// after some AJAX
		String random = Math.random() + "";
		view.setResponse(200, random);
		divs = Fluent.document.getElementsByTagName("DIV");
		assertEquals("there should be two DIVs", divs.length(), 2);
		assertEquals("and the 2nd should equal ajax", divs.item(1).getTextContent(), "Server said: " + random);
	}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:21,代码来源:ViewTestWithDom.java


示例2: mvcBootstrapStateChange

import elemental.dom.NodeList; //导入依赖的package包/类
public void mvcBootstrapStateChange() {
	Fluent.console.log("This runs in Javascript");

	// This below is like 'new View().onModuleLoad()'
	Store transport = new StoreNone(); // BUT with a different store!
	View view = new View();
	Controller controller = new Controller(transport, view);
	view.start(controller);

	// After pressing the menuBills button, check in the LI with class
	// active, the name of the A-link.
	controller.onMenuBills(null, null);

	NodeList b = document.getElementsByClassName("active");
	assertEquals("length of actives", b.length(), 1);
	assertTrue("selected item title", ((Element) b.item(0).getChildNodes().at(0)).getTextContent().equals("Bills"));
}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:18,代码来源:TestjUnitWithDom.java


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: nativeAttachFirstLink

import elemental.dom.NodeList; //导入依赖的package包/类
private static void nativeAttachFirstLink(Element styleElement) {
    final HeadElement head = Elements.getDocument().getHead();
    final NodeList nodes = head.getElementsByTagName("link");
    if (nodes.length() > 0) {
        head.insertBefore(styleElement, nodes.item(0));
    } else {
        head.appendChild(styleElement);
    }
}
 
开发者ID:codenvy-legacy,项目名称:plugin-editor-codemirror,代码行数:10,代码来源:CodeMirrorIDEStyleExtension.java


示例8: middleChildRemoval

import elemental.dom.NodeList; //导入依赖的package包/类
private void middleChildRemoval() {
	ViewOn<Integer> children = Fluent.body.add(0, i -> {
		switch (i) {
		case 0:
			return Ul(null, Li(null, "a"), Li(null, "b"), Li(null, "c"));
		case 1:
			return Ul(null, Li(null, "a"), Li(null, "b"), Li(null, "c"));
		case 2:
			return Ul(null, Li(null, "a"), Li(null, "c"));
		case 3:
			return Ul(null, Li(null, "a"), Li(null, "b"));
		case 4:
			return Ul(null, Li(null, "c"), Li(null, "b"), Li(null, "a"));
		default:
			return null;
		}
	});
	NodeList nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("1. length", 3, nodes.length());
	assertEquals("1. first value", "a", nodes.item(0).getTextContent());
	assertEquals("1. second value", "b", nodes.item(1).getTextContent());
	assertEquals("1. third value", "c", nodes.item(2).getTextContent());

	children.state(1);
	nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("2. length", 3, nodes.length());
	assertEquals("2. first value", "a", nodes.item(0).getTextContent());
	assertEquals("2. second value", "b", nodes.item(1).getTextContent());
	assertEquals("2. third alue", "c", nodes.item(2).getTextContent());

	children.state(2);
	nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("3. length", 2, nodes.length());
	assertEquals("3. first value", "a", nodes.item(0).getTextContent());
	assertEquals("3. second value", "c", nodes.item(1).getTextContent());

	children.state(3);
	nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("4. length", 2, nodes.length());
	assertEquals("4. first value", "a", nodes.item(0).getTextContent());
	assertEquals("4. second value", "b", nodes.item(1).getTextContent());

	children.state(1);
	nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("5. length", 3, nodes.length());
	assertEquals("5. first value", "a", nodes.item(0).getTextContent());
	assertEquals("5. second value", "b", nodes.item(1).getTextContent());
	assertEquals("5. third alue", "c", nodes.item(2).getTextContent());

	children.state(4);
	nodes = Fluent.document.getElementsByTagName("LI");
	assertEquals("6. length", 3, nodes.length());
	assertEquals("6. first value", "c", nodes.item(0).getTextContent());
	assertEquals("6. second value", "b", nodes.item(1).getTextContent());
	assertEquals("6. third alue", "a", nodes.item(2).getTextContent());

}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:58,代码来源:FluentInnerRendering.java


示例9: ElementIterable

import elemental.dom.NodeList; //导入依赖的package包/类
private ElementIterable(NodeList nodes) {
  this.nodes = nodes;
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:4,代码来源:ElementIterable.java


示例10: forEach

import elemental.dom.NodeList; //导入依赖的package包/类
public static MappedIterable<Element> forEach(NodeList children) {
  return new ElementIterable(children);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:4,代码来源:ElementIterable.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EggsType类代码示例发布时间:2022-05-15
下一篇:
Java DummyProtocolAsyncImpl类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap