diff options
author | David A. Madore <david+git@madore.org> | 2011-09-07 14:21:29 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2011-09-07 14:21:29 +0200 |
commit | 58e0ddcdc2b5d47db753868b3cc937bbac59ec55 (patch) | |
tree | bfe8a1f4014ef8373c06184b449c4f3bfaccb854 /org/madore/damlengine/TodoBodyElement.java | |
parent | 5acce829dc6ded492cca5ec87cd8bdbdb81667a5 (diff) | |
download | damlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.tar.gz damlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.tar.bz2 damlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.zip |
Move body handling (header, footer, etc.) to the <d:daml> element.
The <d:body> element is now sort of useless.
Diffstat (limited to 'org/madore/damlengine/TodoBodyElement.java')
-rw-r--r-- | org/madore/damlengine/TodoBodyElement.java | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/org/madore/damlengine/TodoBodyElement.java b/org/madore/damlengine/TodoBodyElement.java index 4286aa0..1db657b 100644 --- a/org/madore/damlengine/TodoBodyElement.java +++ b/org/madore/damlengine/TodoBodyElement.java @@ -26,68 +26,23 @@ public final class TodoBodyElement extends TodoDefaultElement { if ( ! ( caller instanceof TodoDamlElement ) ) throw new IllegalArgumentException("body node can only be child of daml node"); - Element bodyNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "body"); - String lang = LangHelper.getLangNorec(node); - if ( lang != null ) - LangHelper.setLangNorec(bodyNode, lang); - bodyNode.setAttributeNS(null, "onload", "onLoad()"); - node.getParentNode().replaceChild(bodyNode, node); - + Element parent = (Element)(this.node.getParentNode()); ArrayList<Node> childList = getChildList(this.node); - ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()+8); - if ( node.getAttributeNS(null, "notitle").equals("") - && ctx.gc.title != null ) { - Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, - "d:implicit-do-title"); - bodyNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.appendChild(token); - toProcess.add(new TodoTitleOrSubtitle(TodoTitleOrSubtitle.Type.TITLE, - token, this.ctx, this)); - } - if ( node.getAttributeNS(null, "nosubtitle").equals("") - && ctx.gc.subtitle != null ) { - Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, - "d:implicit-do-subtitle"); - bodyNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.appendChild(token); - toProcess.add(new TodoTitleOrSubtitle(TodoTitleOrSubtitle.Type.SUBTITLE, - token, this.ctx, this)); - } - if ( node.getAttributeNS(null, "nonavbar").equals("") ) { - Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, - "d:implicit-do-navbar"); - bodyNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.appendChild(token); - toProcess.add(new TodoNavbar(token, this.ctx, this)); - } - if ( node.getAttributeNS(null, "notranslations").equals("") - && ctx.gc.translations != null ) { - Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, - "d:implicit-do-translations"); - bodyNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.appendChild(token); - toProcess.add(new TodoTranslations(token, this.ctx, this)); - } + ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()); for ( Node child : childList ) { if ( child.getNodeType() == Node.TEXT_NODE || child.getNodeType() == Node.CDATA_SECTION_NODE ) { if ( ! Pattern.matches("^\\s*$",((CharacterData)child).getData()) ) throw new IllegalArgumentException("body element cannot contain text"); } - bodyNode.appendChild(child); + parent.insertBefore(child, node); if ( child.getNodeType() == Node.ELEMENT_NODE ) { TodoElement it = TodoElement.getTodoElement((Element)child, this.ctx, this); toProcess.add(it); } } - if ( node.getAttributeNS(null, "nofooter").equals("") ) { - Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, - "d:implicit-do-footer"); - bodyNode.appendChild(token); - bodyNode.appendChild(ctx.doc.createTextNode("\n")); - toProcess.add(new TodoFooter(token, this.ctx, this)); - } + parent.removeChild(node); this.ownerDeque.registerAtStart(toProcess); } |