summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoDamlElement.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-08-26 16:53:03 +0200
committerDavid A. Madore <david+git@madore.org>2011-08-26 16:53:03 +0200
commit961bdfc66151b9aef46149e4730110ef409e5587 (patch)
tree4b6ad9a0e8253905af8d8f838ef2668fec4bfc0e /org/madore/damlengine/TodoDamlElement.java
parent7d3f4db185f5499160228afb228ecac6c6d22476 (diff)
downloaddamlengine-961bdfc66151b9aef46149e4730110ef409e5587.tar.gz
damlengine-961bdfc66151b9aef46149e4730110ef409e5587.tar.bz2
damlengine-961bdfc66151b9aef46149e4730110ef409e5587.zip
Move most of the context to a "general context" substructure.
This is so as to make sure that cloning (which does a shallow copy) gives us references to the same mutable content.
Diffstat (limited to 'org/madore/damlengine/TodoDamlElement.java')
-rw-r--r--org/madore/damlengine/TodoDamlElement.java60
1 files changed, 30 insertions, 30 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java
index 7e0faee..31e7357 100644
--- a/org/madore/damlengine/TodoDamlElement.java
+++ b/org/madore/damlengine/TodoDamlElement.java
@@ -31,44 +31,44 @@ public final class TodoDamlElement extends TodoDefaultElement {
throw new IllegalArgumentException("daml node can only be root node");
final String uriToTopName = "uri-to-top";
if ( node.hasAttributeNS(null, uriToTopName) )
- ctx.uriToTop = node.getAttributeNS(null, uriToTopName);
+ ctx.gc.uriToTop = node.getAttributeNS(null, uriToTopName);
final String fileNameName = "file.name";
if ( node.hasAttributeNS(null, fileNameName) )
- ctx.fileName = node.getAttributeNS(null, fileNameName);
+ ctx.gc.fileName = node.getAttributeNS(null, fileNameName);
- if ( ctx.htmlNode != null )
+ if ( ctx.gc.htmlNode != null )
throw new IllegalStateException("html node already defined at daml node");
- ctx.htmlNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "html");
+ ctx.gc.htmlNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "html");
String lang = LangHelper.getLangNorec(node);
if ( lang != null )
- LangHelper.setLangNorec(ctx.htmlNode, lang);
- node.getParentNode().replaceChild(ctx.htmlNode, node);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.htmlNode.appendChild(ctx.doc.createComment(" This file is automatically generated. Do not edit! "));
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- if ( ctx.headNode != null )
+ LangHelper.setLangNorec(ctx.gc.htmlNode, lang);
+ node.getParentNode().replaceChild(ctx.gc.htmlNode, node);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createComment(" This file is automatically generated. Do not edit! "));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ if ( ctx.gc.headNode != null )
throw new IllegalStateException("head node already defined at daml node");
- ctx.headNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "head");
- ctx.htmlNode.appendChild(ctx.headNode);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "head");
+ ctx.gc.htmlNode.appendChild(ctx.gc.headNode);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.styleContent = new StringBuffer();
+ ctx.gc.styleContent = new StringBuffer();
try {
Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.css"), "UTF-8"));
int ch;
while ((ch = rd.read()) > -1)
- ctx.styleContent.append((char)ch);
+ ctx.gc.styleContent.append((char)ch);
rd.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
- ctx.scriptContent = new StringBuffer();
+ ctx.gc.scriptContent = new StringBuffer();
try {
Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.js"), "UTF-8"));
int ch;
while ((ch = rd.read()) > -1)
- ctx.scriptContent.append((char)ch);
+ ctx.gc.scriptContent.append((char)ch);
rd.close();
} catch (IOException e) {
throw new RuntimeException(e);
@@ -78,33 +78,33 @@ public final class TodoDamlElement extends TodoDefaultElement {
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta");
meta.setAttributeNS(null, "http-equiv", "Content-Type");
meta.setAttributeNS(null, "content", "text/html; charset=utf-8");
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
if ( lang != null ) {
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta");
meta.setAttributeNS(null, "http-equiv", "Content-Language");
meta.setAttributeNS(null, "content", lang);
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
}
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "link");
meta.setAttributeNS(null, "rel", "Shortcut Icon");
- meta.setAttributeNS(null, "href", (((ctx.uriToTop!=null)?ctx.uriToTop:"")
+ meta.setAttributeNS(null, "href", (((ctx.gc.uriToTop!=null)?ctx.gc.uriToTop:"")
+"favicon.ico"));
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
ArrayList<Node> childList = getChildList(this.node);
ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size());
for ( Node child : childList ) {
if ( child.getNodeType() == Node.ELEMENT_NODE ) {
if ( child.getLocalName().equals("body") ) {
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.htmlNode.appendChild(child);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(child);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
} else {
- ctx.headNode.appendChild(child);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(child);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
}
TodoElement it
= TodoElement.getTodoElement((Element)child, this.ctx, this);