//>>built define("dojo/_base/kernel ../main dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/_base/event dojo/dom-attr dojo/dom-class dojo/query dojo/keys dijit/tree/ForestStoreModel ./DataGrid ./_Layout ./_FocusManager ./_RowManager ./_EditManager ./TreeSelection ./cells/tree ./_TreeView".split(" "),function(u,v,n,m,l,w,h,x,p,y,z,r,A,B,C,D,E,F){u.experimental("dojox.grid.TreeGrid");var G=n("dojox.grid._TreeAggregator",null,{cells:[],grid:null,childFields:[],constructor:function(a){this.cells=a.cells|| [];this.childFields=a.childFields||[];this.grid=a.grid;this.store=this.grid.store},_cacheValue:function(a,b,c){return a[b]=c},clearSubtotalCache:function(){this.store&&delete this.store._cachedAggregates},cnt:function(a,b,c){var e=0,d=this.store,f=this.childFields;f[b]?(c=d.getValues(c,f[b]),a.index<=b+1?e=c.length:m.forEach(c,function(c){e+=this.getForCell(a,b+1,c,"cnt")},this)):e=1;return e},sum:function(a,b,c){var e=0,d=this.store,f=this.childFields;f[b]?m.forEach(d.getValues(c,f[b]),function(c){e+= this.getForCell(a,b+1,c,"sum")},this):e+=d.getValue(c,a.field);return e},value:function(a,b,c){},getForCell:function(a,b,c,e){var d=this.store;if(!d||!c||!d.isItem(c))return"";var f=d._cachedAggregates=d._cachedAggregates||{},g=d.getIdentity(c),f=f[g]=f[g]||[];a.getOpenState||(a=this.grid.getCell(a.layoutIndex+b+1));g=a.index;f=f[g]=f[g]||{};e=e||(a.parentCell?a.parentCell.aggregate:"sum")||"sum";a.field==d.getLabelAttributes()[0]&&(e="cnt");f=f[e]=f[e]||[];return void 0!=f[b]?f[b]:(g=(a.parentCell&& a.parentCell.itemAggregates?a.parentCell.itemAggregates[a.idxInParent]:"")||"")&&d.hasAttribute(c,g)?this._cacheValue(f,b,d.getValue(c,g)):g?this._cacheValue(f,b,0):this._cacheValue(f,b,this[e](a,b,c))}});u=n("dojox.grid._TreeLayout",A,{_isCollapsable:!1,_getInternalStructure:function(a){var b=this.grid,c={type:"dojox.grid._TreeView",cells:[[]]},e=[],d=0,f=function(a,b){var c=function(c,e){var d,f={};for(d in c)f[d]=c[d];return f=l.mixin(f,{level:b,idxInParent:0a._arr[b])return 1}return this._arr.lengtha._arr.length?1:0}, isOpen:function(){return this.cell.openStates&&this.cell.getOpenState(this.item())},previous:function(){var a=this._arr.slice(0);if("0"==this._str)return null;var b=a.length-1;if(0===a[b])return a.pop(),new k(a,this.grid);a[b]--;return(new k(a,this.grid)).lastChild(!0)},next:function(){var a=this._arr.slice(0);if(this.isOpen())a.push(0);else{a[a.length-1]++;for(var b=this.level;0<=b;b--){var c=this.grid.getItem(a.slice(0,b+1));if(0b&&((b=c.next())?(a=0,c=b):a--);if(this.grid.edit.isEditing()&&(b=this.grid.getCell(a),!this.isLastFocusCell()&&!b.editable)){this._focusifyCellNode(!1); this.cell=b;this.rowIndex=c._str;this.next();return}this.setFocusIndex(c._str,a)}},previous:function(){if(this.cell){var a=(this.cell.index||0)-1,b=new k(this.rowIndex||0,this.grid);if(0>a){var c=b.previous();c?(a=this.grid.layout.cellCount-1,b=c):a=0}if(this.grid.edit.isEditing()&&(c=this.grid.getCell(a),!this.isFirstFocusCell()&&!c.editable)){this._focusifyCellNode(!1);this.cell=c;this.rowIndex=b._str;this.previous();return}this.setFocusIndex(b._str,a)}},move:function(a,b){if(this.isNavHeader())this.inherited(arguments); else if(this.cell){var c=this.grid.scroller,e=this.rowIndex,d=new k(this.rowIndex,this.grid);if(a){var f;0c.getLastPageRow(c.page)&&this.grid.setScrollTop(this.grid.scrollTop+c.findScrollTop(f)-c.findScrollTop(e))):0>a&&(d=d.previous(),f=d._arr[0],f<=c.getPageRow(c.page)&&this.grid.setScrollTop(this.grid.scrollTop-c.findScrollTop(e)-c.findScrollTop(f)))}c=this.grid.layout.cellCount-1;f=this.cell.index;for(var g=Math.min(c,Math.max(0,f+b)),t=this.grid.getCell(g),h=0>b? -1:1;0<=g&&ga.level){a=this.openAtLevels[a.level];if("boolean"==typeof a)return a;if("number"==typeof a)return e.getValues(b,c).length<=a}return this.defaultOpen},onStyleRow:function(a){if(this.layout._isCollapsable){var b=h.get(a.node,"dojoxTreeGridBaseClasses");b&&(a.customClasses=b);var b=a,c=b.node.tagName.toLowerCase(); b.customClasses+=(b.odd?" dojoxGridRowOdd":"")+(b.selected&&"tr"==c?" dojoxGridRowSelected":"")+(b.over&&"tr"==c?" dojoxGridRowOver":"");this.focus.styleRow(b);this.edit.styleRow(b)}else this.inherited(arguments)},styleRowNode:function(a,b){b&&("div"==b.tagName.toLowerCase()&&this.aggregator&&p("tr[dojoxTreeGridPath]",b).forEach(function(a){this.rows.styleRowNode(h.get(a,"dojoxTreeGridPath"),a)},this),this.rows.styleRowNode(a,b))},onCanSelect:function(a){var b=p("tr[dojoxTreeGridPath\x3d'"+a+"']", this.domNode);return b.length&&x.contains(b[0],"dojoxGridSummaryRow")?!1:this.inherited(arguments)},onKeyDown:function(a){if(!a.altKey&&!a.metaKey)switch(a.keyCode){case y.UP_ARROW:this.edit.isEditing()||"0"==this.focus.rowIndex||(w.stop(a),this.focus.move(-1,0));break;case y.DOWN_ARROW:var b=new k(this.focus.rowIndex,this),c=new k(this.rowCount-1,this),c=c.lastChild(!0);this.edit.isEditing()||b.toString()==c.toString()||(w.stop(a),this.focus.move(1,0));break;default:this.inherited(arguments)}},canEdit:function(a, b){return a.getNode(b)&&this._canEdit},doApplyCellEdit:function(a,b,c){var e=this.getItem(b),d=this.store.getValue(e,c);"number"==typeof d?a=isNaN(a)?a:parseFloat(a):"boolean"==typeof d?a="true"==a?!0:"false"==a?!1:a:d instanceof Date&&(d=new Date(a),a=isNaN(d.getTime())?a:d);this.store.setValue(e,c,a);this.onApplyCellEdit(a,b,c)}});n.markupFactory=function(a,b,c,e){var d=function(a){a=h.get(a,"width")||"auto";"auto"!=a&&"em"!=a.slice(-2)&&"%"!=a.slice(-1)&&(a=parseInt(a,10)+"px");return a},f=function(a){var b; return"table"==a.nodeName.toLowerCase()&&0===p("\x3e colgroup",a).length&&1==(b=p("\x3e thead \x3e tr",a)).length?p("\x3e th",b[0]).map(function(a){var b={type:l.trim(h.get(a,"cellType")||""),field:l.trim(h.get(a,"field")||"")};b.type&&(b.type=l.getObject(b.type));var c=p("\x3e table",a)[0];c?(b.name="",b.children=f(c),h.has(a,"itemAggregates")?b.itemAggregates=m.map(h.get(a,"itemAggregates").split(","),function(a){return l.trim(a)}):b.itemAggregates=[],h.has(a,"aggregate")&&(b.aggregate=h.get(a, "aggregate")),b.type=b.type||v.grid.cells.SubtableCell):(b.name=l.trim(h.get(a,"name")||a.innerHTML),h.has(a,"width")&&(b.width=d(a)),h.has(a,"relWidth")&&(b.relWidth=window.parseInt(h.get(a,"relWidth"),10)),h.has(a,"hidden")&&(b.hidden="true"==h.get(a,"hidden")),b.field=b.field||b.name,r.cell_markupFactory(e,a,b),b.type=b.type||v.grid.cells.Cell);b.type&&b.type.markupFactory&&b.type.markupFactory(a,b);return b}):[]};if(!a.structure){var g=f(b);g.length&&(a.structure=[{__span:Infinity,cells:[g]}])}return r.markupFactory(a, b,c,e)};return n});