1/* 2Product Name: dhtmlxSuite 3Version: 5.1.0 4Edition: Professional 5License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact [email protected] 6Copyright UAB Dinamenta http://www.dhtmlx.com 7*/ 8 9if (window.dhtmlxHierarchy){ 10 11 if (window.dhtmlXCellObject) 12 dhtmlXCellObject.prototype.attachPropertyGrid = function() { 13 var p = this.attachGrid(); 14 new dhtmlXPropertyGrid(p); 15 return p; 16 } 17 18 function eXcell_tree_property(cell){ 19 if (cell){ 20 this.cell = cell; 21 this.grid = this.cell.parentNode.grid; 22 } 23 this.isDisabled = function(){ return true; } 24 this.getValue = function(){ 25 return this.cell.parentNode.valTag.innerHTML; 26 } 27 } 28 eXcell_tree_property.prototype = new eXcell_tree; 29 eXcell_tree_property.prototype.setValue = function(valAr){ 30 if (this.cell.parentNode.imgTag) 31 return this.setLabel(valAr); 32 33 34 if ((this.grid._tgc.iconTree==null)||(this.grid._tgc.iconTree!=this.grid.iconTree)){ 35 var _tgc={}; 36 _tgc.imst="<img src='"+this.grid.iconTree; 37 _tgc.imsti="<img src='"+(this.grid.iconURL||this.grid.iconTree); 38 _tgc.imact="' align='absmiddle' onclick='this."+(_isKHTML?"":"parentNode.")+"parentNode.parentNode.parentNode.parentNode.grid.doExpand(this);event.cancelBubble=true;' class='property_image'>" 39 _tgc.plus=_tgc.imst+"plus.gif"+_tgc.imact; 40 _tgc.minus=_tgc.imst+"minus.gif"+_tgc.imact; 41 _tgc.blank=_tgc.imst+"blank.gif"+_tgc.imact; 42 _tgc.start="<div style=' overflow:hidden; white-space : nowrap; height:"+(_isIE?20:19)+"px;'>"; 43 44 _tgc.itemim="<span "+(_isFF?"style='position:relative; top:2px;'":"")+"id='nodeval'>"; 45 _tgc.close="</span><div class='property_space'></div></div>"; 46 this.grid._tgc=_tgc; 47 } 48 var _h2=this.grid._h2; 49 var _tgc=this.grid._tgc; 50 51 var rid=this.cell.parentNode.idd; 52 var row=this.grid._h2.get[rid]; 53 54 if (this.grid.kidsXmlFile || this.grid._slowParse) { 55 row.has_kids=(row.has_kids||(this.cell.parentNode._attrs["xmlkids"]&&(row.state!="minus"))); 56 row._xml_await=!!row.has_kids; 57 } 58 59 60 row.image=row.image||(this.cell._attrs["image"]||"leaf.gif"); 61 row.label=valAr; 62 63 var html=[_tgc.start]; 64 65 //if has children 66 if(row.has_kids){ 67 html.push(_tgc.plus); 68 row.state="plus" 69 } 70 else 71 html.push(_tgc.imst+row.state+".gif"+_tgc.imact+_tgc.itemim); 72 73 html.push(row.label); 74 html.push(_tgc.close); 75 76 77 78 this.cell.innerHTML=html.join(""); 79 this.cell.style.paddingLeft="0px"; 80 this.cell.parentNode.imgTag=this.cell.childNodes[0].childNodes[0]; 81 this.cell.parentNode.valTag=this.cell.childNodes[0].childNodes[1]; 82 if (row.childs.length) { 83 this.grid.getRowById(this.cell.parentNode.idd)._attrs["class"] = " dhx_parent_row "; 84 this.cell.nextSibling.style.borderLeft="1px solid #D4D0C8"; 85 } 86 87 if (_isKHTML) this.cell.vAlign="top"; 88 if (row.parent.id!=0 && row.parent.state=="plus"){ 89 this.grid._updateTGRState(row.parent,false); 90 this.cell.parentNode._skipInsert=true; 91 } 92 93 this.grid.callEvent("onCellChanged",[rid,this.cell._cellIndex,valAr]); 94 } 95} 96 97function eXcell_list(cell){ 98 if (cell){ 99 this.cell=cell; 100 this.grid=this.cell.parentNode.grid; 101 } 102 this.edit=function(){ 103 this.cell.innerHTML="<select style='width:100%;' ></select>"; 104 this.obj=this.cell.firstChild; 105 this.obj.onclick=function(e){ 106 (e||event).cancelBubble=true 107 } 108 this.obj.onmousedown=function(e){ 109 (e||event).cancelBubble=true 110 } 111 this.obj.onkeydown=function(e){ 112 var ev = (e||event); 113 114 if (ev.keyCode == 9 || ev.keyCode == 13){ 115 globalActiveDHTMLGridObject.entBox.focus(); 116 globalActiveDHTMLGridObject.doKey({ 117 keyCode: ev.keyCode, 118 shiftKey: ev.shiftKey, 119 srcElement: "0" 120 }); 121 122 return false; 123 } 124 ev.cancelBubble=true 125 } 126 127 var self=this; 128 this.obj.onchange=function(){ 129 self.grid.editStop(); 130 self=null; 131 } 132 133 134 var opt=this.getAttribute("values").split(","); 135 for (var i=0; i < opt.length; i++) 136 this.obj.options[i]=new Option(opt[i],opt[i]); 137 this.obj.value=this.cell._val 138 this.obj.focus() 139 } 140 this.getValue=function(){ 141 return this.cell._val; 142 } 143 144 this.detach=function(){ 145 var val=this.obj.value; 146 var sel=this.obj.selectedIndex; 147 this.setValue(sel==-1?"":this.obj.options[sel].value); 148 return val!= this.getValue(); 149 } 150} 151eXcell_list.prototype=new eXcell; 152 153eXcell_list.prototype.setValue=function(val){ 154 this.cell._val=val; 155 if (!val||val.toString()._dhx_trim() == ""){ 156 this.cell._clearCell=true; 157 this.setCValue(" ",""); 158 } else { 159 this.cell._clearCell=false; 160 this.setCValue(this.grid._aplNF(val, this.cell._cellIndex)); 161 } 162} 163 164 165 166 function dhtmlXPropertyGrid(cont){ 167 var t; 168 if (cont.objBox) 169 t = cont; 170 else 171 t = new dhtmlXGridObject(cont); 172 173 t.setHeader("Name,Value"); 174 t.setColAlign("left,left"); 175 176 if (window.dhtmlxHierarchy){ 177 //treegrid available 178 t.setColTypes("tree_property,ro"); 179 t.isTreeGrid=function(){return true;} 180 t.enableSmartXMLParsing(false) 181 } else 182 t.setColTypes("ro,ro"); 183 t.setColSorting("na,na") 184 t.setInitWidths("*,*"); 185 t.setNoHeader(true); 186 t.setSkin("dhx_skyblue"); 187 t.entBox.className += " gridbox_property"; 188 189 t.i18n.validation_error="Value is incorrect"; 190 t.attachEvent("onRowSelect",function(id,ind){ 191 if (!this.editor){ 192 this.selectCell(this.getRowIndex(id),1); 193 this.editCell(); 194 } 195 }) 196 t.attachEvent("onBeforeSelect",function(id){ 197 //if (this._h2 && this._h2.get[id].childs.length) return false; 198 if (this._block_selection) return false; 199 return true; 200 }) 201 t.attachEvent("onRowCreated",function(id,row){ 202 if (!this._h2 || !this._h2.get[id].childs.length){ 203 row.childNodes[1].style.backgroundColor="white"; 204 } 205 }) 206 t.attachEvent("onEditCell",function(stage,id,ind,nv,ov){ 207 if (stage==1 && this.editor && this.editor.obj && this.editor.obj.select) 208 this.editor.obj.select(); 209 if (stage==2 && ov!=nv) { 210 var val=this.cells(id,1).getAttribute("validate"); 211 var result=true; 212 switch(val){ 213 case "int": 214 result=(parseFloat(nv)==nv); 215 break; 216 } 217 if (result){ 218 this._block_selection=false; 219 this.callEvent("onPropertyChanged",[this.cells(id,0).getValue(),nv,ov]); 220 } else { 221 alert(this.i18n.validation_error); 222 this._block_selection=true; 223 var self=this; 224 window.setTimeout(function(){ 225 self.selectCell(id,ind) 226 self.editCell(); 227 },1) 228 } 229 } 230 return true; 231 }) 232 t._key_events.k13_0_0=t._key_events.k9_0_0=t._key_events.k40_0_0; 233 t.getProperties=function(){ 234 this.editStop(true); 235 var data={}; 236 this.forEachRow(function(id){ 237 data[this.cells(id,0).getValue()]=this.cells(id,1).getValue(); 238 }); 239 return data; 240 } 241 t.setProperties=function(data){ 242 this.editStop(); 243 this.forEachRow(function(id){ 244 var t=this.cells(id,0).getValue(); 245 if (typeof data[t] != "undefined") 246 this.cells(id,1).setValue(data[t]); 247 }) 248 this.callEvent("onPropertyChanged",[]); 249 } 250 return t; 251 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.