sync
[app.Builder.js] / JsRender / NodeToJs.vala
index 616d252..9826e3e 100644 (file)
@@ -26,7 +26,7 @@ public class JsRender.NodeToJs : Object {
                this.doubleStringProps = doubleStringProps;
                this.pad = pad;
                this.els = new Gee.ArrayList<string>(); 
-               this.skip = new Gee.ArrayList<string>();
+               //this.skip = new Gee.ArrayList<string>();
                this.ar_props = new Gee.HashMap<string,string>();
 
        }
@@ -35,11 +35,19 @@ public class JsRender.NodeToJs : Object {
        {
                //return this.mungeToString(this.node);
 
+       
+               
                this.checkChildren();
                this.readProps();
                this.readArrayProps();
                this.readListeners();
-               this.iterChildren();
+
+               if (!this.node.props.has_key("* xinclude")) {
+                       this.iterChildren();
+               }
+               
+               
+               
                
                if (this.els.size < 1) {
                        return "";
@@ -49,10 +57,18 @@ public class JsRender.NodeToJs : Object {
                var spad = pad.substring(0, this.pad.length-4);
                var str_props = gLibStringListJoin(",\n" + this.pad , this.els) ;
                //print ("STR PROPS: " + str_props);
-               
-               return   "{\n" +
-                       pad  + str_props + 
-                       "\n" + spad +  "}";
+               if (!this.node.props.has_key("* xinclude")) {
+                       return   "{\n" +
+                               this.pad  + str_props + 
+                               "\n" + spad +  "}";
+               }
+               // xinclude...
+
+
+               return "Roo.apply(" + this.node.props.get("* xinclude") + "._tree(), "+
+                        "{\n" +
+                               this.pad  + str_props + 
+                               "\n" + spad +  "})";
                     
        } 
 
@@ -106,7 +122,7 @@ public class JsRender.NodeToJs : Object {
                                // it's a standard prop..
                                
                                // munge property..??
-                               this.els.add( prop  + " : " + this.mungeChild (  this.pad + "   ",  pl));
+                               this.els.add( prop  + " : " + this.mungeChild (  this.pad + "    ",  pl));
                                
                                
                                //keys.push(prop);
@@ -129,7 +145,7 @@ public class JsRender.NodeToJs : Object {
                                old = this.ar_props.get(sprop);
                        }
                        var nstr  = old += old.length > 0 ? ",\n" : "";
-                       nstr += this.mungeChild( this.pad + "           ",   pl);
+                       nstr += this.mungeChild( this.pad + "           ",   pl);
                        
                        this.ar_props.set(sprop, nstr);
                         
@@ -142,12 +158,15 @@ public class JsRender.NodeToJs : Object {
  * 
  * standard properties (use to set)
  *          If they are long values show the dialog..
- * 
+ *
+ * someprop : ....
  * bool is_xxx  :: can show a pulldown.. (true/false)
  * string html  
  * $ string html  = string with value interpolated eg. baseURL + ".." 
  *  Clutter.ActorAlign x_align  (typed)  -- shows pulldowns if type is ENUM? 
- * $ untypedvalue = javascript untyped value... 
+ * $ untypedvalue = javascript untyped value...  
+ * _ string html ... = translatable..
+
  * 
  * object properties (not part of the GOjbect being wrapped?
  * # Gee.ArrayList<Xcls_fileitem> fileitems
@@ -179,6 +198,14 @@ public class JsRender.NodeToJs : Object {
        {
                string left;
                Regex func_regex ;
+
+               if (this.node.props.has_key("$ xns")) {
+        
+                       this.els.add("'|xns' : '" + this.node.props.get("$ xns") + "'");
+
+               }
+
+               
                try {
                        func_regex = new Regex("^\\s+|\\s+$");
                } catch (Error e) {
@@ -201,12 +228,12 @@ public class JsRender.NodeToJs : Object {
 
                        }
                        
-                       string leftv = kk[0] == '$' ? k.substring(2) : k;
+                       string leftv = k;
                        // skip builder stuff. prefixed with  '.' .. just like unix fs..
-                       if (leftv[0] == '.') { // |. or . -- do not output..
+                       if (kk[0][0] == '.') { // |. or . -- do not output..
                                continue;
                        }
-                        if (k[0] == '*') {
+                        if (kk[0][0] == '*') {
                                // ignore '*prop';
                                continue;
                         }
@@ -225,8 +252,16 @@ public class JsRender.NodeToJs : Object {
                        
                        
                         
-                       // next.. is it a function..
-                       if (kk[0] == '|') {
+                       // next.. is it a function.. or a raw string..
+                       if (
+                               kk[0][0] == '|' 
+                               || 
+                               kk[0][0] == '$' 
+                               || 
+                               kk[0] == "function"
+                              
+                               // ??? any others that are raw output..
+                               ) {
                                // does not hapepnd with arrays.. 
                                if (v.length < 1) {  //if (typeof(el) == 'string' && !obj[i].length) { //skip empty.
                                        continue;
@@ -255,7 +290,19 @@ public class JsRender.NodeToJs : Object {
                        // standard..
                        
                        
-                       if (Lang.isNumber(v) || Lang.isBoolean(v)) { // boolean or number...?
+                       if (
+                               Lang.isNumber(v) 
+                               || 
+                               Lang.isBoolean(v)
+                               ||
+                               kk[0].down() == "boolean"
+                               || 
+                               kk[0].down() == "bool"
+                               || 
+                               kk[0].down() == "number"
+                               || 
+                               kk[0].down() == "int"
+                           ) { // boolean or number...?
                                this.els.add(left + v.down() );
                                continue;
                        }
@@ -357,7 +404,7 @@ public class JsRender.NodeToJs : Object {
                
                
                // finally munge the children...
-               if (this.node.items.size < 0) {
+               if (this.node.items.size < 1) {
                        return;
                }
                var itms = "items : [\n";
@@ -372,7 +419,7 @@ public class JsRender.NodeToJs : Object {
                        }
                        n++;
                        itms += this.pad + "    "  +
-                               this.mungeChild( this.pad + "           ",  ele);
+                               this.mungeChild( this.pad + "        ",  ele);
                        
                        
                }
@@ -382,7 +429,11 @@ public class JsRender.NodeToJs : Object {
 
                // finally output listeners...
                
-       
+       public void xIncludeToString()
+       {
+               
+
+       }
 
 }