當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeList.getLength方法代碼示例

本文整理匯總了Java中com.google.gwt.dom.client.NodeList.getLength方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeList.getLength方法的具體用法?Java NodeList.getLength怎麽用?Java NodeList.getLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.dom.client.NodeList的用法示例。


在下文中一共展示了NodeList.getLength方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getElementsByClassName

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * Gets a list of descendants of e that match the given class name.
 *
 * If the browser has the native method, that will be called. Otherwise, it
 * traverses descendents of the given element and returns the list of elements
 * with matching classname.
 *
 * @param e
 * @param className
 */
public static NodeList<Element> getElementsByClassName(Element e, String className) {
  if (QuirksConstants.SUPPORTS_GET_ELEMENTS_BY_CLASSNAME) {
    return getElementsByClassNameNative(e, className);
  } else {
    NodeList<Element> all = e.getElementsByTagName("*");
    if (all == null) {
      return null;
    }
    JsArray<Element> ret = JavaScriptObject.createArray().cast();
    for (int i = 0; i < all.getLength(); ++i) {
      Element item = all.getItem(i);
      if (className.equals(item.getClassName())) {
        ret.push(item);
      }
    }
    return ret.cast();
  }
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:29,代碼來源:DomHelper.java

示例2: onModuleLoad

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
public void onModuleLoad() {
//    GWT.setUncaughtExceptionHandler(new ClientExceptionHandler());

    NodeList nl = Document.get().getElementsByTagName("style");
    final ArrayList<String> toLoad = new ArrayList<String>();
    for (int i = 0; i < nl.getLength(); i++) {
      Element e = (Element) nl.getItem(i);
      if ("text/gss".equals(e.getAttribute("type"))) {
        GWT.log("Style = " + e.getInnerText(), null);
      }
    }

    Chronoscope.setMicroformatsEnabled(true);
    ChronoscopeOptions.setErrorReporting(true);
    Chronoscope.getInstance();
  }
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:17,代碼來源:ChartDemoJS.java

示例3: menuVisible

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
private static boolean menuVisible(Element searchFrom,
                                   String label) {
    System.out.println("Looking for an <li> with text " + label);
    NodeList<com.google.gwt.dom.client.Element> liElems = searchFrom.getElementsByTagName("li");
    for (int i = 0, n = liElems.getLength(); i < n; i++) {
        com.google.gwt.dom.client.Element item = liElems.getItem(i);
        if (item.getInnerText().contains(label)) {
            System.out.println("Found: " + item);
            return true;
        } else {
            System.out.println("Not this one!");
        }
    }
    System.out.println("Not Found!");
    return false;
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:17,代碼來源:MenuAuthorizationTest.java

示例4: getDirectDescendants

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
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));
        }
    } 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;
}
 
開發者ID:chromium,項目名稱:dom-distiller,代碼行數:25,代碼來源:TableClassifier.java

示例5: showLocationDetails

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/** {@inheritDoc} */
public void showLocationDetails(final String name, final String htmlTitle, final String htmlContent) {
    final MQAPoi point = getMarker(name);
    if (point != null) {
        point.setInfoTitleHTML(htmlTitle);
        point.setInfoContentHTML(htmlContent);
        point.showInfoWindow();
        
        final NodeList<Element> elements = Document.get().getElementsByTagName("div");
        for (int i = 0; i < elements.getLength(); i++) {
            final Element e = elements.getItem(i);
            if (e.getClassName().equals("mqpoicontenttext")) {
                final Style s = e.getStyle();
                s.setOverflow(Overflow.HIDDEN);
                break;
            }
        }
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:20,代碼來源:MapQuestMapPanel.java

示例6: onModuleLoad

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
@Override
public void onModuleLoad() {
    
    if(Navigator.getUserAgent().contains("MSIE")) {
        NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div");
        for(int j = 0; j < divs.getLength(); j++) {
            Element element = divs.getItem(j);
            if(element.hasAttribute("name") && element.getAttribute("name").equals("opennms-snmpSelectList")) {
                createView(element);
            }
        }
    }else {
    
        NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:snmpSelectList");
        if(nodes.getLength() > 0) {
            for(int i = 0; i < nodes.getLength(); i++) {
                Element elem = nodes.getItem(i);
                createView(elem);
            }
            
        }
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:24,代碼來源:SnmpSelectListEntry.java

示例7: onModuleLoad

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * This is the entry point method.
 */
public void onModuleLoad() {  
    
    if(Navigator.getUserAgent().contains("MSIE")) {
        NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div");
        for(int j = 0; j < divs.getLength(); j++) {
            Element element = divs.getItem(j);
            if(element.hasAttribute("name") && element.getAttribute("name").equals("opennms-interfacelist")) {
                createView(element);
            }
        }
    }else {
        NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:interfacelist");
        if(nodes.getLength() > 0) {
            for(int i = 0; i < nodes.getLength(); i++) {
                Element elem = nodes.getItem(i);
                createView(elem);
            }
        }
    }
    
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:25,代碼來源:NodeInterfaceList.java

示例8: get

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
@Override
public Splittable get(String key) {
  if ("".equals(key)) {
    return new XmlSplittable(getFirstNode());
  }
  // [[email protected]] is a case where we are getting something which may not be an
  // attribute - only look for 'naked' @s

  // first try - look for 'anything, followed by an @, followed by not a
  // [,], or .
  if (key.matches(".*@[^\\[\\]\\.]+")) {
    String attrValue = DomQuery.selectValue(key, getFirstNode());
    if (attrValue == null) {
      return null;
    }
    return new XmlSplittable(getFirstNode().getOwnerDocument().createTextNode(attrValue));
  }
  NodeList<Node> nodes = DomQuery.select(key, (Element) getFirstNode()).cast();
  if (nodes == null || nodes.getLength() == 0) {
    return null;
  }
  return new XmlSplittable(nodes);
}
 
開發者ID:fhcampuswien,項目名稱:atom,代碼行數:24,代碼來源:XmlReader.java

示例9: getLastResolutionElement

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
private Element getLastResolutionElement() {
    DivElement div = getResolutionDiv();
    if (div == null) {
        return null;
    }
    NodeList<Node> nodeList = div.getChildNodes();
    if (nodeList == null) {
        return null;
    }
    int blockCount = nodeList.getLength();
    if (blockCount < 1) {
        return null;
    }
    if (containsResBlockSpacer()) {
        int index = blockCount - 2;
        if (blockCount > 1 && index >= 0) {
            return Element.as(getResolutionDiv().getChild(index));
        }
        return null;
    }
    return Element.as(getResolutionDiv().getLastChild());
}
 
開發者ID:tltv,項目名稱:gantt,代碼行數:23,代碼來源:TimelineWidget.java

示例10: onModuleLoad

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    
    
    if(Window.Navigator.getUserAgent().contains("MSIE")) {
        NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div");
        for(int j = 0; j < divs.getLength(); j++) {
            Element element = divs.getItem(j);
            if(element.hasAttribute("name") && element.getAttribute("name").contains("opennms-kscReportCombobox")) {
                createView(element);
            }
        }
        
    }else {
        NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:kscReportCombobox");
        if(nodes.getLength() > 0) {
            for(int i = 0; i < nodes.getLength(); i++) {
                createView(nodes.getItem(i));
            }
        }
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:25,代碼來源:KSCResourceCombobox.java

示例11: setSize

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
public void setSize(int width, int height) {
	NodeList<Element> iframeNodes = container.getElement().getElementsByTagName("iframe");

	if (iframeNodes != null && iframeNodes.getLength() > 0) {
		int iFrameHeight = height - 30;
		iFrameHeight = iFrameHeight > 0 ? iFrameHeight : 0;

		iframeNodes.getItem(0).setAttribute("width", width + "px");
		iframeNodes.getItem(0).setAttribute("height", iFrameHeight + "px");

		int streamHeight = iFrameHeight - 87;
		streamHeight = streamHeight > 0 ? streamHeight : 0;

		setHeight(streamHeight);
	}
}
 
開發者ID:Stratehm,項目名稱:multipool-stats-backend,代碼行數:17,代碼來源:TwitterTimelineWidget.java

示例12: resetFocusOnCell

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
@Override
protected boolean resetFocusOnCell() {
    boolean focused = false;
    if (hasFilterHeaders() && filterFocusedCellColumn > -1 && filterFocusedCellRow > -1) {
        TableSectionElement thead = getTableHeadElement();
        NodeList<TableRowElement> rows = thead.getRows();
        if (filterFocusedCellRow < rows.getLength()) {
            TableRowElement row = rows.getItem(filterFocusedCellRow);
            NodeList<TableCellElement> cells = row.getCells();
            if (filterFocusedCellColumn < cells.getLength()) {
                TableCellElement cell = cells.getItem(filterFocusedCellColumn);
                if (getHeaderBuilder().isHeader(cell)) {
                    Header<?> header = getHeaderBuilder().getHeader(cell);
                    Context context = new Context(0, 0, header.getKey());
                    focused = resetFocusOnFilterCellImpl(context, header, cell);
                }
            }
        }
    }
    if (!focused) {
        focused = super.resetFocusOnCell();
    }
    return focused;
}
 
開發者ID:kaaproject,項目名稱:avro-ui,代碼行數:25,代碼來源:AvroUiDataGrid.java

示例13: removeCssLinks

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * Removes all link tags in the head if not initialized.
 */
private void removeCssLinks() {
	if (this.isInit) {
		return;
	}
	this.isInit = true;
	// Remove all existing link element
	NodeList<Element> links = this.getHead().getElementsByTagName(LinkElement.TAG);
	int size = links.getLength();
	for (int i = 0; i < size; i++) {
		LinkElement elem = LinkElement.as(links.getItem(0));
		if ("stylesheet".equals(elem.getRel())) {
			elem.removeFromParent();
		}
	}
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:19,代碼來源:DefaultThemeController.java

示例14: findElementById

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * Gets an element from the given parent element by ID.
 * @param context
 * @param id
 */
public static Element findElementById(Element context, String id) {
    NodeList<Node> nodes = context.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.getItem(i);
        if (((node.getNodeType() == Node.ELEMENT_NODE))) {
            if (id.equals(((Element) node).getAttribute("id"))) { //$NON-NLS-1$
                return (Element) node;
            } else {
                Element elem = findElementById((Element) node, id);
                if (elem != null) {
                    return elem;
                }
            }
        }
    }
    return null;
}
 
開發者ID:Governance,項目名稱:dtgov,代碼行數:23,代碼來源:DOMUtil.java

示例15: setColumnSortable

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/**
 * Sets a column in the table to be sortable.  This will convert the content in the
 * "th" to be something the user can click on.  When the user clicks on it, the
 * internal state of the table will be altered *and* an event will be fired.
 * @param columnIndex
 * @param columnId
 */
public void setColumnSortable(int columnIndex, final String columnId) {
    Element thElement = null;
    NodeList<com.google.gwt.dom.client.Element> elementsByTagName = this.thead.getElementsByTagName("th"); //$NON-NLS-1$
    if (columnIndex <= elementsByTagName.getLength()) {
        thElement = elementsByTagName.getItem(columnIndex).cast();
    }
    if (thElement == null) {
        return;
    }

    String columnLabel = thElement.getInnerText();
    thElement.setInnerText(""); //$NON-NLS-1$

    SortableTableHeader widget = new SortableTableHeader(columnLabel, columnId);
    widget.removeFromParent();
    DOM.appendChild(thElement, widget.getElement());
    adopt(widget);
    widget.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            onColumnHeaderClick(columnId);
        }
    });
    columnIdMap.put(columnId, widget);
}
 
開發者ID:Governance,項目名稱:overlord-commons,代碼行數:33,代碼來源:SortableTemplatedWidgetTable.java


注:本文中的com.google.gwt.dom.client.NodeList.getLength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。