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


Java Node类代码示例

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


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

示例1: getMediaControllerNewInstance

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
@Override
protected MediaController getMediaControllerNewInstance(String moduleName, Node node) {
    MediaController controller = null;
    if (isModuleSupported(moduleName)) {
        ModuleTagName tagName = ModuleTagName.getTag(moduleName);
        switch (tagName) {
            case MEDIA_TITLE:
                controller = createWrapper(ModuleTagName.MEDIA_TITLE.tagName());
                break;
            case MEDIA_SCREEN:
                controller = createScreen();
                break;
            case MEDIA_DESCRIPTION:
                controller = createWrapper(ModuleTagName.MEDIA_DESCRIPTION.tagName());
                break;
            default:
                break;
        }
    }
    return controller;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:22,代码来源:ImgTemplateParser.java

示例2: isSubOrSup

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
public boolean isSubOrSup(Element node, Node parentNode) {
    Node prevNode = node;
    boolean subsupParentFound = false;

    if (node.hasAttribute(EmpiriaTagConstants.ATTR_UID)) {
        while (parentNode != null && !isMathInteractionNode(parentNode)) {
            if (isSubOrSupElement(parentNode) && !XMLUtils.getFirstChildElement((Element) parentNode).equals(prevNode)) {
                subsupParentFound = true;
                break;
            }
            prevNode = parentNode;
            parentNode = parentNode.getParentNode();
        }
    }

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

示例3: processNode

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
@Override
public void processNode(Node node, HasWidgets parent) {
    if (ignoredTagNames != null && SECTION.equals(node.getNodeName())
            && ignoredTagNames.contains(((com.google.gwt.xml.client.Element) node).getAttribute("name"))) {

    } else if (ignoredTagNames != null && SECTION.equals(node.getNodeName()) && ignoredTagNames.contains("untagged") && !detectTagNode(node)) {

    } else if (SECTION.equals(node.getNodeName())) {
        generateBody(node, parent);
    } else if (node.getNodeType() == Node.COMMENT_NODE) {

    } else if (moduleInstalatorSocket != null && moduleInstalatorSocket.isModuleSupported(node.getNodeName())) {

        Element element = (Element) node;
        if (moduleInstalatorSocket.isMultiViewModule(element)) {
            moduleInstalatorSocket.registerModuleView(element, parent);
        } else {
            moduleInstalatorSocket.createSingleViewModule(element, parent, this);
        }
    }

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

示例4: StyleLinkDeclaration

import com.google.gwt.xml.client.Node; //导入依赖的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.Node; //导入依赖的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: VariableManager

import com.google.gwt.xml.client.Node; //导入依赖的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

示例7: interpretSingleFeedbackAutoMark

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
private void interpretSingleFeedbackAutoMark(ItemResponseManager responseManager, Node feedback) {
    NamedNodeMap attributes = feedback.getAttributes();
    Node markedNode = attributes.getNamedItem(MARK);
    if (markedNode.getNodeValue().toUpperCase().compareTo("AUTO") == 0) {

        String variableIdentifier = attributes.getNamedItem(VARIABLE_IDENTIFIER).getNodeValue();
        if (responseManager.containsResponse(variableIdentifier)) {
            boolean correctness;
            String feedbackValue = attributes.getNamedItem(VALUE).getNodeValue();

            if (stringContainsAnyOf(feedbackValue, ".", "*", "[", "(", "\\", "^", "$", "]", ")")) {
                String responseCorrectAnswers = responseManager.getVariable(variableIdentifier).getCorrectAnswersValuesShort();
                correctness = responseCorrectAnswers.matches(feedbackValue);

            } else {
                correctness = responseManager.getVariable(variableIdentifier).compareValues(feedbackValue.split(";"));
            }

            if (correctness) {
                markedNode.setNodeValue("CORRECT");
            } else {
                markedNode.setNodeValue("WRONG");
            }
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:27,代码来源:FeedbackAutoMarkInterpreter.java

示例8: collectModules

import com.google.gwt.xml.client.Node; //导入依赖的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

示例9: shouldBuildLinkOnView

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
@Test
public void shouldBuildLinkOnView() {
    // given
    final String LINK_TEXT = "Link text";

    Node node = mock(Node.class);
    when(node.getNodeValue()).thenReturn(LINK_TEXT);

    Element element = mock(Element.class);
    when(element.getFirstChild()).thenReturn(node);
    when(element.getAttribute("url")).thenReturn("url");

    // when
    testObj.init(element);

    // then
    verify(view).buildLink(LINK_TEXT, "http://url");
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:SpeechScorePresenterTest.java

示例10: shouldInitPresenter_andGenerateGaps

import com.google.gwt.xml.client.Node; //导入依赖的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: testXmlProcessing

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
public void testXmlProcessing() {

        Document doc = XMLParser
                .parse("<nodes><responseDeclaration identifier='RESPONSE' cardinality='multiple' baseType='identifier'><correctResponse><value>ChoiceA</value></correctResponse></responseDeclaration></nodes>");

        VariableManager<CustomVariable> vm = new VariableManager<CustomVariable>(doc.getDocumentElement().getChildNodes(),

                new IVariableCreator<CustomVariable>() {

                    @Override
                    public CustomVariable createVariable(Node node) {
                        assertTrue(node.getNodeType() == Node.ELEMENT_NODE);
                        Element el = (Element) node;
                        String identifier = el.getAttribute("identifier");
                        assertEquals("RESPONSE", identifier);
                        return new CustomVariable();
                    }
                }

        );

        assertTrue(vm.getVariableIdentifiers().size() == 1);
        assertTrue(vm.getVariable("RESPONSE") instanceof CustomVariable);
    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:VariableManagerGWTTestCase.java

示例12: getChildrenNS

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
@Override
public List<Element> getChildrenNS(String xmlns) throws XMLException {
	final ArrayList<Element> result = new ArrayList<Element>();
	NodeList nodes = this.xmlElement.getChildNodes();
	for (int i = 0; i < nodes.getLength(); i++) {
		Node node = nodes.item(i);
		if (node instanceof com.google.gwt.xml.client.Element) {
			final String x = ((com.google.gwt.xml.client.Element) node).getAttribute("xmlns");
			GwtElement gpi = new GwtElement((com.google.gwt.xml.client.Element) node);
			if (x != null && xmlns.equals(gpi.getXMLNS())) {
				result.add(gpi);
			}
		}
	}
	return result;
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:17,代码来源:GwtElement.java

示例13: getFirstChild

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
@Override
public Element getFirstChild() throws XMLException {
	NodeList nodes = this.xmlElement.getChildNodes();
	for (int i = 0; i < nodes.getLength(); i++) {
		Node node = nodes.item(i);
		if (node instanceof com.google.gwt.xml.client.Element) {
			return new GwtElement((com.google.gwt.xml.client.Element) node);
		}
	}

	return null;
	// first child may not be Element it can be Node only!!
	// com.google.gwt.xml.client.Element c =
	// (com.google.gwt.xml.client.Element) xmlElement.getFirstChild();
	// return c == null ? null : new GwtElement(c);
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:17,代码来源:GwtElement.java

示例14: findModelElementByBundleName

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
private static Element findModelElementByBundleName(Element aElement, String aBundleName) {
	if (aElement.getTagName().equals("datamodel")) {
		return aElement;// the high level code had to do everything in the
						// right way
	} else {
		Node child = aElement.getFirstChild();
		while (child != null) {
			if (child instanceof Element) {
				Element el = (Element) child;
				if (el.hasAttribute("bundle-name")) {
					String bundleName = el.getAttribute("bundle-name");
					if (bundleName.equals(aBundleName)) {
						return el;
					}
				}
			}
			child = child.getNextSibling();
		}
	}
	return null;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:22,代码来源:XmlDom2Model.java

示例15: findLayoutElementByBundleName

import com.google.gwt.xml.client.Node; //导入依赖的package包/类
public static Element findLayoutElementByBundleName(Element aElement, String aBundleName) {
    if (aElement.getTagName().equals("layout")) {
        return aElement;// the high level code had to do everything in the right way
    } else {
        Node child = aElement.getFirstChild();
        while (child != null) {
            if (child instanceof Element) {
                Element el = (Element) child;
                if (el.hasAttribute("bundle-name")) {
                    String bundleName = el.getAttribute("bundle-name");
                    if (bundleName.equals(aBundleName)) {
                        return el;
                    }
                }
            }
            child = child.getNextSibling();
        }
    }
    return null;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:21,代码来源:JsUi.java


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