Revision: 4464
          http://vexi.svn.sourceforge.net/vexi/?rev=4464&view=rev
Author:   clrg
Date:     2012-12-10 06:28:21 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Fix cell initialization (fixes demo)

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/cell.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-12-10 06:22:34 UTC (rev 4463)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/cell.t     
2012-12-10 06:28:21 UTC (rev 4464)
@@ -11,7 +11,10 @@
         // performed before trap assignment because by this
         // point the widget is not fully constructed, which
         // means we must wait until container assignment
-        thisbox.datatype = arguments[0];
+        if (arguments.length) {
+            thisbox.datatype = arguments[0];
+            thisbox.value = arguments[1];
+        }
         
         thisbox.datatype ++= static.datatypeWrite;
         thisbox.selected ++= static.selectWrite;
@@ -20,7 +23,7 @@
     </ui:box>
     
     /** set up cell to handle incoming type */
-    const setupDatatype = function(cell, datatype) {
+    const setupDatatype = function(cell) {
         switch (cell.datatype) {
         case "bool":
         case "boolean":
@@ -41,6 +44,9 @@
             cell.value ++= static.textValueWrite;
             break;
         }
+        if (cell.value) {
+            cell.value = cell.value;
+        }
     }
     
     /** set up cell to handle incoming type */

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/cell.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/cell.t  
2012-12-10 06:22:34 UTC (rev 4463)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/cell.t  
2012-12-10 06:28:21 UTC (rev 4464)
@@ -6,27 +6,17 @@
     
     <cell>
         
+        thisbox.datatype ++= static.datatypeWrite;
         thisbox.v_ready  ++= static.readyWrite;
-        thisbox.datatype ++= static.datatypeWrite;
         
     </cell>
     
     /** set up cell to handle incoming type */
-    static.readyWrite = function(v) {
-        cascade = v;
-        var t = trapee;
-        t.v_content.minheight = 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;
-        var t = trapee;
-        var c = t.v_content;
+    const setupDatatype = function(cell) {
+        var c = cell.v_content;
         // we use an inner box for content because
         // content may be too wide to display
-        switch (t.datatype) {
+        switch (cell.datatype) {
         case "bool":
         case "boolean":
             if (c[0] == null) {
@@ -36,9 +26,9 @@
                 c[0].display = false;
             }
             c.align = "center";
-            t.selected ++= static.toggleSelectWrite;
-            t.text ++= static.toggleTextRead;
-            t.text ++= static.toggleTextWrite;
+            c.text ++= static.toggleTextRead;
+            c.text ++= static.toggleTextWrite;
+            cell.selected ++= static.toggleSelectWrite;
             break;
         case "integer":
         case "number":
@@ -55,6 +45,25 @@
         }
     }
     
+    /** set up cell to handle incoming type */
+    static.readyWrite = function(v) {
+        var t = trapee;
+        t.v_content.minheight = vexi.ui.font.height(t.font, t.fontsize, "dy");
+        t.padding = 2;
+        if (t.datatype) {
+            setupDatatype(t);
+        }
+        // cascade after, as lib.cell will put value
+        // so we want to be setup before this occurs
+        cascade = v;
+    }
+    
+    /** set up cell to handle incoming type */
+    static.datatypeWrite = function(v) {
+        cascade = v;
+        setupDatatype(trapee);
+    }
+    
     /** return value as substitute for text */
     static.toggleTextRead = function() { return trapee.value; }
     

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to