Java Code Examples for com.google.gwt.dom.client.Document.createSpanElement()

The following are Jave code examples for showing how to use createSpanElement() of the com.google.gwt.dom.client.Document class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: empiria.player   File: InlineBodyGenerator.java   Source Code and License Vote up 5 votes
/**
 * Parsuje pojedynczy wezel xml-a i generuje reprezentacje w postaci widgeta. Widget jest dodawany do parentElement
 *
 * @param currNode
 * @param parentElement
 * @return
 */
protected com.google.gwt.dom.client.Element parseNode(Node currNode, com.google.gwt.dom.client.Element parentElement) {
    if (currNode.getNodeType() == Node.ELEMENT_NODE) {
        if (options.getIgnoredInlineTags().contains(currNode.getNodeName())) {
            return parentElement;
        } else if (modulesRegistrySocket.isModuleSupported(currNode.getNodeName()) && modulesRegistrySocket.isInlineModule(currNode.getNodeName())) {
            IModule module = modulesRegistrySocket.createModule((Element) currNode);
            if (module instanceof IInlineModule) {
                parenthood.addChild(module);
                ((IInlineModule) module).initModule((Element) currNode, moduleSocket, eventsBus);
                Widget moduleView = ((IInlineModule) module).getView();
                if (moduleView != null) {
                    parentElement.appendChild(moduleView.getElement());
                }
                if (module instanceof IInlineContainerModule) {
                    parenthood.pushParent((IInlineContainerModule) module);
                    parseElementNode(currNode, parentElement);
                    parenthood.popParent();
                }
            }
        } else {
            parseElementNode(currNode, parentElement);
        }
    } else if (currNode.getNodeType() == Node.TEXT_NODE) {
        Document doc = Document.get();
        com.google.gwt.dom.client.SpanElement span = doc.createSpanElement();
        span.appendChild(doc.createTextNode(currNode.getNodeValue()));
        span.setClassName(styleNames.QP_TEXT());
        parentElement.appendChild(span);
    }
    return parentElement;
}
 
Example 2
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License Vote up 4 votes
private SpanElement createSpan(Document document, String className) {
	SpanElement result = document.createSpanElement();
	result.addClassName(className);

	return result;
}