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


Java NodeList类代码示例

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


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

示例1: init

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
private void init(Element inlineChoiceElement) {
    NodeList nodes = inlineChoiceElement.getChildNodes();

    // Add no answer as first option
    if (showEmptyOption) {
        listBox.addItem(" ");
    }

    for (int i = 0; i < nodes.getLength(); i++) {
        if (nodes.item(i)
                .getNodeName()
                .compareTo("inlineChoice") == 0) {
            Element choiceElement = (Element) nodes.item(i);
            listBox.addItem(XMLUtils.getText(choiceElement), XMLUtils.getAttributeAsString(choiceElement, "identifier"));
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:InlineChoiceDefaultController.java

示例2: initRandom

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
private void initRandom(Element inlineChoiceElement) {
    RandomizedSet<Element> randomizedNodes = new RandomizedSet<Element>();
    NodeList nodes = inlineChoiceElement.getChildNodes();

    // Add no answer as first option
    if (showEmptyOption) {
        listBox.addItem(" ");
    }

    // Add nodes to temporary list
    for (int i = 0; i < nodes.getLength(); i++) {
        if (nodes.item(i)
                .getNodeName()
                .compareTo("inlineChoice") == 0) {
            randomizedNodes.push((Element) nodes.item(i));
        }
    }

    while (randomizedNodes.hasMore()) {
        Element choiceElement = randomizedNodes.pull();
        listBox.addItem(XMLUtils.getText(choiceElement), XMLUtils.getAttributeAsString(choiceElement, "identifier"));
    }

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:InlineChoiceDefaultController.java

示例3: InitialItemData

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public InitialItemData(XmlData itemData) {

        NodeList outcomeDeclarationNodes = null;

        outcomes = new HashMap<String, Outcome>();

        if (itemData != null) {
            outcomeDeclarationNodes = itemData.getDocument().getElementsByTagName("outcomeDeclaration");

            Outcome currOutcome;
            for (int i = 0; i < outcomeDeclarationNodes.getLength(); i++) {
                currOutcome = new Outcome(outcomeDeclarationNodes.item(i));
                if (currOutcome != null) {
                    outcomes.put(currOutcome.identifier, currOutcome);
                }
            }
        }
    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:InitialItemData.java

示例4: StyleLinkDeclaration

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public StyleLinkDeclaration(NodeList styleNodes, String pbaseUrl) {

        styles = new Vector<StyleLink>();
        baseUrl = pbaseUrl;

        if (styleNodes == null || styleNodes.getLength() == 0) {
            return;
        }

        NodeList styleLinkNodes = styleNodes.item(0).getChildNodes();

        if (styleLinkNodes != null) {
            for (int n = 0; n < styleLinkNodes.getLength(); n++) {
                Node styleLinkNode = styleLinkNodes.item(n);
                try {
                    StyleLink sd = new StyleLink(styleLinkNode.getAttributes().getNamedItem("href").getNodeValue(),
                            styleLinkNode.getAttributes().getNamedItem("userAgent").getNodeValue());
                    styles.add(sd);
                } catch (Exception e) {
                }
            }
        }

    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:StyleLinkDeclaration.java

示例5: generateHeaderOrPageRow

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
private int generateHeaderOrPageRow(Node rowNode, int currRow) {
    int rowsCount = 0;

    boolean isElement = isElementNode(rowNode);
    if (isElement) {

        NodeList cellNodes = rowNode.getChildNodes();
        String nodeName = rowNode.getNodeName();

        if (nodeName.equals(RR)) {
            generateHeaderRow(currRow, cellNodes);
            rowsCount++;
        } else if (nodeName.equals(PRR)) {
            int pageRows = generatePageRows(currRow, cellNodes);
            rowsCount += pageRows;
        }
    }
    return rowsCount;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:20,代码来源:ReportTableGenerator.java

示例6: generatePageRows

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
private int generatePageRows(int currRow, NodeList cellNodes) {
    int pageRow = 0;

    for (Integer pagesIndexe : pagesIndexes) {

        int pageRowIndex = pagesIndexe;
        int todo = pageTodoExtractor.extract(pageRowIndex);

        boolean shouldRenderPageRow = (todo != 0 || showNonActivites);
        if (shouldRenderPageRow) {
            int row = currRow + pageRow;
            generatePageRow(row, cellNodes, pageRowIndex);
            pageToRow.put(pageRowIndex, row);
            pageRow++;
        }
    }
    return pageRow;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:ReportTableGenerator.java

示例7: VariableManager

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public VariableManager(NodeList responseDeclarationNodes, IVariableCreator<V> variableCreator) {
    Node node;
    String currIdentifier;

    if (responseDeclarationNodes != null) {
        for (int i = 0; i < responseDeclarationNodes.getLength(); i++) {
            node = responseDeclarationNodes.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                currIdentifier = node.getAttributes().getNamedItem("identifier").getNodeValue();
                V var = variableCreator.createVariable(node);
                if (var != null) {
                    variables.put(currIdentifier, var);
                }
            }
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:VariableManager.java

示例8: fixLinks

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
/**
 * Fix links relative to xml file
 *
 * @param tagName  tag name
 * @param attrName attribute name with link
 */
private void fixLinks(Document document, String baseUrl, String tagName, String attrName) {

    NodeList nodes = document.getElementsByTagName(tagName);

    for (int i = 0; i < nodes.getLength(); i++) {
        Element element = (Element) nodes.item(i);
        String link = element.getAttribute(attrName);
        if (link != null && !link.startsWith("http")) {
            element.setAttribute(attrName, baseUrl + link);
        }
        // Links open in new window
        if (tagName.compareTo("a") == 0) {
            element.setAttribute("target", "_blank");
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:XmlData.java

示例9: collectModules

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
private void collectModules(Node mainNode, boolean complexPanel) {
    if (mainNode == null) {
        return;
    }
    NodeList nodes = mainNode.getChildNodes();
    for (int x = 0; x < nodes.getLength(); ++x) {
        Node node = nodes.item(x);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            String moduleName = node.getNodeName();
            if (!moduleName.trim().isEmpty() && isModuleSupported(moduleName)) {
                templateModules.add(moduleName);
                collectModules(node, complexPanel);
            } else {
                collectModules(node, complexPanel);
            }
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:AbstractTemplateParser.java

示例10: shouldInitPresenter_andGenerateGaps

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
@Test
public void shouldInitPresenter_andGenerateGaps() {
    // given;
    String script = "script";

    NodeList gaps = mock(NodeList.class);
    when(gaps.getLength()).thenReturn(1);

    Node gap = mock(Node.class);
    when(gaps.item(0)).thenReturn(gap);

    when(element.getElementsByTagName("gap")).thenReturn(gaps);
    when(element.getChildNodes().toString()).thenReturn(script);

    // when
    testObj.initModule(element, moduleSocket, bodyGenerator, eventsBus);

    // then
    verify(rootPanel).add(isA(FlowPanel.class));
    verify(bodyGenerator).processNode(eq(gap), isA(FlowPanel.class));
    verify(presenter).setMmlScript(script);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:InteractionMathJaxModuleTest.java

示例11: build

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public Element build() {
    Element result = mock(Element.class);

    when(result.getNodeType()).thenReturn(nodeType);

    if (value.isPresent()) {
        when(result.getNodeValue()).thenReturn(value.get());
    }

    if (nodeTag.isPresent()) {
        when(result.getTagName()).thenReturn(nodeTag.get());
    }

    when(result.getChildNodes()).thenReturn(children.or(EMPTY_LIST));

    for (Map.Entry<String, String> attr : attributes.entrySet()) {
        when(result.getAttribute(attr.getKey())).thenReturn(attr.getValue());
    }

    for (Map.Entry<String, NodeList> tC : tagChildren.entrySet()) {
        when(result.getElementsByTagName(tC.getKey())).thenReturn(tC.getValue());
    }

    return result;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:26,代码来源:MockElementFluentBuilder.java

示例12: testUserAgent

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public void testUserAgent() {
    String xml = "<styleDeclaration><link href=\"common/default.css\" userAgent=\"^((?!(iPad|iPhone)).)*\"/><link href=\"common/ipad.css\" userAgent=\".*iPad.*\"/><link href=\"common/iphone.css\" userAgent=\".*iPhone.*\"/></styleDeclaration>";
    String baseUrl = "";
    NodeList nodes = XMLParser.parse(xml).getElementsByTagName("styleDeclaration");
    StyleLinkDeclaration sld = new StyleLinkDeclaration(nodes, baseUrl);
    List<String> output;

    output = sld
            .getStyleLinksForUserAgent("Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405");
    assertEquals(1, output.size());
    assertTrue(output.contains("/common/ipad.css"));

    output = sld
            .getStyleLinksForUserAgent("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
    assertEquals(1, output.size());
    assertTrue(output.contains("/common/iphone.css"));

    output = sld
            .getStyleLinksForUserAgent("Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)");
    assertEquals(1, output.size());
    assertTrue(output.contains("/common/default.css"));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:StyleLinkDeclarationGWTTestCase.java

示例13: addVariable

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
/**
 * Adds a <link match=.../> element to the <args> section of the LASRequest.
 * This will add a new dataset-variable pair to the LASRequest. Note that
 * the order in which variables appear in an LASRequest is important as
 * differencing products (as of 2007-10-24) always subtract the second
 * variable from the first.
 * 
 * @param dsID
 * @param varID
 * @param region
 *            - the region to which this variable belongs.
 */
public void addVariable(String dsID, String varID, int region_index) {
    Element link = makeLink(dsID, varID);
    NodeList l = document.getDocumentElement().getElementsByTagName("args");
    Element args = (Element) l.item(0);
    if ( args == null ) {
        args = document.createElement("args");
        document.getDocumentElement().appendChild(args);
    }
    NodeList regions = document.getElementsByTagName("region");
    if ( region_index >= 0 && region_index < regions.getLength() ) {
        Element region = (Element) regions.item(region_index);
        args.insertBefore(link, region);
    } else {
        args.appendChild(link);
    }
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:29,代码来源:LASRequest.java

示例14: getVariable

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public String getVariable(int index) {
    Element args = getArgsElement();
    NodeList variables = args.getElementsByTagName("link");
    int counter = 0;
    for ( int i = 0; i < variables.getLength(); i++ ) {
        Element var = (Element) variables.item(i);
        // ByTagName gets children, grandchildren and below. Check that it
        // is a child of "args".
        if ( var.getParentNode().getNodeName().equals("args") ) {
            if ( counter == index ) {
                return getVariableId(var.getAttribute("match"));
            }
            counter++;
        }
    }
    return null;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:18,代码来源:LASRequest.java

示例15: getRangeHi

import com.google.gwt.xml.client.NodeList; //导入依赖的package包/类
public String getRangeHi(String axis_type, int index) {
    Element args = getArgsElement();
    NodeList regions = args.getElementsByTagName("region");
    if ( regions.getLength() > index ) {
        Element region = (Element) regions.item(index);
        NodeList ranges = region.getElementsByTagName("range");
        for ( int i = 0; i < ranges.getLength(); i++ ) {
            Element range = (Element) ranges.item(i);
            if ( range.getAttribute("type").equals(axis_type) ) {
                return range.getAttribute("high");
            }
        }
        NodeList points = region.getElementsByTagName("point");
        for ( int i = 0; i < points.getLength(); i++ ) {
            Element point = (Element) points.item(i);
            if ( point.getAttribute("type").equals(axis_type) ) {
                return point.getAttribute("v");
            }
        }
    }
    return null;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:23,代码来源:LASRequest.java


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