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


Java NodeList.getItem方法代碼示例

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


在下文中一共展示了NodeList.getItem方法的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: 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

示例3: tuneSplitter

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
/** Improves splitter visibility. */
private void tuneSplitter(SplitLayoutPanel splitLayoutPanel) {
  NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes();
  for (int i = 0; i < nodes.getLength(); i++) {
    Node node = nodes.getItem(i);
    if (node.hasChildNodes()) {
      Element el = node.getFirstChild().cast();
      String className = el.getClassName();
      if (HORIZONTAL_DRAGGER_CLASS.equals(className)) {
        tuneVerticalSplitter(el);
      } else if (VERTICAL_DRAGGER_CLASS.equals(className)) {
        tuneHorizontalSplitter(el);
      }
    }
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:SplitEditorPartViewImpl.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: 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,項目名稱:rtgov-ui,代碼行數:23,代碼來源:DOMUtil.java

示例6: updateSelection

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
@Override
protected void updateSelection() {
	T value = getValue();
	
	if(value != null){
		getPaperElement().setSelected(null);
		PaperRadioButtonElement selectedOpt = null;
		NodeList<Element> items = getPaperElement().getElementsByTagName(PaperRadioButtonElement.TAG);
		
		for(int k = 0, len = items.getLength(); k < len; k++){
			PaperRadioButtonElement item = (PaperRadioButtonElement) items.getItem(k);
			item.setChecked(false);
			if(value.equals(item.getName())){
				selectedOpt = item;
			}
		}
		
		getPaperElement().setSelected(value.toString());
		if(selectedOpt != null){
			selectedOpt.setChecked(true);
		}
	}
}
 
開發者ID:chalu,項目名稱:errai-polymer,代碼行數:24,代碼來源:PaperRadioGroup.java

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

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

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

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

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

示例12: 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-nodeSuggestionCombobox")) {
                 createView(element);
             }
         }
         
     }else {
         NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:nodeSuggestionCombobox");
         if(nodes.getLength() > 0) {
             for(int i = 0; i < nodes.getLength(); i++) {
                 createView(nodes.getItem(i));
             }
             
         }
     }
   
 
 }
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:27,代碼來源:NodeSuggestionCombobox.java

示例13: scaleCanvas

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
void scaleCanvas() {
    Element element = Document.get().getElementById("embed-html");
    int innerWidth = getWindowInnerWidth();
    int innerHeight = getWindowInnerHeight();
    int newWidth = innerWidth;
    int newHeight = innerHeight;
    float ratio = innerWidth / (float) innerHeight;
    float viewRatio = WIDTH / (float) HEIGHT;

    if (ratio > viewRatio) {
        newWidth = (int) (innerHeight * viewRatio);
    } else {
        newHeight = (int) (innerWidth / viewRatio);
    }

    NodeList<Element> nl = element.getElementsByTagName("canvas");

    if (nl != null && nl.getLength() > 0) {
        Element canvas = nl.getItem(0);
        canvas.setAttribute("width", "" + newWidth + "px");
        canvas.setAttribute("height", "" + newHeight + "px");
        canvas.getStyle().setWidth(newWidth, Style.Unit.PX);
        canvas.getStyle().setHeight(newHeight, Style.Unit.PX);
        canvas.getStyle().setTop((int) ((innerHeight - newHeight) * 0.5f), Style.Unit.PX);
        canvas.getStyle().setLeft((int) ((innerWidth - newWidth) * 0.5f), Style.Unit.PX);
        canvas.getStyle().setPosition(Style.Position.ABSOLUTE);
    }
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:29,代碼來源:HtmlLauncher.java

示例14: collectAllChildrenStyles

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
private List<Style> collectAllChildrenStyles(NodeList<Node> childNodes) {
    List<Style> allStyles = Lists.newArrayList();
    for (int x = 0; x < childNodes.getLength(); ++x) {
        Node item = childNodes.getItem(x);
        if (item.getNodeType() == Node.ELEMENT_NODE) {
            Style styles = cssHelper.getComputedStyle(item);
            allStyles.add(styles);
            allStyles.addAll(collectAllChildrenStyles(((com.google.gwt.dom.client.Element) item).getChildNodes()));
        }
    }
    return allStyles;
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:13,代碼來源:ConnectionStyleChecker.java

示例15: getSources

import com.google.gwt.dom.client.NodeList; //導入方法依賴的package包/類
public List<String> getSources() {
    List<String> sources = new ArrayList<>();
    NodeList<Element> childList = videoElement.getElementsByTagName("source");
    for (int i = 0; i < childList.getLength(); i++) {
        Element element = childList.getItem(i);
        String source = element.getAttribute("src");
        sources.add(source);
    }
    return sources;
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:11,代碼來源:VideoElementWrapper.java


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