Revision: 3321
          http://vexi.svn.sourceforge.net/vexi/?rev=3321&view=rev
Author:   clrg
Date:     2008-12-23 02:36:55 +0000 (Tue, 23 Dec 2008)

Log Message:
-----------
More table enhancement

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/row.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/table.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/row.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/row.t        
2008-12-21 23:17:25 UTC (rev 3320)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/row.t        
2008-12-23 02:36:55 UTC (rev 3321)
@@ -35,10 +35,16 @@
         cascade = v;
         var n = trapee.numchildren;
         for (var i=0; n>i; i++) {
-            trapee[i].v_head = v ? v[i] : null;
-            if (v==null) continue;
-            trapee[i].display = v[i].display;
-            trapee[i].minwidth = v[i].contentwidth;
+            var c = trapee[i];
+            if (v==null) {
+                c.v_head = null;
+                continue;
+            }
+            var h = v[i];
+            c.shrink = h.hshrink;
+            c.display = h.display;
+            c.minwidth = h.contentwidth;
+            c.maxwidth = h.maxwidth;
         }
     }
     

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/table.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/table.t      
2008-12-21 23:17:25 UTC (rev 3320)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/table.t      
2008-12-23 02:36:55 UTC (rev 3321)
@@ -50,6 +50,7 @@
         thisbox.th_hscroll;
         thisbox.th_vscroll;
         thisbox.fetchData;
+        thisbox.setViewInfo;
         
         // functions that should be forwarded onto th_body
         thisbox.loadData = static.bodyNotSet;
@@ -168,12 +169,12 @@
             // establish the rows the table is attempting to view
             viewindex = max(floor((-th_bodyview.y) / rowheight), 0);
             viewfinal = min(numrows, viewindex+ceil(th_bodyport.height / 
rowheight)+1);
+            if (setViewInfo) setViewInfo(viewindex, viewfinal-viewindex+1);
             var fetchindex, fetchcount;
-            if (thisbox.setInfo) thisbox.setInfo(viewindex, 
viewindex-viewfinal);
             // fetch all the rows on display
             if (fetchfull or activeindex==null or activeindex>=viewfinal or 
viewindex>=activefinal) {
                 fetchindex = viewindex;
-                fetchcount = viewfinal-viewindex;
+                fetchcount = viewfinal-viewindex+1;
             // repeat attempt to fetch rows on display
             } else if (activeindex==viewindex and activefinal==viewfinal) {
                 //util.common..logException("repeat: 
"+activeindex+"->"+activefinal);
@@ -184,7 +185,7 @@
                 fetchcount = activeindex-viewindex;
             // previous display clips below desired display
             } else {
-                fetchindex = activefinal;
+                fetchindex = activefinal+1;
                 fetchcount = viewfinal-activefinal;
             }
             // nothing to fetch
@@ -198,7 +199,7 @@
             // keep body in sync with bodyport
             b.height = height;
             // our starting y position for offsetting rows
-            viewoffset = -(viewy%rowheight);
+            viewoffset = -(ceil(viewy)%rowheight);
             for (var i=0; n>i; i++) {
                 r = b[i];
                 if (r) {
@@ -288,8 +289,8 @@
         
         /** if fetchData is defined, become a large dynamic table */
         thisbox.fetchData ++= function(v) {
+            cascade = v;
             initAsDynamic();
-            cascade = v;
         }
         
         /** used for setting up dynamic tables */
@@ -369,8 +370,8 @@
             return;
         }
         
-        /** match column widths with column headers */
-        var colwidthWrite = function(v) {
+        /** match column minwidths with column header contentwidth */
+        var col_minwidthWrite = function(v) {
             cascade = v;
             var ind = th_head.indexof(trapee);
             if (th_foot and th_foot[ind]) th_foot[ind].minwidth = v;
@@ -378,6 +379,15 @@
             for (var i=0; n>i; i++) th_body[i][ind].minwidth = v;
         }
         
+        /** match column properties to column header properties */
+        var col_propWrite = function(v) {
+            cascade = v;
+            var ind = th_head.indexof(trapee);
+            if (th_foot and th_foot[ind]) th_foot[ind][trapname] = v;
+            var n = th_body.numchildren;
+            for (var i=0; n>i; i++) th_body[i][ind][trapname] = v;
+        }
+        
         /** set up table components */
         thisbox.v_container ++= function(v) {
             cascade = v;
@@ -398,21 +408,33 @@
                     
                     // set up existing column headers
                     for (var i=0; c.numchildren > i; i++) {
-                        c[i].action ++= actionWrite;
-                        c[i].contentwidth ++= colwidthWrite;
+                        var h = c[i];
+                        h.action ++= actionWrite;
+                        h.contentwidth ++= col_minwidthWrite;
+                        h.display ++= col_propWrite;
+                        h.hshrink ++= col_propWrite;
+                        h.maxwidth ++= col_propWrite;
                     }
                     
                     // assign functions to new column headers
-                    c.Children ++= function(e) {
-                        if (e) {
-                            e.action ++= actionWrite;
-                            e.contentwidth ++= colwidthWrite;
+                    c.Children ++= function(h) {
+                        if (h) {
+                            h.action ++= actionWrite;
+                            h.contentwidth ++= col_minwidthWrite;
+                            h.display ++= col_propWrite;
+                            h.hshrink ++= col_propWrite;
+                            h.maxwidth ++= col_propWrite;
+                        } else {
+                            var _h = c[trapname];
+                            if (_h) {
+                                _h.action --= actionWrite;
+                                _h.contentwidth --= col_minwidthWrite;
+                                _h.display --= col_propWrite;
+                                _h.hshrink --= col_propWrite;
+                                _h.maxwidth --= col_propWrite;
+                            }
                         }
-                        if (e == null and c[trapname]) {
-                            c[trapname].action --= actionWrite;
-                            c[trapname].contentwidth --= colwidthWrite;
-                        }
-                        cascade = e;
+                        cascade = h;
                     }
                     return;
                 }


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

------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to