[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6093] trunk/UI/lib/TabularForm.js



Revision: 6093
          http://sourceforge.net/p/ledger-smb/code/6093
Author:   einhverfr
Date:     2013-09-28 07:03:11 +0000 (Sat, 28 Sep 2013)
Log Message:
-----------
Outline of TabularForm widget.  Not working yet.

Modified Paths:
--------------
    trunk/UI/lib/TabularForm.js

Modified: trunk/UI/lib/TabularForm.js
===================================================================
--- trunk/UI/lib/TabularForm.js	2013-09-28 04:24:42 UTC (rev 6092)
+++ trunk/UI/lib/TabularForm.js	2013-09-28 07:03:11 UTC (rev 6093)
@@ -24,24 +24,30 @@
  * col-2
  * col-3
  * col-4
+ * ..
+ * col-n
  *
  * cols can also be passed in via the constructor.
  *
  * For resizing support we support the following:
  *
+ * vertsize-mobile
  * vertsize-small
  * vertsize-med
- * vertsize-mobile
  *
+ * and 
+ *
+ * vertlabel-mobile
+ * vertlabel-small
+ * vertlabel-med
+ *
  * mobile = width <= 480px wide
  * small = width 480-768 px wide
  * med = width 768-992px wide
  *
- * This allows generally three modes:
+ * This allows you to control whether labels appear vertically or horizontally
+ * based on column size, label size, and screen width.
  *
- * 1.  Standard (larger than size), multi-columns supported, labels horizontal
- * 2.  Single column (within size), single columns, label horizontal
- * 3.  Small (smaller than size), single column, labels vertical.
  *
  * Note that for nested TabularForm components, they are resized independently.
  *
@@ -55,21 +61,75 @@
 
 define([
     'dojox/layout/TableContainer',
-    'dojo/domClass',
+    'dojo/dom',
+    'dojo/dom-class',
     'dijit/registry',
+    'dijit/layout/ContentPane',
     'dojo/query',
+    'dojo/window',
+    'lsmb/lib/loader',
     'dojo/_base/declare'
     ],
-    function(TableContainer, cls, registry, query, declare) {
+    function(TableContainer, dom, cls, registry, cp, query, win, loader, 
+             declare) 
+    {
       return declare('dojox/layout/TableContainer',
         [TableContainer],
         {
+        vertsize: 'mobile',
+        vertlabelsize: '',
         constructor: function (mixIn, domNode){
-            
+            if (domNode !== undefined){
+                // Number of columns
+                var class_str = " " + domNode.className + " ";
+                console.log(class_str);
+                var classes = class_str.match('/ col-\d+ /');
+                classes[0].replace('s/col-//');
+                this.cols=classes[0];
+
+                //resize to one column on a size of....
+                classes = class_str.match('/ virtsize-\w+ /');
+                classes[0].replace('s/virtsize-//');
+                this.vertsize = classes[0];
+
+                //labels go vertical on a size of.....
+                classes = class_str.match('/ virtlabel-\w+ /');
+                classes[0].replace('s/virtlabel-//');
+                this.vertlabelsize = classes[0];
+            }
         },
         postCreate: function(){
+            this.inherited(arguments);
+            query('*', this.domNode).forEach(TFRenderElement(dnode)); 
         },
+        TFRenderElement: function(dnode){
+           function(dnode){
+              if (cls.contains(dnode, 'input-row')){
+                 TFRenderRow(dnode);
+              }
+              else {
+                 var widget = loader.createWidget(dnode);
+                 if (undefined !== widget) {
+                     this.addChild(widget);
+                 }
+             }
+           }
+        },
+        TFRenderRow: function (dnode){
+           var counter = 0;
+           query('*', dnode).forEach(function(dnode){
+               TFRenderElement(dnode);
+               ++counter;
+           });
+           counter = counter % this.cols;
+           for (i = counter; i < this.cols; ++i){
+               var spc = new cp({content: '&nbsp;'});
+               this.addChild(spc); 
+           }
+        },
         resize: function(){
+           //TODO:  this needs to detect container size and restructure
+           //accordingly. --CT
         }
         });
      });

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


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits