aw-2-5-3.js
上传用户:q2283699q
上传日期:2022-05-17
资源大小:10704k
文件大小:146k
- AW.Grid.Separator=AW.System.Template.subclass();AW.Grid.Separator.create=function(){var obj=this.prototype;obj.setClass("grid","separator");obj.setClass("resizable",function(){return this.getColumnProperty("resizable")?true:false});obj._raiseEvents=true;obj.setEvent("onmousedown",function(event){if(!this.getColumnProperty("resizable")){return false}var start=event.screenX;var self=this;var width=self.element().previousSibling.offsetWidth;var scroll=self.element().parentNode.parentNode.scrollLeft;function doResize(event){var w=width+event.screenX - start;w=w > 9?w:9;self.element().previousSibling.style.width=(w - AW.dx)+"px"}function endResize(event){var w=width+event.screenX - start;w=w > 9?w:9;var e=AW.opera?window:self.element();AW.detachEvent(e,"onmousemove",doResize);AW.detachEvent(e,"onmouseup",endResize);AW.detachEvent(e,"onlosecapture",endResize);AW.releaseCapture(e);AW.ignoreMouse=false;e=self.element();if(AW.gecko){try{e.parentNode.parentNode.scrollLeft=scroll;e.parentNode.focus()}catch(err){}}var id=e.previousSibling.id;if(id.match("header")){self.$owner.setColumnProperty("width",w,self.$0)}else if(id.match("topSelector")){self.$owner.setSelectorProperty("width",w)}e.previousSibling.style.width="";e=null}var e=AW.opera?window:self.element();AW.setCapture(e);AW.attachEvent(e,"onmousemove",doResize);AW.attachEvent(e,"onmouseup",endResize);AW.attachEvent(e,"onlosecapture",endResize);e=null;event.cancelBubble=true;AW.ignoreMouse=true;if(AW.opera || AW.konqueror){event.preventDefault();return false}})};
- AW.Grid.Header=AW.Templates.ImageText.subclass();AW.Grid.Header.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;function _direction(){return this.getSortProperty("direction")|| "none"}obj.setClass("sort",_direction);var sort=new AW.HTML.SPAN;sort.setClass("grid","sort");obj.setContent("box/text/sort",sort);obj.element=function(){if(typeof(this.$1)=="undefined" && this.$owner && this.$owner.$extended){return _super.element.call(this.$owner.getHeader(this.$0,0))}else{return _super.element.call(this)}}};
- AW.Grid.Row=AW.System.Template.subclass();AW.Grid.Row.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setTag("span");obj.setClass("templates","list");obj.setClass("text","normal");if(AW.gecko){obj.setAttribute("tabIndex","-1")}obj.setContent("selector",function(){return(!this.$1 || this.$1=="left")&& this.getSelectorProperty("visible")?this.getSelector():""});var span=AW.HTML.SPAN;var start=new span;start.setClass("row","start");start.setStyle("width",function(){if((!this.$1 || this.$1=="center")&& this.$name=="row" && this.getVirtualProperty("mode")){return this.getViewProperty("virtualScroll")+"px"}return 0});obj.setContent("start",start);obj.setContent("items",function(){var i,ii,a=[];var virtual=this.getVirtualProperty("mode");var indices=this.getViewProperty("indices");var offset,count;if(virtual &&(!this.$1 || this.$1=="center")&& this.$name=="row"){count=this.getViewProperty("virtualCount");offset=this.getViewProperty("virtualOffset")}else{count=this.getViewProperty("count");offset=this.getViewProperty("offset")}var clone=this.$owner.$clone;this.$owner.$clone=false;for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItem(ii).toString()}this.$owner.$clone=clone;return a.join("")});var space=new span;var box=new span;space.setClass("item","template");space.setClass("grid","cell");space.setClass("column","space");box.setClass("item","box");space.setContent("box",box);obj.setContent("end",space);obj.refreshVirtual1=function(h,a){var i,ii;var se=this.getContent("start").element();var ee=this.getContent("end").element();se.style.width=this.getViewProperty("virtualScroll")+"px";for(i=h.start1;i<h.start2;i++){se.parentNode.removeChild(se.nextSibling)}for(i=h.end1;i>h.end2;i--){ee.parentNode.removeChild(ee.previousSibling)}var indices=this.getViewProperty("indices");var clone=this.$owner.$clone;this.$owner.$clone=false;for(i=h.start1-1;i>=h.start2;i--){ii=indices?indices[i]:i;a.push(this.getItem(ii).toString())}for(i=h.end1+1;i<=h.end2;i++){ii=indices?indices[i]:i;a.push(this.getItem(ii).toString())}this.$owner.$clone=clone;se=null;ee=null};obj.refreshVirtual2=function(h,p){var i;var se=this.getContent("start").element();var ee=this.getContent("end").element();for(i=h.start1-1;i>=h.start2;i--){se.parentNode.insertBefore(p.firstChild,se.nextSibling)}for(i=h.end1+1;i<=h.end2;i++){ee.parentNode.insertBefore(p.firstChild,ee)}se=null;ee=null};var rf=obj.refresh;obj.refresh=function(){if(typeof(this.$1)=="undefined" && this.$owner.$extended){rf.call(this.$owner.getRow(this.$0,"left"));rf.call(this.$owner.getRow(this.$0,"center"));rf.call(this.$owner.getRow(this.$0,"right"))}else{rf.call(this)}};var rc=obj.refreshClasses;obj.refreshClasses=function(){if(typeof(this.$1)=="undefined" && this.$owner.$extended){rc.call(this.$owner.getRow(this.$0,"left"));rc.call(this.$owner.getRow(this.$0,"center"));rc.call(this.$owner.getRow(this.$0,"right"))}else{rc.call(this)}};AW._addMouseEvents(obj);function extendEvent(name){var f=obj[name];obj[name]=function(){if(this.$owner.$extended){f.call(this.$owner.getRow(this.$0,"left"));f.call(this.$owner.getRow(this.$0,"center"));f.call(this.$owner.getRow(this.$0,"right"))}else{f.call(this)}}}extendEvent("onMouseOver");extendEvent("onMouseOut");extendEvent("onMouseDown");extendEvent("onMouseUp")};
- AW.Grid.Rows=AW.Templates.List.subclass();AW.Grid.Rows.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setClass("grid","view");var init=new AW.System.HTML;init.setTag("marquee");init.setClass("grid","init");init.setAttribute("behavior","slide");init.setEvent("onstart",waitInit);init.setEvent("onresize",waitInit);obj.setContent("init",AW.ie?init:"");function initialize(){if(AW.ie){var e=this.getContent("init").element();if(e){e.parentNode.removeChild(e);e=null}this.setContent("init","")}if(this.$owner._initialized){return}this.$owner._initialized=true;this.setTimeout(function(){this.raiseEvent("paint")})}function waitInit(){var e=this.element();if((e && e.offsetWidth && e.offsetHeight)|| this.$owner._initialized){initialize.call(this)}else{this.setTimeout(waitInit,1000)}e=null}obj.setContent("items",function(){if(!this.$owner._initialized){if(!AW.ie){this.setTimeout(waitInit,100)}return ""}var i,ii,a=[];var virtual=this.getVirtualProperty("mode");var indices=this.getViewProperty("indices");var count,offset;if(virtual){count=this.getViewProperty("virtualCount");offset=this.getViewProperty("virtualOffset")}else{count=this.getViewProperty("count");offset=this.getViewProperty("offset")}var clone=this.$owner.$clone;this.$owner.$clone=false;for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getItem(ii).toString()}this.$owner.$clone=clone;return a.join("")});var span=AW.HTML.SPAN;var top=new span;top.setClass("view","top");top.setStyle("height",function(){return this.getVirtualProperty("mode")?this.getViewProperty("virtualScroll")+"px":0});obj.setContent("start",top);var space=new span;var box=new span;space.setClass("item","template");space.setClass("row","selector");space.setClass("selector","space");box.setClass("item","box");space.setContent("box",box);obj.setContent("end",space);obj.refresh=function(){if(this.$owner && this.$owner.$active){this.$owner.focus()}if(typeof(this.$0)=="undefined" && this.$owner.$extended){_super.refresh.call(this.$owner.getRows("left"));_super.refresh.call(this.$owner.getRows("center"));_super.refresh.call(this.$owner.getRows("right"))}else{_super.refresh.call(this)}};obj.refreshVirtual=function(){if(this.$owner && this.$owner.$active){this.$owner.focus()}var undef;var panel=this.$owner.$extended?"center":undef;var se=this.getRows(panel).getContent("start").element();var ee=this.getRows(panel).getContent("end").element();if(!se || !ee || se.nextSibling==ee){se=null;ee=null;return this.refresh()}var si=AW.object(se.nextSibling.id).$0;var ei=AW.object(ee.previousSibling.id).$0;var start1=this.getRowProperty("position",si);var end1=this.getRowProperty("position",ei);var start2=this.getRowProperty("virtualOffset");var end2=start2+this.getRowProperty("virtualCount")- 1;var h={};se=this.getRow(si,panel).getContent("start").element();ee=this.getRow(si,panel).getContent("end").element();if(!se || !ee || se.nextSibling==ee){se=null;ee=null;return this.refresh()}si=AW.object(se.nextSibling.id).$0;ei=AW.object(ee.previousSibling.id).$0;h.start1=this.getColumnProperty("position",si);h.end1=this.getColumnProperty("position",ei);h.start2=this.getColumnProperty("virtualOffset");h.end2=h.start2+this.getColumnProperty("virtualCount")- 1;if(start2 > end1 || end2 < start1 || h.start2 > h.end1 || h.end2 < h.start1){se=null;ee=null;return this.refresh()}var i,ii,j;var indices=this.getRowProperty("indices");var panels=this.$owner.$extended?["left","center","right"]:[undef];for(j=0;j<panels.length;j++){panel=panels[j];se=this.getRows(panel).getContent("start").element();ee=this.getRows(panel).getContent("end").element();se.style.height=this.getRowProperty("virtualScroll")+"px";for(i=start1;i<start2;i++){se.parentNode.removeChild(se.nextSibling)}for(i=end1;i>end2;i--){ee.parentNode.removeChild(ee.previousSibling)}}var a=[];var p=document.createElement("span");var start3=Math.max(start1,start2);var end3=Math.min(end1,end2);panel=this.$owner.$extended?"center":undef;if(h.start1 !=h.start2 || h.end1 !=h.end2){for(i=start3;i<=end3;i++){ii=indices?indices[i]:i;this.getRow(ii,panel).refreshVirtual1(h,a)}p.innerHTML=a.join("");for(i=start3;i<=end3;i++){ii=indices?indices[i]:i;this.getRow(ii,panel).refreshVirtual2(h,p)}}for(j=0;j<panels.length;j++){panel=panels[j];se=this.getRows(panel).getContent("start").element();ee=this.getRows(panel).getContent("end").element();var k=0;a=[];var clone=this.$owner.$clone;this.$owner.$clone=false;for(i=start1-1;i>=start2;i--){ii=indices?indices[i]:i;a[k++]=this.getRow(ii,panel).toString()}for(i=end1+1;i<=end2;i++){ii=indices?indices[i]:i;a[k++]=this.getRow(ii,panel).toString()}this.$owner.$clone=clone;p.innerHTML=a.join("");for(i=start1-1;i>=start2;i--){se.parentNode.insertBefore(p.firstChild,se.nextSibling)}for(i=end1+1;i<=end2;i++){ee.parentNode.insertBefore(p.firstChild,ee)}se=null;ee=null}p=null}};
- AW.Grid.Control=AW.System.Control.subclass();AW.Grid.Control.create=function(){var obj=this.prototype;var _super=this.superclass.prototype;obj.setClass("grid","control");obj.setClass("selectors",function(){return this.getSelectorVisible()?"visible":"hidden"});var focus=new AW.HTML.TEXTAREA;focus.setClass("control","focus");focus.setAttribute("tabIndex",function(){return this.getTabProperty("index")});var sample=new AW.HTML.SPAN;sample.setClass("row","sample");sample.setClass("grid","row");var box=new AW.HTML.SPAN;box.setClass("grid","box");box.setContent("focus",focus);box.setContent("html",function(){return this.getLayout()});box.setContent("sample",sample);obj.setContent("box",box);var Grid=AW.Grid.Controllers;obj.setController("size",Grid.Size);obj.setController("cell",Grid.Cell);obj.setController("edit",Grid.Edit);obj.setController("row",Grid.Row);obj.setController("view",Grid.View);obj.setController("navigation",Grid.Navigation);obj.setController("selection",Grid.SingleCell);obj.setController("sort",Grid.Sort);obj.setController("overflow",Grid.Overflow);obj.setController("scroll",Grid.Scroll);obj.setController("content",Grid.Content);obj.setController("virtual",Grid.Virtual);obj.setController("grid",Grid.Grid);obj.defineTemplate("layout",function(){return this.getScrollTemplate()});obj.defineTemplate("scroll",new AW.Scroll.Bars);obj.defineTemplate("view",new AW.Panels.Horizontal);obj.defineTemplate("panel",function(){return ""});obj.defineTemplate("rows",new AW.Grid.Rows);obj.defineTemplate("row",new AW.Grid.Row);obj.defineTemplate("cell",new AW.Templates.Cell);obj.defineTemplate("headers",new AW.Grid.Row);obj.defineTemplate("footers",new AW.Grid.Row);obj.defineTemplate("header",new AW.Grid.Header);obj.defineTemplate("footer",new AW.Templates.ImageText);obj.defineTemplate("separator",new AW.Grid.Separator);obj.defineTemplate("selector",new AW.Templates.ImageText);obj.defineTemplate("topSelector",new AW.Templates.ImageText);obj.defineTemplate("bottomSelector",new AW.Templates.ImageText);obj.defineTemplate("popup",new AW.System.Template);function value(i,j){var text=this.getCellText(i,j);var format=this.getCellFormat(i,j);return format?format.textToValue(text):AW.textToValue(text)}function position(i){return Number(i)}var models={scroll:{left:0,top:0,width:0,height:0,bars:"both"},cell:{text:"",image:"",link:"",value:value,data:"",format:"",tooltip:"",state:"",selected:false,editable:false},header:{text:"",image:"",link:"",value:value,data:"",format:"",tooltip:"",state:"",count:1,offset:0,height:20,visible:true},selector:{text:"",image:"",link:"",value:value,data:"",format:"",tooltip:"",state:"",width:20,resizable:false,visible:false},top:{text:"",image:"",link:"",value:value,data:"",format:"",tooltip:"",state:""},column:{offset:0,count:0,position:position,state:"",selected:false,resizable:true,width:100,virtualOffset:0,virtualCount:0,virtualScroll:0},row:{offset:0,count:0,position:position,state:"",selected:false,height:18,virtualOffset:0,virtualCount:0,virtualScroll:0},current:{row:0,column:0,selection:"cell"},selected:{},selection:{mode:"rows",multiple:false},sort:{column:-1,direction:""},fixed:{left:1,right:0},virtual:{mode:true,top:0},content:{width:0,height:0}};obj.defineModel("scroll",models.scroll);obj.defineModel("cell",models.cell);obj.defineModel("header",models.header);obj.defineModel("footer",models.header);obj.defineModel("selector",models.selector);obj.defineModel("top",models.top);obj.defineModel("bottom",models.top);obj.defineModel("column",models.column);obj.defineModel("row",models.row);obj.defineModel("current",models.current);obj.defineModel("selected",models.selected);obj.defineModel("selection",models.selection);obj.defineModel("sort",models.sort);obj.defineModel("virtual",models.virtual);obj.defineModel("content",models.content);obj.defineModel("panel",models.content);obj.defineModel("fixed",models.fixed);obj.defineColumnProperty("indices","",true);obj.defineRowProperty("indices","",true);obj.defineHeaderProperty("indices","",true);obj.defineFooterProperty("indices","",true);obj.defineSelectedProperty("rows",[],true);obj.defineSelectedProperty("columns",[],true);obj.setFooterVisible(false);obj.setContentWidth(100,"left");obj.setContentHeight(20,"top");obj.getFirstColumn=function(){var p=this.getColumnOffset();var a=this.getColumnIndices();return a?a[p]:p};obj.getLastColumn=function(){var p=this.getColumnOffset()+this.getColumnCount()- 1;var a=this.getColumnIndices();return a?a[p]:p};obj.getNextColumn=function(){var i=this.getCurrentColumn();var p=Math.min(this.getColumnPosition(i)+1,this.getColumnOffset()+this.getColumnCount()- 1);var a=this.getColumnIndices();return a?a[p]:p};obj.getPreviousColumn=function(){var i=this.getCurrentColumn();var p=Math.max(this.getColumnPosition(i)- 1,this.getColumnOffset());var a=this.getColumnIndices();return a?a[p]:p};obj.getFirstRow=function(){var p=this.getRowOffset();var a=this.getRowIndices();return a?a[p]:p};obj.getLastRow=function(){var p=this.getRowOffset()+this.getRowCount()- 1;var a=this.getRowIndices();return a?a[p]:p};obj.getNextRow=function(){var i=this.getCurrentRow();var p=Math.min(this.getRowPosition(i)+1,this.getRowOffset()+this.getRowCount()- 1);var a=this.getRowIndices();return a?a[p]:p};obj.getPreviousRow=function(){var i=this.getCurrentRow();var p=Math.max(this.getRowPosition(i)- 1,this.getRowOffset());var a=this.getRowIndices();return a?a[p]:p};obj.getPageUpRow=function(){var i=this.getCurrentRow();var p=Math.max(this.getRowPosition(i)- 10,this.getRowOffset());var a=this.getRowIndices();return a?a[p]:p};obj.getPageDownRow=function(){var i=this.getCurrentRow();var p=Math.min(this.getRowPosition(i)+10,this.getRowOffset()+this.getRowCount()- 1);var a=this.getRowIndices();return a?a[p]:p};obj.selectRow=function(row,mode){if(this.$edit){this.focus()}if(this.$edit){return}this._startUpdate();if(this.getCurrentSelection()!="row"){this.setCurrentSelection("row")}var start,end,i,a;var rr=this.getSelectedRows();if(!mode){if(rr.length !=1 || rr[0] !=row){this.setSelectedRows([row])}}else if(mode==1){if(!rr.length){this.setSelectedRows([row])}else{start=this.getRowPosition(rr[0]);end=this.getRowPosition(row);a=this.getRowIndices();rr=[];if(start < end){for(i=start;i <=end;i++){rr.push(a?a[i]:i)}}else{for(i=start;i >=end;i--){rr.push(a?a[i]:i)}}this.setSelectedRows(rr)}}else if(mode==2){this.setRowSelected(!this.getRowSelected(row),row)}if(row!=this.getCurrentRow()){this.setCurrentRow(row)}this._endUpdate()};obj.selectCell=function(col,row,mode){if(this.$edit){this.focus()}if(this.$edit){return}this._startUpdate();if(this.getCurrentSelection()!="cell"){this.setCurrentSelection("cell")}var start,end,i,a;var cc=this.getSelectedColumns();var rr=this.getSelectedRows();if(!mode){if(cc.length !=1 || cc[0] !=col){this.setSelectedColumns([col])}if(rr.length !=1 || rr[0] !=row){this.setSelectedRows([row])}}else if(mode==1){if(!cc.length){this.setSelectedColumns([col])}else{start=this.getColumnPosition(cc[0]);end=this.getColumnPosition(col);a=this.getColumnIndices();cc=[];if(start < end){for(i=start;i <=end;i++){cc.push(a?a[i]:i)}}else{for(i=start;i >=end;i--){cc.push(a?a[i]:i)}}this.setSelectedColumns(cc)}if(!rr.length){this.setSelectedRows([row])}else{start=this.getRowPosition(rr[0]);end=this.getRowPosition(row);a=this.getRowIndices();rr=[];if(start < end){for(i=start;i <=end;i++){rr.push(a?a[i]:i)}}else{for(i=start;i >=end;i--){rr.push(a?a[i]:i)}}this.setSelectedRows(rr)}}if(col!=this.getCurrentColumn()){this.setCurrentColumn(col)}if(row!=this.getCurrentRow()){this.setCurrentRow(row)}this._endUpdate()};obj.calculateRowState=function(i){var state="";if(this.getCurrentRow()==i){state="current"}if(this.getRowSelected(i)){state="selected"}this.setRowState(state,i)};obj.calculateCellState=function(i,j){var state="";if(this.getCurrentColumn()==i && this.getCurrentRow()==j){state="current"}if(this.getCellSelected(i,j)){state="selected"}this.setCellState(state,i,j)};obj.startCellEdit=function(text){if(this.$edit){return}var c=this.getCurrentColumn();var r=this.getCurrentRow();if(!this.getCellEditable(c,r)){return}var cell=this.getCell(c,r);return AW._startEdit(cell,text)};obj.cancelCellEdit=function(){AW._cancelEdit();this.focus();return !AW._edit};obj.endCellEdit=function(){this.focus();return !AW._edit};box.setEvent("onactivate",function(event){try{if(event.srcElement.tagName=="SPAN"){var src=AW.object(event.srcElement.id,true);if(src && src.setController && src !==this){return}var target=this;function onfocus(event){event.srcElement.detachEvent("onfocus",onfocus);target.focus();target=null}event.srcElement.attachEvent("onfocus",onfocus)}}catch(err){}});focus.setEvent("onbeforedeactivate",function(event){try{if(this.getView().element().contains(event.toElement)&& event.toElement.tagName=="SPAN"){var src=AW.object(event.toElement.id,true);if(src && src.setController && src !==this){return}event.returnValue=false;event.cancelBubble=true}}catch(err){}});focus.setEvent("onselectstart",function(event){if(AW.ie){event.cancelBubble=true}else{event.stopPropagation()}});focus.setEvent("onbeforecopy",function(event){if(AW.webkit){expandFocus.call(this,false)}});obj.getSelectedText=function(){var c,r,a,text=[];var cols=this.getSelectedColumns();var rows=this.getSelectedRows();if(this.getCurrentSelection()=="row"){cols=[];var count=this.getColumnCount();var indices=this.getColumnIndices();for(c=0;c<count;c++){cols[c]=indices?indices[c]:c}}for(r=0;r<rows.length;r++){a=[];for(c=0;c<cols.length;c++){a[c]=this.getCellText(cols[c],rows[r])}text[r]=a.join("t")}return text.join("rn")};focus.setEvent("oncut",function(event){var txt=this.getSelectedText();if(AW.ie){window.clipboardData.setData("Text",txt);event.returnValue=false}else{var e=this.getContent("box/focus").element();e.value=txt;e.select()}this.startCellEdit("")});focus.setEvent("oncopy",function(event){var txt=this.getSelectedText();if(AW.ie){window.clipboardData.setData("Text",txt);event.returnValue=false}else{var e=this.getContent("box/focus").element();e.value=txt;e.select()}});focus.setEvent("onpaste",function(event){var txt;if(AW.ie){txt=window.clipboardData.getData("Text");event.returnValue=false}else if(AW.webkit){txt=event.clipboardData.getData('text/plain');event.preventDefault();event.stopPropagation()}else{return}this.startCellEdit(txt)});obj.setEvent("oncontextmenu",function(event){if(AW.webkit){expandFocus.call(this,true)}if(AW.ffx){expandFocus.call(this,false);return ffCopy.call(this)}this.focus()});function ffCopy(){if(!AW._edit){var e=this.getContent("box/focus").element();e.value=this.getSelectedText();e.select();e.focus()}}if(AW.gecko){obj.setController("copypaste",{onKeyCtrlC:AW.ffx?ffCopy:null,onCellMouseUp:function(event){if(event.button==2){expandFocus.call(this,true);if(AW.ff3 && !AW._edit){this.getContent("box/focus").element().select()}this.setTimeout(function(){expandFocus.call(this,false)})}}})}function expandFocus(on){try{var e=this.getContent("box/focus").element();e.style.zIndex=on?1:0;e.style.width=on?"100%":"1px";e.style.height=on?"100%":"1px";e=null}catch(err){}}obj.focus=function(){try{if(this.getControlDisabled()){return}var e=this.getContent("box/focus").element();e.value=" ";if(AW.opera){e.focus()}else{e.select()}e=null}catch(err){}};obj.refresh=function(){var x=this.getScrollLeft();var y=this.getScrollTop();this.raiseEvent("onControlRefreshing");_super.refresh.call(this);this.getScroll().setStyle("visibility","hidden");this.setScrollLeft(x);this.setScrollTop(y);this.getScroll().setStyle("visibility","inherit");this.raiseEvent("onControlRefreshed")};obj.addRow=function(row){if(this.raiseEvent("onRowAdding",row)){return}var i,count=this.getRowCount();var a=this.getRowIndices();if(typeof(row)=="undefined"){row=count}if(this._cellModel && this._cellModel.addRow){this._cellModel.addRow(row)}if(!a){a=[];for(i=0;i<count;i++){a[i]=i}}a.push(row);var refresh=this.refresh;this.refresh=function(){};this.setRowIndices(a);this.setRowCount(count+1);this.setCurrentRow(row);this.setSelectedRows([row]);this.refresh=refresh;this.raiseEvent("onRowAdded",row)};obj.deleteRow=function(row){if(this.raiseEvent("onRowDeleting",row)){return}if(this._cellModel && this._cellModel.deleteRow){this._cellModel.deleteRow(row)}var i,count=this.getRowCount();var a=this.getRowIndices();if(!a){a=[];for(i=0;i<count;i++){a[i]=i}i=row}else{i=this.getRowPosition(row)}a.splice(i,1);var refresh=this.refresh;this.refresh=function(){};this.setRowIndices(a);this.setRowCount(count-1);this.setCurrentRow(i>0?a[i-1]:-1);this.setSelectedRows(i>0?[a[i-1]]:[]);this.refresh=refresh;this.raiseEvent("onRowDeleted",row)};obj.sort=function(column,direction){this.raiseEvent("doSort",direction,column)};var setCellModel=obj.setCellModel;obj.setCellModel=function(model){setCellModel.call(this,model);function dataToText(i,j){var data=this.getCellData(i,j);var format=this.getCellFormat(i,j);return format?format.dataToText(data):data}function dataToValue(i,j){var data=this.getCellData(i,j);var format=this.getCellFormat(i,j);return format?format.dataToValue(data):data}this.setCellText(dataToText);this.setCellValue(dataToValue)};obj.onControlDisabledChanged=function(value){this.setClass("disabled",value?"control":null);this.setAttribute("disabled",value?true:null)};obj._scrollSerial=0};AW.UI.Grid=AW.Grid.Control;
- AW.Grid.Extended=AW.Grid.Control.subclass();AW.Grid.Extended.create=function(){var obj=this.prototype;obj.$extended=true;obj.setController("extended",AW.Grid.Controllers.Extended);obj.setView(new AW.Panels.Grid);obj.defineTemplate("top",new AW.Templates.List);obj.defineTemplate("bottom",new AW.Templates.List);var splitColumns=function(p,j){var left=this.$owner._fixedLeft,right=this.$owner._fixedRight;var i=this.$1;switch(p){case "count":if(i=="left"){return left}if(i=="center"){return this.$owner.getColumnProperty("count")- left - right}if(i=="right"){return right}return 0;case "offset":if(i=="left"){return 0}if(i=="center"){return left}if(i=="right"){return this.$owner.getColumnProperty("count")- right}return 0;default:return this.$owner.getColumnProperty(p,j)}};obj.getHeaders().mapModel("view",splitColumns);obj.getFooters().mapModel("view",splitColumns);obj.getRow().mapModel("view",splitColumns)};
- AW.Tree.Item=AW.Templates.ImageText.subclass();AW.Tree.Item.create=function(){var obj=this.prototype;obj.setClass("tree",function(){return this.getViewProperty("count")?"folder":"leaf"});obj.setClass("expanded",function(){return this.getViewProperty("expanded")?"true":"false"});var sign=new AW.HTML.SPAN;sign.setClass("tree","sign");sign.setEvent("onclick",function(){this.raiseEvent("onTreeSignClicked")});obj.setContent("box/sign",sign)};
- AW.Tree.View=AW.System.Template.subclass();AW.Tree.View.create=function(){var obj=this.prototype;obj.setTag("span");obj.setClass("tree","view");obj.setContent("start",function(){return this.$0?this.getItem():""});obj.setContent("items",function(){if(this.$0 && !this.getViewProperty("expanded")){return ""}var i,ii,a=[];var count=this.getViewProperty("count");var offset=this.getViewProperty("offset");var indices=this.getViewProperty("indices");var clone=this.$owner.$clone;this.$owner.$clone=false;for(i=0;i<count;i++){ii=indices?indices[i+offset]:i+offset;a[i]=this.getView(ii).toString()}this.$owner.$clone=clone;return a.join("")});obj.setContent("end","")};
- AW.Tree.Group=AW.System.Template.subclass();AW.Tree.Group.create=function(){var obj=this.prototype;obj.setTag("span");obj.setClass("tree","view");obj.setContent("start",function(){return this.$0?this.getItem():""});obj.setContent("items",function(){if(this.$0 && !this.getViewProperty("expanded")){return ""}else{return this.getView()}});obj.setContent("end","")};
- AW.Tree.Control=AW.UI.List.subclass();AW.Tree.Control.create=function(){var obj=this.prototype;obj.defineTemplate("group",new AW.Tree.Group);obj.setItem(new AW.Tree.Item);obj.setScroll(function(){return this.getGroup(0)});obj.getView().mapTemplate("item",function(i){return this.$owner.getGroup(i)});obj.defineViewProperty("expanded",false);obj.onTreeSignClicked=function(src,i){if(this.getViewIndices(i)){this.setViewExpanded(!this.getViewExpanded(i),i)}};obj.onViewExpandedChanged=function(e,i){this.getGroup(i).refresh()}};AW.UI.Tree=AW.Tree.Control;
- AW.HTTP.Request=AW.System.Model.subclass();AW.HTTP.Request.create=function(){var obj=this.prototype;obj.defineProperty("URL");obj.defineProperty("async",true);obj.defineProperty("requestMethod","GET");obj.defineProperty("requestData","");obj.defineProperty("responseText",function(){return this._http?this._http.responseText:""});obj.defineProperty("responseXML",function(){return this._http?this._http.responseXML:""});obj.defineProperty("username",null);obj.defineProperty("password",null);obj.setNamespace=function(name,value){this._namespaces+=" xmlns:"+name+"=""+value+"""};obj._namespaces="";obj.setParameter=function(name,value){this["_"+name+"Parameter"]=value;if((this._parameters+" ").indexOf(" "+name+" ")< 0){this._parameters+=" "+name}};obj._parameters="";obj.setRequestHeader=function(name,value){this["_"+name+"Header"]=value;if((this._headers+" ").indexOf(" "+name+" ")< 0){this._headers+=" "+name}};obj._headers="";obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");obj.getResponseHeader=function(name){return this._http?this._http.getResponseHeader(name):""};obj.request=function(){var self=this;this._ready=false;var i,j,name,value,data="",params=this._parameters.split(" ");for(i=1;i<params.length;i++){name=params[i];value=this["_"+name+"Parameter"];if(typeof value=="function"){value=value()}if(typeof value=="object" && value.constructor==Array){for(j=0;j<value.length;j++){data+=encodeURIComponent(name)+"="+encodeURIComponent(value[j])+"&"}}else{data+=encodeURIComponent(name)+"="+encodeURIComponent(value)+"&"}}var URL=this._URL;if((this._requestMethod !="POST")&& data){URL+="?"+data;data=null}this._http=AW.createXMLHttpRequest();this._http.open(this._requestMethod,URL,this._async,this._username,this._password);var headers=this._headers.split(" ");for(i=1;i<headers.length;i++){name=headers[i];value=this["_"+name+"Header"];if(typeof value=="function"){value=value()}this._http.setRequestHeader(name,value)}this._http.send(data);if(this._async){this.setTimeout(wait,200)}else{returnResult()}function wait(){if(self._http.readyState==4){self._ready=true;returnResult()}else{self.setTimeout(wait,200)}}function returnResult(){var xml=self._http.responseXML;if(xml && xml.firstChild && xml.hasChildNodes()&& !(xml.firstChild && xml.firstChild.nodeName=="parsererror")&& !(xml.firstChild && xml.firstChild.firstChild && xml.firstChild.firstChild.firstChild && xml.firstChild.firstChild.firstChild.nodeName=="parsererror")){self.response(xml);xml=null;return}xml=null;self.response(self._http.responseText)}};obj.response=function(result){if(this.$owner){this.$owner.refresh()}};obj.isReady=function(){return this._ready}};
- AW.CSV.Table=AW.HTTP.Request.subclass();AW.CSV.Table.create=function(){var obj=this.prototype;obj.response=function(text){this._rows=text.split(/r*n/);if(!this._rows[this._rows.length-1]){this._rows.pop()}this._data=[];if(this.$owner){this.$owner.clearScrollModel();this.$owner.clearSelectedModel();this.$owner.clearSortModel();this.$owner.clearRowModel();this.$owner.setRowCount(this.getCount());this.$owner.refresh()}};obj._rows=[];obj._data=[];obj.getCount=function(){return this._rows.length};obj.getData=function(c,r){if(!this._data[r]){if(!this._rows[r]){return ""}this._data[r]=this._rows[r].replace(x1,s1).replace(x2,s2).split(s3)}return this._data[r][c] || ""};var x1=/(([^,t"]*)|"(([^"]|"")*)")(,|t|$)/g;var x2=/""/g;var s1="$2$3x01";var s2=""";var s3="x01"};
- AW.XML.Table=AW.HTTP.Request.subclass();AW.XML.Table.create=function(){var obj=this.prototype;obj.response=function(xml){this.setXML(xml);if(this.$owner){this.$owner.clearScrollModel();this.$owner.clearSelectedModel();this.$owner.clearSortModel();this.$owner.clearRowModel();this.$owner.setRowCount(this.getCount());this.$owner.refresh()}};obj.defineProperty("XML");obj.setXML=function(xml){if(!xml.nodeType){var s=""+xml;xml=new ActiveXObject("MSXML2.DOMDocument");xml.loadXML(s)}xml.setProperty("SelectionLanguage","XPath");if(this._namespaces){xml.setProperty("SelectionNamespaces",this._namespaces)}this._xml=xml;this._data=this._xml.selectSingleNode(this._dataPath);this._items=this._data?this._data.selectNodes(this._itemPath):null;this._ready=true};if(!AW.ie){obj.setXML=function(xml){if(!xml.nodeType){var parser=new DOMParser;xml=parser.parseFromString(""+xml,"text/xml")}else if(xml.nodeName=="XML" && xml.ownerDocument==document){var node=document.evaluate("*",xml,null,9,null).singleNodeValue;xml=document.implementation.createDocument("","",null);xml.appendChild(node)}namespaces={};var a=this._namespaces.split(" xmlns:");for(var i=1;i<a.length;i++){var s=a[i].split("=");namespaces[s[0]]=s[1].replace(/"/g,"")}this._ns={lookupNamespaceURI:function(prefix){return namespaces[prefix]}};this._xml=xml;this._data=xml.evaluate(this._dataPath,this._xml,this._ns,9,null).singleNodeValue;this._items=this._data?xml.evaluate(this._itemPath,this._data,this._ns,7,null):null;this._ready=true}}obj.getXML=function(){return this._xml};obj._dataPath="*";obj._itemPath="*";obj._valuePath="*";obj._valuesPath=[];obj._formats=[];obj.setColumns=function(array){this._valuesPath=array};obj.setRows=function(xpath){this._itemPath=xpath};obj.setTable=function(xpath){this._dataPath=xpath};obj.getCount=function(){if(!this._items){return 0}return AW.ie?this._items.length:this._items.snapshotLength};obj.getData=function(i,j){var node=this.getNode(i,j);return node?(AW.ie?node.text:node.textContent):""};obj.getNode=function(j,i){if(!this._items || !this._items[i]){return null}if(this._valuesPath[j]){return this._items[i].selectSingleNode(this._valuesPath[j])}else{return this._items[i].selectNodes(this._valuePath)[j]}};if(!AW.ie){obj.getNode=function(c,r){if(!this._items){return null}var row=this._items.snapshotItem(r);if(!row){return null}if(this._valuesPath[c]){return row.ownerDocument.evaluate(this._valuesPath[c],row,this._ns,9,null).singleNodeValue}else{return row.ownerDocument.evaluate(this._valuePath,row,this._ns,7,null).snapshotItem(c)}}}};
- document.documentElement.className+=AW._htmlClasses;
- if (AW.webkit){
- if (document.documentElement.getBoundingClientRect){ // Safari 4
- AW.getLeft = function(element){
- return element.getBoundingClientRect().left;
- };
- AW.getTop = function(element){
- return element.getBoundingClientRect().top;
- };
- }
- else {
- AW.getLeft = function(element){
- return webkitGetRectangle(element).left - webkitGetScroll(element).left;
- };
- AW.getTop = function(element){
- return webkitGetRectangle(element).top - webkitGetScroll(element).top;
- };
- var webkitGetRectangle = function(e){
- var t = e, x = 0, y = 0;
- function getPos(el){
- if (!el) {
- return {x:0, y:0};
- }
- if (el == document.body.parentNode){
- return {x:0, y:0};
- }
- if (el == document.body){
- return {x:el.offsetLeft, y:el.offsetTop};
- }
- var p = el.offsetParent;
- var pp = getPos(p);
- return {
- x: el.offsetLeft + pp.x,
- y: el.offsetTop + pp.y};
- }
- var pp = getPos(e);
- return {
- left: pp.x,
- right: pp.x + e.offsetWidth,
- top: pp.y,
- bottom: pp.y + e.offsetHeight
- };
- };
- var webkitGetScroll = function(e){
- var s = {left: 0, top: 0};
- e = e.parentNode;
- while (e && e !== document.body && e !== document.documentElement){
- s.left += e.scrollLeft;
- s.top += e.scrollTop;
- e = e.parentNode;
- }
- return s;
- };
- }
- }