本文整理了Java中com.google.gwt.dom.client.Element.getElementsByTagName()
方法的一些代码示例,展示了Element.getElementsByTagName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getElementsByTagName()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getElementsByTagName
[英]Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree.
[中]返回具有给定标记名的所有子代元素的节点列表,按照在该元素树的前序遍历中遇到它们的顺序。
代码示例来源:origin: org.vectomatic/lib-gwt-svg
/**
* Returns a <code>OMNodeList</code> of all descendant <code>OMElements</code>
* with a given tag name, in document order.
* @param name The name of the tag to match on. The special value "*"
* matches all tags.
* @return A list of matching <code>OMElement</code> nodes.
*/
public final <T extends OMElement> OMNodeList<T> getElementsByTagName(String name) {
return new OMNodeList<T>(((Element) ot).getElementsByTagName(name));
}
代码示例来源:origin: laaglu/lib-gwt-svg
/**
* Returns a <code>OMNodeList</code> of all descendant <code>OMElements</code>
* with a given tag name, in document order.
* @param name The name of the tag to match on. The special value "*"
* matches all tags.
* @return A list of matching <code>OMElement</code> nodes.
*/
public final <T extends OMElement> OMNodeList<T> getElementsByTagName(String name) {
return new OMNodeList<T>(((Element) ot).getElementsByTagName(name));
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
private JsArray<Element> getCells(Element row) {
return toArray(row.getElementsByTagName("td"));
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
private JsArray<Element> getRows(Element tbody) {
return toArray(tbody.getElementsByTagName("tr"));
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private JsArray<Element> getCells(Element row) {
return toArray(row.getElementsByTagName("td"));
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private JsArray<Element> getRows(Element tbody) {
return toArray(tbody.getElementsByTagName("tr"));
}
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
private static NodeList<Element> getElementsByTagName(String tag, Node ctx) {
if (ctx == null) {
return JavaScriptObject.createArray().cast();
}
return ((Element) ctx).getElementsByTagName(tag);
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
private void handleTabLayoutPanelSpecifics(TabLayoutPanel wrapped, Element element,
List<IsWidget> childWidgets) {
if ("tab".equals(element.getTagName())) {
NodeList<Element> headers = element.getElementsByTagName("header");
if (headers.getLength() == 1 && childWidgets.size() == 1) {
// case of "header"
String header = headers.getItem(0).getInnerHTML();
wrapped.add(childWidgets.get(0), header);
} else {
NodeList<Element> customHeaders = element.getElementsByTagName("customHeader");
if (customHeaders.getLength() == 1 && childWidgets.size() == 1) {
// case of "customHeader"
List<IsWidget> customHeaderChilds = UiBinderXmlUtils.getChildWidgets(customHeaders.getItem(0));
if (customHeaderChilds.size() == 1) {
wrapped.add(childWidgets.get(0), customHeaderChilds.get(0));
}
}
}
}
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private void handleTabLayoutPanelSpecifics(TabLayoutPanel wrapped, Element element,
List<IsWidget> childWidgets) {
if ("tab".equals(element.getTagName())) {
NodeList<Element> headers = element.getElementsByTagName("header");
if (headers.getLength() == 1 && childWidgets.size() == 1) {
// case of "header"
String header = headers.getItem(0).getInnerHTML();
wrapped.add(childWidgets.get(0), header);
} else {
NodeList<Element> customHeaders = element.getElementsByTagName("customHeader");
if (customHeaders.getLength() == 1 && childWidgets.size() == 1) {
// case of "customHeader"
List<IsWidget> customHeaderChilds = UiBinderXmlUtils.getChildWidgets(customHeaders.getItem(0));
if (customHeaderChilds.size() == 1) {
wrapped.add(childWidgets.get(0), customHeaderChilds.get(0));
}
}
}
}
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
private void handleStackLayoutPanelSpecifics(StackLayoutPanel wrapped, Element element,
List<IsWidget> childWidgets) {
if ("stack".equals(element.getTagName())) {
NodeList<Element> headers = element.getElementsByTagName("header");
if (headers.getLength() == 1 && childWidgets.size() == 1) {
// case of "header"
String header = headers.getItem(0).getInnerHTML();
String headerSize = headers.getItem(0).getAttribute("size");
wrapped.add(childWidgets.get(0).asWidget(), header, Double.valueOf(headerSize));
} else {
NodeList<Element> customHeaders = element.getElementsByTagName("customHeader");
if (customHeaders.getLength() == 1 && childWidgets.size() == 1) {
// case of "customHeader"
List<IsWidget> customHeaderChilds = UiBinderXmlUtils.getChildWidgets(customHeaders.getItem(0));
if (customHeaderChilds.size() == 1) {
String customHeaderSize = customHeaders.getItem(0).getAttribute("size");
wrapped.add(childWidgets.get(0), customHeaderChilds.get(0),
Double.valueOf(customHeaderSize));
}
}
}
}
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private void handleStackLayoutPanelSpecifics(StackLayoutPanel wrapped, Element element,
List<IsWidget> childWidgets) {
if ("stack".equals(element.getTagName())) {
NodeList<Element> headers = element.getElementsByTagName("header");
if (headers.getLength() == 1 && childWidgets.size() == 1) {
// case of "header"
String header = headers.getItem(0).getInnerHTML();
String headerSize = headers.getItem(0).getAttribute("size");
wrapped.add(childWidgets.get(0).asWidget(), header, Double.valueOf(headerSize));
} else {
NodeList<Element> customHeaders = element.getElementsByTagName("customHeader");
if (customHeaders.getLength() == 1 && childWidgets.size() == 1) {
// case of "customHeader"
List<IsWidget> customHeaderChilds = UiBinderXmlUtils.getChildWidgets(customHeaders.getItem(0));
if (customHeaderChilds.size() == 1) {
String customHeaderSize = customHeaders.getItem(0).getAttribute("size");
wrapped.add(childWidgets.get(0), customHeaderChilds.get(0),
Double.valueOf(customHeaderSize));
}
}
}
}
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui
Element item = nodeContainer.getElementsByTagName("span").getItem(0);
String name = node.getName();
String innerText = item.getInnerText();
item = nodeContainer.getElementsByTagName("div").getItem(0).getFirstChildElement();
innerText = item.getInnerText();
代码示例来源:origin: bedatadriven/activityinfo
private void makeItBootstrapish(boolean allowRecursiveCall) {
NodeList<Element> linkList = getElement().getParentElement().getElementsByTagName("a");
Element link = linkList.getItem(0);
link.setClassName("form-control");
makeWidthIsNotCorrupted(link, allowRecursiveCall);
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
@PatchMethod
static JavaScriptObject getElementsByTagNameImpl(XMLParserImpl xmlParserImpl,
JavaScriptObject o, String tagName) {
Node node = o.cast();
NodeList<Element> nodeList;
switch (node.getNodeType()) {
case Node.DOCUMENT_NODE:
Document document = node.cast();
nodeList = document.getElementsByTagName(tagName);
break;
case Node.ELEMENT_NODE:
Element element = node.cast();
nodeList = element.getElementsByTagName(tagName);
break;
default:
nodeList = JsoUtils.newNodeList();
break;
}
return nodeList;
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
@PatchMethod
static JavaScriptObject getElementsByTagNameImpl(XMLParserImpl xmlParserImpl,
JavaScriptObject o, String tagName) {
Node node = o.cast();
NodeList<Element> nodeList;
switch (node.getNodeType()) {
case Node.DOCUMENT_NODE:
Document document = node.cast();
nodeList = document.getElementsByTagName(tagName);
break;
case Node.ELEMENT_NODE:
Element element = node.cast();
nodeList = element.getElementsByTagName(tagName);
break;
default:
nodeList = JsoUtils.newNodeList();
break;
}
return nodeList;
}
代码示例来源:origin: org.kuali.student.core/ks-common-ui
/**
* Shows the uiObject content in a printable form in a new window
* @param uiObject
*/
public static void print(UIObject uiObject){
String headTag = "";
String styleTags = "";
NodeList<com.google.gwt.dom.client.Element> head = Document.get().getElementsByTagName("head");
if(head.getItem(0) != null){
com.google.gwt.dom.client.Element e = head.getItem(0);
NodeList<com.google.gwt.dom.client.Element> styles = e.getElementsByTagName("style");
for(int i = 0; i < styles.getLength(); i++){
styleTags = styleTags + styles.getItem(i).getString();
}
}
headTag = "<HEAD><TITLE>Print - " + Window.getTitle() + "</TITLE>" + styleTags + "</HEAD>";
openPrintWindow(uiObject.getElement().getString(), headTag, num);
num++;
}
代码示例来源:origin: bedatadriven/activityinfo
private void makeWidthIsNotCorrupted(Element link, boolean allowRecursiveCall) {
if (link.getOffsetWidth() > 1000) {
if (allowRecursiveCall) {
forceRedrawLater(false);
} else { // fallback, in 99% should not happen
link.getParentElement().getStyle().setWidth(DEFAULT_WIDTH + 2, Style.Unit.PX);
link.getStyle().setWidth(DEFAULT_WIDTH, Style.Unit.PX);
link.getNextSiblingElement().getStyle().setWidth(DEFAULT_WIDTH, Style.Unit.PX);
Element input = link.getNextSiblingElement().getElementsByTagName("input").getItem(0);
input.getStyle().setWidth(DEFAULT_WIDTH - 15, Style.Unit.PX);
}
}
}
}
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-git-ext-git
@Override
public Element render(
final Node node, final String domID, final Tree.Joint joint, final int depth) {
// Initialize HTML elements.
final Element rootContainer = super.render(node, domID, joint, depth);
final Element nodeContainer = rootContainer.getFirstChildElement();
final Element checkBoxElement = new CheckBox().getElement();
final InputElement checkBoxInputElement =
(InputElement) checkBoxElement.getElementsByTagName("input").getItem(0);
final Path nodePath =
node instanceof ChangedFileNode
? Path.valueOf(node.getName())
: ((ChangedFolderNode) node).getPath();
setCheckBoxState(nodePath, checkBoxInputElement);
setCheckBoxClickHandler(nodePath, checkBoxElement, checkBoxInputElement.isChecked());
// Paste check-box element to node container.
nodeContainer.insertAfter(checkBoxElement, nodeContainer.getFirstChild());
return rootContainer;
}
代码示例来源:origin: oVirt/ovirt-engine
protected void styleItem(TreeItem item, boolean enabled) {
Element tableElm = DOM.getFirstChild(item.getElement());
tableElm.setAttribute("width", "100%"); //$NON-NLS-1$ //$NON-NLS-2$
Element col = tableElm.getElementsByTagName("td").getItem(0); //$NON-NLS-1$
col.setAttribute("width", "20px"); //$NON-NLS-1$ //$NON-NLS-2$
NodeList<Element> inputs = item.getElement().getElementsByTagName("input"); //$NON-NLS-1$
for (int i = 0; i < inputs.getLength(); i++) {
if (!enabled) {
disableElement(inputs.getItem(i));
} else {
ElementTooltipUtils.destroyTooltip(inputs.getItem(i));
}
}
NodeList<Element> spans = item.getElement().getElementsByTagName("span"); //$NON-NLS-1$
for (int i = 0; i < spans.getLength(); i++) {
if (!enabled) {
disableElement(spans.getItem(i));
} else {
ElementTooltipUtils.destroyTooltip(spans.getItem(i));
}
}
boolean isLeafEmpty = item.getUserObject() != null && item.getUserObject().equals(true);
if (isLeafEmpty) {
item.getElement().getElementsByTagName("td").getItem(0).getStyle().setVisibility(Visibility.HIDDEN); //$NON-NLS-1$
}
}
内容来源于网络,如有侵权,请联系作者删除!