Revision: 4614
          http://sourceforge.net/p/vexi/code/4614
Author:   clrg
Date:     2013-12-18 16:19:52 +0000 (Wed, 18 Dec 2013)
Log Message:
-----------
Property 'gridalign' that can be set on grid or grid children to indicate more 
specific cell alignment

Modified Paths:
--------------
    branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/grid.t

Modified: 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/grid.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/grid.t    
2013-12-18 15:35:17 UTC (rev 4613)
+++ branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/grid.t    
2013-12-18 16:19:52 UTC (rev 4614)
@@ -452,7 +452,7 @@
          ************************************/
         
         /** ambiguous function to invoke specific packing function */
-        var pack = function() {
+        const pack = function() {
             // reset!
             numcols = 0;
             numrows = 0;
@@ -479,18 +479,18 @@
             place();
         }
         
-        var schedulePack = function() {
+        const schedulePack = function() {
             pack_children = true;
             reflow();
         }
         
-        var invokePack = function(v) {
+        const invokePack = function(v) {
             if (v == trapee[trapname]) return;
             cascade = v;
             schedulePack();
         }
         
-        var invokePlaceWidth = function(v) {
+        const invokePlaceWidth = function(v) {
             if (v != trapee[trapname]) {
                 place_horizontal = true;
                 reflow();
@@ -498,7 +498,7 @@
             cascade = v;
         }
         
-        var invokePlaceHeight = function(v) {
+        const invokePlaceHeight = function(v) {
             if (v != trapee[trapname]) {
                 place_vertical = true;
                 reflow();
@@ -506,9 +506,8 @@
             cascade = v;
         }
         
-        var sc_number = "number";
-        var checkInt = function(v) {
-            cascade = typeof(v)==sc_number ? v : vexi.string.parseInt(v);
+        const checkInt = function(v) {
+            cascade = typeof(v)=="number" ? v : vexi.string.parseInt(v);
         }
         
         /****************************
@@ -541,16 +540,9 @@
         thisbox.cols ++= function() { return userows ? numcols : setsize; }
         thisbox.rows ++= function() { return userows ? setsize : numrows; }
         
-        var gridboxChildren = function(v) {
+        const gridBoxAlign = function(v) {
             cascade = v;
-            if (v == null) {
-                var i = $content.indexof(trapee);
-                if (i==-1) {
-                    return;
-                }
-                $content[i] = null;
-                schedulePack();
-            }
+            trapee.v_gridbox.align = v;
         }
         
         /** set up children so the grid can react to them */
@@ -591,13 +583,19 @@
                 //v.minheight ++= invokePlaceWidth;
                 v.contentwidth ++= invokePlaceWidth;
                 v.contentheight ++= invokePlaceHeight;
+                v.gridalign ++= gridBoxAlign;
                 // we wrap them in an outer box which we can manipulate
                 var b = v.v_gridbox;
                 if (b == null) {
                     b = vexi.box;
                     b[0] = v;
-                    b.Children ++= gridboxChildren;
                     v.v_gridbox = b;
+                    // initialize alignment
+                    if (v.gridalign)
+                        b.align = v.gridalign;
+                    else if (gridalign)
+                        b.align = gridalign;
+                    else b.align = align;
                     // prevents a flash max-sized display before a grid layout 
thread
                     // can kick in - these properties will be set properly by 
place()
                     b.height = 0;
@@ -613,27 +611,11 @@
                 var c = null;
                 var b = $content[trapname];
                 if (b) {
-                    b.Children --= gridboxChildren;
                     c = b[0];
                 } else {
                     throw "Attempt to get null child from a box";
                 }
-                if (c) {
-                    c.colspan --= invokePack;
-                    c.colspan --= checkInt;
-                    c.rowspan --= invokePack;
-                    c.rowspan --= checkInt;
-                    c.display --= invokePack;
-                    c.maxwidth ++= invokePlaceWidth;
-                    c.maxheight ++= invokePlaceHeight;
-                    //c.minwidth ++= invokePlaceWidth;
-                    //c.minheight ++= invokePlaceWidth;
-                    c.contentwidth ++= invokePlaceWidth;
-                    c.contentheight ++= invokePlaceHeight;
-                    c.v_gridbox = null;
-                } else {
-                    throw "Should not happen";
-                }
+                if (!c) throw "Should not happen";
                 // finish removal
                 $content[trapname] = null;
             }

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


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to