Revision: 4430
          http://vexi.svn.sourceforge.net/vexi/?rev=4430&view=rev
Author:   clrg
Date:     2012-07-31 02:51:48 +0000 (Tue, 31 Jul 2012)
Log Message:
-----------
More row/cell tidy up

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/row.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t     
2012-07-27 05:26:10 UTC (rev 4429)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t     
2012-07-31 02:51:48 UTC (rev 4430)
@@ -12,25 +12,57 @@
         // point the widget is not fully constructed, which
         // means we must wait until container assignment
         thisbox.datatype = arguments[0];
-        if (arguments[1]) {
-            thisbox.value = arguments[1];
-        }
         
         thisbox.datatype ++= static.datatypeWrite;
         thisbox.selected ++= static.selectWrite;
-        thisbox.v_ready ++= static.readyWrite;
+        thisbox.v_ready  ++= static.readyWrite;
         
     </ui:box>
     
+    /** set up cell to handle incoming type */
+    const setupDatatype = function(cell, datatype) {
+        switch (cell.datatype) {
+        case "bool":
+        case "boolean":
+        case "integer":
+        case "number":
+        case "numeric":
+            cell.value ++= static.valueWrite;
+            break;
+        case "date":
+            cell.value ++= static.dateValueWrite;
+            break;
+        case "time":
+            cell.value ++= static.timeValueWrite;
+            break;
+        case "string":
+        case "text":
+        default:
+            cell.value ++= static.textValueWrite;
+            break;
+        }
+    }
+    
+    /** set up cell to handle incoming type */
+    static.datatypeWrite = function(v) {
+        cascade = v;
+        setupDatatype(cell);
+    }
+    
     /** force value put once ready */
     static.readyWrite = function(v) {
         cascade = v;
-        // see notes for template arguments
-        trapee.datatype = trapee.datatype;
-        if (trapee.value)
-            trapee.value = trapee.value;
+        if (trapee.datatype) {
+            // see notes for template argument
+            setupDatatype(trapee);
+        }
         trapee.v_settextcolor = true;
         trapee.textcolor ++= textcolorWrite;
+        // set minimum row size
+//        var t = trapee;
+//        t.minheight = t.paddingtop + t.paddingbottom
+//            + vexi.ui.font.height(t.font, t.fontsize, "dy");
+//        t.padding = 2;
     }
     
     /** set an arbitrary fill for this row */
@@ -58,40 +90,6 @@
         trapee[0][trapname] = v;
     }
     
-    /** set up cell to handle incoming type */
-    static.containerWrite = function(v) {
-        cascade = v;
-        var t = trapee;
-        t.minheight = t.paddingtop + t.paddingbottom
-            + vexi.ui.font.height(t.font, t.fontsize, "dy");
-        t.padding = 2;
-    }
-    
-    /** set up cell to handle incoming type */
-    static.datatypeWrite = function(v) {
-        cascade = v;
-        switch (trapee.datatype) {
-        case "bool":
-        case "boolean":
-        case "integer":
-        case "number":
-        case "numeric":
-            trapee.value ++= static.valueWrite;
-            break;
-        case "date":
-            trapee.value ++= static.dateValueWrite;
-            break;
-        case "time":
-            trapee.value ++= static.timeValueWrite;
-            break;
-        case "string":
-        case "text":
-        default:
-            trapee.value ++= static.textValueWrite;
-            break;
-        }
-    }
-    
     /** parse incoming date and display nicely */
     static.dateValueWrite = function(v) {
         cascade = v;

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/row.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/row.t      
2012-07-27 05:26:10 UTC (rev 4429)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/row.t      
2012-07-31 02:51:48 UTC (rev 4430)
@@ -9,7 +9,7 @@
         thisbox.curfill = null;
         thisbox.selected = false;
         thisbox.v_setfill = true;
-               thisbox.newCellLabel = static.newCellLabelFunc;
+        thisbox.newCellLabel = static.newCellLabelFunc;
 
         thisbox.Children  ++= static.childrenWrite;
         thisbox.fill      ++= static.fillWrite;
@@ -93,11 +93,11 @@
         }
     }
 
+    /** default cell creation implementation */
+    static.newCellLabelFunc = function(col) {
+        return new .cell(col.datatype?:"string");
+    };
 
-       static.newCellLabelFunc = function(col) {
-               return new .cell(col.datatype);
-       };
-
     /** default row value write trap */
     static.valueWrite = function(v) {
         var h = trapee.v_head;
@@ -109,13 +109,14 @@
         // make value available (can be useful)
         cascade = v;
     
-       // assign new cells
+        // assign new cells
         var n = h.numchildren;
         for (var j=0; n>j; j++) {
             var cell = trapee[j];
             if (cell == null) {
                 cell = trapee.newCellLabel(h[j]);
                 trapee[j] = cell;
+                cell.textcolor = trapee.textcolor;
             }
             cell.value = v?[j];
         }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to