//>>built
define("mill/dataBrowser/browserGridData",["dojo/DeferredList","dojox/grid/EnhancedGrid","mill/mill","mill/enhancedGridData"],function(){mill.dataBrowser||(mill.dataBrowser={});dojo.declare("mill.dataBrowser.browserGridData",[mill.enhancedGridData],{grid:null,rttiManager:null,_lastSorted:null,fetch:function(c){var d=c.sort?dojo.toJson(c.sort):null;this._lastSorted!=d&&this.close();this._lastSorted=d;return this.inherited(arguments)},_handleParams:function(c,d,b){return{handler:this.rttiManager.handle,
content:{query:b}}},_queryParams:function(c,d){var b=this.grid.preDefinedConditions()||[];b.push({part:0,special:1});this.grid.view.boldProperty&&b.push({part:0,name:this.grid.view.boldProperty.Name});this.grid.classInfo.IsHierarhical&&(b.push({part:0,special:2}),b.push({part:0,special:3}),c?b.push({part:1,name:"Parent",value:this.getValue(c,"ID"),special:5}):b.push({part:1,special:6}));dojo.forEach(this.grid.columns,dojo.hitch(this,function(a){b.push({part:0,name:a.propertyInfo.Name,special:"TBlobDomain"==
a.domainInfo.handle?"boolean":null});if(a.Filter){var f=a.propertyInfo.Name,h=a.Filter;if("TClassDomain"==a.domainInfo.handle)f="soName"==a.domainInfo.showObjectInfoType.Name?f+"$N":f+"$D";else if("TEnumerationDomain"==a.domainInfo.handle){var k=[];mill.queryCursor({className:"TEnumerationItem",handler:this.rttiManager.handle,sync:!0,query:[{part:0,name:"ID"},{part:1,name:"Master",value:a.domainInfo.ID},{part:1,name:"1"==a.domainInfo.ShowNames?"Name":"Description",value:h}],fetched:function(m){k.push(mill.fieldValue(m,
"ID"))}});k.length?h=k.join(";"):f+="1"==a.domainInfo.ShowNames?"$N":"$D"}b.push({part:1,name:f,value:h})}"TClassDomain"==a.domainInfo.handle?"soName"==a.domainInfo.showObjectInfoType.Name?b.push({part:0,name:a.propertyInfo.Name+"$N"}):b.push({part:0,name:a.propertyInfo.Name+"$D"}):"TEnumerationDomain"==a.domainInfo.handle&&("1"==a.domainInfo.ShowNames?b.push({part:0,name:a.propertyInfo.Name+"$N"}):b.push({part:0,name:a.propertyInfo.Name+"$D"}))}));if(this.grid.conditions){var e=null;if(this.grid.parentView){e=
[];var l=this.grid.store,g=this.grid.parentView.selection.getSelected();dojo.isArray(g)&&(g=g[0]);dojo.mixin(e,{className:this.grid.parentView.classInfo.ID,current:l.getIdentity(g)});e.push({name:"Current",domain:this.rttiManager.getDomain(null,"TObject domain").ID,value:e.current});dojo.forEach(this.grid.parentView.columns,function(a){e.push({name:a.propertyInfo.Name,domain:a.domainInfo.ID,value:l.getValue(g,a.propertyInfo.Name)||""})})}b.push({part:1,name:this.grid.viewID,special:16,context:e})}d.sort&&
dojo.forEach(d.sort,function(a){a.attribute&&b.push({part:2,name:a.attribute,special:a.descending?7:null})});return{handler:this.rttiManager.handle,className:this.grid.classInfo.Name+("1"==this.grid.view.PreCompiled?"$C"+this.grid.viewID:""),query:b}},_performQuery:function(c){return mill.queryCursor(c)},_hasChildren:function(c){return this.grid.classInfo.IsHierarhical&&"1"==this.getValue(c,this.grid.hasChildrenFieldName)},close:function(c){this._handle&&mill.closeCursor({sync:!0,handler:this.rttiManager.handle,
content:{query:this._handle}});this.inherited(arguments)},onItemCreated:function(c,d){c.indent=c.parentItem?c.parentItem.indent+1:0}})});