src/JsRender/NodeToJs.vala
[app.Builder.js] / src / JsRender / NodeToJs.vala
index 92d0374..7130555 100644 (file)
@@ -167,10 +167,10 @@ public class JsRender.NodeToJs : Object {
                var spad = this.pad.substring(0, this.pad.length-indent);
                
                if (this.node.props.has_key("* xinclude")) {
-                       this.addLine("Roo.apply(" + this.node.props.get("* xinclude") + "._tree(), {");
+                       this.addLine("Roo.apply(" + this.node.props.get("* xinclude") + "._tree(), {",0 );
         
                } else {
-                       this.addLine("{");
+                       this.addLine("{", 0);
                }
                var suffix = "";
                // output the items...
@@ -192,23 +192,23 @@ public class JsRender.NodeToJs : Object {
                        var k = iter.get();
                        var v = this.out_props.get(k);
                        
-                       this.addMultiLine(this.pad + k + " : " + v + suffix);
+                       this.addLine(this.pad + k + " : " + v + suffix, ',');
                }
         
                // listeners..
                
                if (this.out_listeners.size > 0 ) { 
                        total_nodes--;
-                       this.addLine(this.pad + "listeners : {");
+                       this.addLine(this.pad + "listeners : {", 0);
                        iter = this.orderedListenerKeys().list_iterator();
                         
-                       var sz = this.out_listeners.size;
                        while(iter.next()) {
-                               sz--;
-                               suffix = sz > 0 ? "," : "";
+                               
                                var k = iter.get();
                                var v = this.out_listeners.get(k);
-                               this.addMultiLine(this.pad + indent_str + k + " : " + v + suffix);
+                               this.addLine(this.pad + indent_str + k + " : ", '');
+                               this.node.setLine(this.cur_line, ";",k);
+                               this.addLine( v,',');
                        }
                        suffix = total_nodes > 0 ? "," : "";
                        this.addLine(this.pad + "}" + suffix);                  
@@ -290,7 +290,7 @@ public class JsRender.NodeToJs : Object {
        /**
        * add a line - note we will end up with an extra line break 
        *     at beginning of nodes doing this..
-       
+       *
        * @param str = text to add..
        * @param line_end = 0  (just add a line break)
        *        line_end = ','  and ","
@@ -299,21 +299,23 @@ public class JsRender.NodeToJs : Object {
        public void addLine(string str, char line_end)
        {
                this.ret += (this.line_end == 0 ? "" : this.last_line_end) + "\n"; 
-               this.cur_line ++;
-               this.ret += str+ "\n";
+               this.cur_line += str.split("\n").length;
+               this.ret += str;
+               
+               
                //this.ret +=  "/*%d(%d-%d)*/ ".printf(this.cur_line -1, this.node.line_start,this.node.line_end) + str + "\n";
                
                
        }
        
-       public void addMultiLine(string str= "")
+/*     public void addMultiLine(str= "")
        {
-
-               //this.ret +=   "/*%d(%d-%d)*/ ".printf(this.cur_line, this.node.line_start,this.node.line_end)+ str + "\n";
+               
+               //this.ret +=   "/ * %d(%d-%d) * / ".printf(this.cur_line, this.node.line_start,this.node.line_end)+ str + "\n";
                this.ret +=   str + "\n";
                this.cur_line += str.split("\n").length;
        }
+ */
        public string mungeChildNew(string pad ,  Node cnode )
        {
                var x = new  NodeToJs(cnode, this.doubleStringProps, pad, this);