resources/Editors/Editor.Roo.grid.Grid.bjs
[app.Builder.js] / src / JsRender / Node.vala
index 063c81e..425a2a2 100644 (file)
@@ -60,7 +60,7 @@
  * special ID values
  *  +XXXX -- indicates it's a instance property / not glob...
  *  *XXXX -- skip writing glob property (used as classes that can be created...)
- * 
+ *  _XXXX -- (string) a translatable string.
  * 
  * 
  *  FORMATING?
@@ -207,8 +207,13 @@ public class JsRender.Node : Object {
                return "";
                
        }
-       public string normalize_key(string key, out string kname, out string kflag, out string ktype)
+       public void normalize_key(string key, out string kname, out string kflag, out string ktype)
        {
+               // key formats : XXXX
+               // XXX - plain
+               // string XXX - with type
+               // $ XXX - with flag (no type)
+               // $ string XXX - with flag
                kname = "";
                ktype = "-";
                kflag = "-";
@@ -216,19 +221,23 @@ public class JsRender.Node : Object {
                switch(kk.length) {
                        case 1: 
                                kname = kk[0];
-                               break;
+                               return;
                        case 2: 
                                kname = kk[1];
                                if (kk[0].length > 1) {
-                                       ktype = k[0];
+                                       ktype = kk[0];
                                } else {
-                                       kflag = k[0];
+                                       kflag = kk[0];
                                }
-                               break;
+                               return;
                        case 3:
-                       
-               
-       
+                               kname = kk[2];
+                               kflag = kk[0];
+                               ktype = kk[1];
+                               return;
+               }
+               // everything blank otherwise...
+       }
        public void set(string key, string value) {
                this.props.set(key,value);
        }
@@ -471,35 +480,64 @@ public class JsRender.Node : Object {
        {
                var ret = this.nodeTitle(true);
                var funcs = "";
+               var props = "";
+               var listen = "";
                var iter = this.props.map_iterator();
                while (iter.next()) {
-                       var i =  iter.get_key();
-                       //, iter.get_value());
+                       var i =  iter.get_key().strip();
+                       var val = iter.get_value().strip();
+                       if (val == null || val.length < 1) {
+                               continue;
+                       }
                        if ( i[0] != '|') {
+                               props += "\n\t<b>" + 
+                                       GLib.Markup.escape_text(i) +"</b> : " + 
+                                       GLib.Markup.escape_text(val.split("\n")[0]);
+                                
                                continue;
                        }
                
                        //if (i == "* init") { 
                        //      continue;
                        //}
-                       var val = iter.get_value();
+                       
                        if (Regex.match_simple("^\\s*function", val)) { 
-                               funcs += "\n<b>" + 
-                                       GLib.Markup.escape_text(i.substring(1)) +"</b> : " + 
+                               funcs += "\n\t<b>" + 
+                                       GLib.Markup.escape_text(i.substring(1)).strip() +"</b> : " + 
                                        GLib.Markup.escape_text(val.split("\n")[0]);
                                continue;
                        }
                        if (Regex.match_simple("^\\s*\\(", val)) {
-                               funcs += "\n<b>" + GLib.Markup.escape_text(i.substring(1)) +
+                               funcs += "\n\t<b>" + GLib.Markup.escape_text(i.substring(1)).strip() +
                                        "</b> : " + 
                                        GLib.Markup.escape_text(val.split("\n")[0]);
                                continue;
                        }
                        
                }
+               iter = this.listeners.map_iterator();
+               while (iter.next()) {
+                       var i =  iter.get_key().strip();
+                       var val = iter.get_value().strip();
+                       if (val == null || val.length < 1) {
+                               continue;
+                       }
+                        listen += "\n\t<b>" + 
+                                       GLib.Markup.escape_text(i) +"</b> : " + 
+                                       GLib.Markup.escape_text(val.split("\n")[0]);
+                       
+               }
+               
+               
+               if (props.length > 0) {
+                       ret+="\n\nProperties:" + props;
+               } 
                if (funcs.length > 0) {
                        ret+="\n\nMethods:" + funcs;
                } 
+               if (listen.length > 0) {
+                       ret+="\n\nListeners:" + listen;
+               } 
                return ret;
 
        }