X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fjava%2Forg%2Fibex%2Fxt%2FJSElement.java;h=06a6f72e6f4feec00c1cd8977ff432dae3067fb4;hb=4f3ad62d8bc5e2f2cc1f6674935bb9a088fa400a;hp=4de51f0432624a1b20cd86d902e8230307bcf45a;hpb=50cd2b0cdda6355214e16e8e9f8dd65a31fe6934;p=org.ibex.xt-crawshaw.git diff --git a/src/java/org/ibex/xt/JSElement.java b/src/java/org/ibex/xt/JSElement.java index 4de51f0..06a6f72 100644 --- a/src/java/org/ibex/xt/JSElement.java +++ b/src/java/org/ibex/xt/JSElement.java @@ -1,14 +1,14 @@ -package ibex.xt; +package org.ibex.xt; import java.io.StringReader; import java.io.Writer; +import java.io.OutputStream; import java.io.IOException; - import java.util.*; -import ibex.util.*; -import ibex.js.JS; -import ibex.js.JSScope; +import org.ibex.util.*; +import org.ibex.js.JS; +import org.ibex.js.JSScope; public class JSElement extends JSScope implements XML.Element { protected XML.Element wrapped; @@ -22,13 +22,14 @@ public class JSElement extends JSScope implements XML.Element { // remap parent and children if (wrapped.getParent() != null) { List c = wrapped.getParent().getChildren(); - c.remove(wrapped); c.add(this); + c.set(c.indexOf(wrapped), this); } List c = wrapped.getChildren(); - for (int i=c.size(); i >= 0; i--) ((XML.Block)c.get(i)).setParent(this); + for (int i=0; i < c.size(); i++) ((Tree.Leaf)c.get(i)).setParent(this); } - public void toXML(Writer w) throws IOException { + public void out(OutputStream o) throws IOException { throw new UnsupportedOperationException(); } + public void out(Writer w) throws IOException { // grab all related attributes try { XML.Attributes a = getAttributes(); @@ -75,8 +76,8 @@ public class JSElement extends JSScope implements XML.Element { // Pass Through /////////////////////////////////////////////////////////// - public void setParent(XML.Element p) { wrapped.setParent(p); } - public XML.Element getParent() { return wrapped.getParent(); } + public void setParent(Tree.Node p) { wrapped.setParent(p); } + public Tree.Node getParent() { return wrapped.getParent(); } public XML.Attributes getAttributes() { return wrapped.getAttributes(); } public XML.Prefixes getPrefixes() { return wrapped.getPrefixes(); } public List getChildren() { return wrapped.getChildren(); } @@ -86,7 +87,7 @@ public class JSElement extends JSScope implements XML.Element { public String getUri() { return wrapped.getUri(); } /** Works up the Element object model until an instance of a JSScope is found. */ - private static JSScope findScope(XML.Element e) { + private static JSScope findScope(Tree.Node e) { while (e != null && !(e instanceof JSScope)) e = e.getParent(); return (JSScope)e; }