[fusion-commits] r2244 - sandbox/jxlib-3.0/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Oct 7 15:30:35 EDT 2010


Author: pagameba
Date: 2010-10-07 19:30:35 +0000 (Thu, 07 Oct 2010)
New Revision: 2244

Modified:
   sandbox/jxlib-3.0/lib/jxlib.uncompressed.js
Log:
updating to latest jxlib build.

Modified: sandbox/jxlib-3.0/lib/jxlib.uncompressed.js
===================================================================
--- sandbox/jxlib-3.0/lib/jxlib.uncompressed.js	2010-10-06 20:08:43 UTC (rev 2243)
+++ sandbox/jxlib-3.0/lib/jxlib.uncompressed.js	2010-10-07 19:30:35 UTC (rev 2244)
@@ -33025,6 +33025,7 @@
         rh.setBorderBoxSize({height: tr.getBorderBoxSize().height});
       }
     }
+    this.fireEvent('gridDrawRow', [index, record]);
   },
   
   /**
@@ -33603,7 +33604,7 @@
     
     name: 'Selector',
 
-    Binds: ['select','checkSelection','checkAll','afterGridRender','onCellClick', 'sort'],
+    Binds: ['select','checkSelection','checkAll','afterGridRender','onCellClick', 'sort', 'updateCheckColumn'],
 
     options : {
         /**
@@ -33683,9 +33684,11 @@
         var options = this.options,
             template;
         this.grid = grid;
+        
 
         //setup check column if needed
         if (options.useCheckColumn) {
+          grid.addEvent('gridDrawRow', this.updateCheckColumn);
           template = '<span class="jxGridCellContent">';
           if (options.multiple) {
             template += '<span class="jxInputContainer jxInputContainerCheck"><input class="jxInputCheck" type="checkbox" name="checkAll" id="checkAll"/></span>';
@@ -33725,7 +33728,6 @@
               });
           }
         } else {
-          // grid.wantEvent('gridCellClick');
           grid.addEvent('gridCellClick', this.onCellClick);
         }
     },
@@ -33754,6 +33756,18 @@
     toElement: function() {
       return this.domObj;
     },
+    
+    /**
+     * Method: updateCheckColumn
+     * check to see if a row needs to have its checkbox updated after its been drawn
+     *
+     * Parameters:
+     * index - {Integer} the row that was just rendered
+     * record - {<Jx.Record>} the record that was rendered into that row
+     */
+    updateCheckColumn: function(index, record) {
+      this.setCheckField(index, this.selected.get('rows').contains(index));
+    },
 
     /**
      * Method: afterGridRender
@@ -33818,7 +33832,7 @@
             });
             selected.set('cells',[]);
         } else if (opt === 'row') {
-          selected.get('rows').each(function(row){
+          this.getSelectedRows().each(function(row){
             row.removeClass('jxGridRowSelected');
           });
           selected.set('rows',[]);
@@ -33905,12 +33919,13 @@
      * Parameters:
      * row - {Integer} the row to select
      */
-    selectRow: function (row) {
+    selectRow: function (row, silently) {
         if (!this.options.row) { return; }
         var options = this.options,
             r = this.grid.gridTableBody.rows,
             tr = document.id((row >= 0 && row < r.length) ? r[row] : null),
-            rows = this.selected.get('rows');
+            rows = this.selected.get('rows'),
+            silently = $defined(silently) ? silently : false;
         if (tr) {
             if (tr.hasClass('jxGridRowSelected')) {
                 tr.removeClass('jxGridRowSelected');
@@ -33923,19 +33938,23 @@
                     }
                 }
                 //search array and remove this item
-                rows.erase(tr);
-                this.fireEvent('unselectRow', row);
+                rows.erase(row);
+                if (!silently) {
+                  this.fireEvent('unselectRow', row);
+                }
             } else {
                 tr.store('jxRowData', {row: row});
-                rows.push(tr);
+                rows.push(row);
                 tr.addClass('jxGridRowSelected');
                 this.setCheckField(row, true);
-                this.fireEvent('selectRow', row);
+                if (!silently) {
+                  this.fireEvent('selectRow', row);
+                }
             }
 
             if (!this.options.multiple) {
                 var unselected = [];
-                rows.each(function(row){
+                this.getSelectedRows().each(function(row) {
                   var idx;
                   if (row !== tr) {
                     idx = row.retrieve('jxRowData').row;
@@ -33943,10 +33962,13 @@
                     this.setCheckField(idx,false);
                     rows.erase(row);
                     unselected.push(idx);
-                    this.fireEvent('unselectRow', idx);
+                    if (!silently) {
+                      this.fireEvent('unselectRow', row);
+                    }
                   }
-                },this);
-                if (unselected.length) {
+                  
+                }, this);
+                if (unselected.length && !silently) {
                   this.fireEvent('unselectRows', [unselected]);
                 }
             }
@@ -34123,9 +34145,11 @@
         var grid = this.grid,
             col,
             rows,
+            selection = [],
             checked = this.options.checkAsHeader ? 
                           grid.rowColContainer.getElement('input').get('checked') :
-                          this.checkColumn.domObj.getElement('input').get('checked');
+                          this.checkColumn.domObj.getElement('input').get('checked'),
+            event = checked ? 'selectRows' : 'unselectRows';
 
         if (this.options.checkAsHeader) {
             col = 0;
@@ -34140,10 +34164,13 @@
             if ($defined(check)) {
                 var rowChecked = check.get('checked');
                 if (rowChecked !== checked) {
-                    this.selectRow(idx);
+                    this.selectRow(idx, true);
+                    selection.push(idx);
                 }
             }
         }, this);
+        
+        this.fireEvent(event, [selection]);
     },
     
     sort: function(dir) {
@@ -34155,7 +34182,7 @@
           useHeaders = grid.row.useHeaders(),
           rowTableBody = grid.rowTableBody,
           rowParent = rowTableBody.getParent(),
-          selected = this.selected.rows;
+          selected = this.getSelectedRows();
       
       // sorting only works for rows and when more than zero are selected
       // in fact it is probably only useful if multiple selections are also enabled
@@ -34201,6 +34228,19 @@
       if (useHeaders && rowParent) {
         rowParent.adopt(rowTableBody);
       }
+    },
+    
+    getSelectedRows: function() {
+      var rows = [],
+          selected = this.selected.get('rows'),
+          r = this.grid.gridTableBody.rows;
+      selected.each(function(row) {
+        var tr = document.id((row >= 0 && row < r.length) ? r[row] : null);
+        if (tr) {
+          rows.push(tr);
+        }
+      });
+      return rows;
     }
 });
 /*
@@ -38810,7 +38850,7 @@
  - tree_vert_line.png
 ...
  */
-// $Id: tree.js 965 2010-07-07 16:27:40Z zak4ms $
+// $Id: tree.js 990 2010-10-07 17:22:02Z pagameba $
 /**
  * Class: Jx.Tree
  *
@@ -39134,8 +39174,10 @@
             if (treeItem && treeItem.getLabel() == name) {
                 if (path.length > 0) {
                     var folder = item.retrieve('jxTreeFolder');
-                    if (folder) {
+                    if (folder && path.length > 1) {
                         result = folder.findChild(path.slice(1, path.length));
+                    } else {
+                      result = treeItem;
                     }
                 } else {
                     result = treeItem;



More information about the fusion-commits mailing list