summaryrefslogtreecommitdiff
path: root/objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js
diff options
context:
space:
mode:
Diffstat (limited to 'objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js')
-rw-r--r--objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js2
1 files changed, 0 insertions, 2 deletions
diff --git a/objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js b/objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js
deleted file mode 100644
index 121c7db5..00000000
--- a/objectapp/static/objectapp/js/Gnowmacs/test/dl/deprecated/js/grid.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// @require container.js
-(function(){var BASE=DlGrid.inherits(DlContainer);function DlGrid(args){args&&(D.setDefaults(this,args),typeof this._rowType=="string"&&(this._rowType=eval(this._rowType)),this._rowType||(this._rowType=DlGridRow),typeof this._headType=="string"&&(this._headType=eval(this._headType)),this._headType||(this._headType=DlGridHeadLabel),DlContainer.call(this,args))}eval(Dynarch.EXPORT("DlGrid",true));var MIN_COL_WID=20;D.DEFAULT_ARGS={_model:["model",null],_selType:["selType","row"],_rowType:["rowType",null],_headType:["headType",null]};var SO=DOM.setOuterSize,SI=DOM.setInnerSize,HTML=String.buffer("<div class='DlGrid-Headers'>","<table class='DlGrid-Table' cellspacing='0' cellpadding='0'>","<tbody><tr></tr></tbody></table></div>","<div class='DlGrid-Body'>","<table class='DlGrid-Table' cellspacing='0' cellpadding='0'>","<tbody></tbody></table></div>").get();function onBodyScroll(){this.getHeaderDiv().scrollLeft=this.getBodyDiv().scrollLeft}P._createElement=function(){BASE._createElement.call(this),this._rowsGroup=DlRadioGroup.get(),this.setContent(HTML),this.getBodyDiv().onscroll=onBodyScroll.$(this),this._initHeaders(),this._initBody()},P.getGroup=function(){return this._rowsGroup},P.getHeaderDiv=function(){return this.getElement().firstChild},P.getHandlesDiv=function(){var a=this.getHeaderDiv().childNodes[1];a||(a=CE("div",null,{className:"DlGrid-Handles"},this.getHeaderDiv()),this._resizeCaptures={onMouseMove:doResize.$(this),onMouseUp:stopResize.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:DlException.stopEventBubbling,onMouseLeave:DlException.stopEventBubbling});return a},P.getHeaderRow=function(){return this.getHeaderDiv().firstChild.rows[0]},P.getBodyDiv=function(){return this.getElement().childNodes[1]},P.getBodyTable=function(){return this.getBodyDiv().firstChild},P._onHeadClick=function(){},P._appendWidgetElement=function(a,b){if(a instanceof this._rowType){var c=this.getBodyTable();if(b!=null){var d=c.rows[b];d?d.parentNode.insertBefore(a.getElement(),d):c.firstChild.appendChild(a.getElement())}else c.firstChild.appendChild(a.getElement())}else BASE._appendWidgetElement.apply(this,arguments)},P._initHeaders=function(){var a=this._onHeadClick.$(this);this._model.foreachCol(function(b){var c=document.createElement("td");this.getHeaderRow().appendChild(c);var d=this._makeHeadLabel({parent:this,appendArgs:c,iconClass:b.getIconClass(),label:b.getLabel(),column:b,className:"DlGrid-align-"+b.getStyle("textAlign","left"),tooltip:b.tooltip});b._button=d,d.addEventListener("onClick",a)},this)},P._makeRow=function(a){return new this._rowType(a)},P._makeHeadLabel=function(a){return new this._headType(a)},P._initBody=function(){this._model.foreachRow(function(a){a=this._makeRow({parent:this,group:this._rowsGroup,value:a.id,model:a})},this),this._model.addEventListener({onInsertRow:this._insertRow.$(this),onDeleteRow:this._deleteRow.$(this),onSort:this._sort.$(this)})},P._insertRow=function(a){var b=a.getIndex();a=this._makeRow({parent:this,group:this._rowsGroup,value:a.id,model:a,appendArgs:b});for(var c=a.getElement().cells,d=this.getHeaderRow().cells,e=c.length;--e>=0;){var f=c[e],g=d[e].offsetWidth;SO(f.firstChild,g,null),SI(f,g,null)}},P._deleteRow=function(a){var b=a.getIndex();a=this.getRowByIndex(b),a.destroy()},P._sort=function(a,b,c,d){b&&(b._button.delClass("DlGridHeadLabel-sort-up"),b._button.delClass("DlGridHeadLabel-sort-down"));if(a){a._button.condClass(c,"DlGridHeadLabel-sort-down","DlGridHeadLabel-sort-up");var e=this.getBodyTable(),f=e.firstChild,g=e.rows;d=d.map(function(a){return g[a]}),d.foreach(function(a){f.appendChild(a)})}},P.__doLayout=function(){var a=this.getInnerSize(),b=this.getBodyDiv(),c=this.getHeaderDiv();SO(b,a.x,a.y-c.offsetHeight),SO(c,a.x,null),c.style.marginRight=-DOM.getScrollbarSize(b).x+"px",this.__hasLayout?this._updateFillCols():(this._initColSizes(),this.__hasLayout=true,this.getBodyTable().style.width=""),onBodyScroll.call(this)},P.getRowByIndex=function(a){try{return DlWidget.getFromElement(this.getBodyTable().rows[a])}catch(a){}},P.getRowById=function(a){return this.getRowByIndex(this._model.getRowById(a).getIndex())},P.getActualColWidth=function(a){return this.getHeaderRow().cells[a].offsetWidth},P._initColSizes=function(){var a=this.getHeaderDiv().offsetHeight+"px",b=0,c=this.getInnerSize().x-DOM.getScrollbarSize(this.getBodyDiv()).x;this._fillCols=[],this._model.foreachCol(function(a){a.fill?this._fillCols.push(a):b+=a.width||this.getActualColWidth(a.getIndex())},this);var d=c-b;b=0;function e(c){var e=c.fill?Math.floor(d*c.fill):c.width||this.getActualColWidth(c.getIndex());e=this.setColSize(c,e,true),b+=e;if(c.isResizable&&!c._resizeHandle){var f=CE("div",{left:b+"px",height:a},{className:"DlGrid-resizeHandle"},this.getHandlesDiv());is_ie&&DOM.setUnselectable(f,true),f.dl_resizeCol=c,c._resizeHandle=f,f.onmousedown=startResize.$(this,f,c)}}this._model.foreachCol(e,this)},P.setColSize=function(a,b,c){var d=a._button;if(b!=null){d.setOuterSize({x:b});var e=d.getElement().parentNode;SO(e,b,null)}var f=this.getBodyTable().rows[0];b=d.getOuterSize().x,a=a.getIndex(),Array.$(this.getBodyTable().rows).foreach(function(c){c&&(e=c.cells[a],SO(e.firstChild,b,null),SI(e,b,null))}),onBodyScroll.call(this),c||this._updateResizeHandles();return b},P._updateFillCols=function(a){if(a==null){var b=this.getBodyDiv();a=this.getHeaderRow().offsetWidth-b.offsetWidth+DOM.getScrollbarSize(b).x}this._fillCols.foreach(function(b){var c=this.getActualColWidth(b.getIndex());c-=Math.round(b.fill*a),this.setColSize(b,c)},this)},P._updateResizeHandles=function(){this._model.foreachCol(function(a){if(a._resizeHandle){var b=a._button.getElement().parentNode;a._resizeHandle.style.left=b.offsetLeft+b.offsetWidth+"px"}})},P._handle_focusKeys=function(a){var b=this.getGroup(),c=a.focusedWidget;switch(a.keyCode){case DlKeyboard.ARROW_UP:case DlKeyboard.ARROW_DOWN:case DlKeyboard.PAGE_UP:case DlKeyboard.PAGE_DOWN:var d=a.keyCode==DlKeyboard.ARROW_UP||a.keyCode==DlKeyboard.PAGE_UP?this.getPrevRow(c):this.getNextRow(c);d?(d.focus(),a.shiftKey&&this._selType=="multiple"?(b.maxChecked(null),c.checked(true),d.checked(true)):this._selType!="multiple"&&(b.maxChecked(1),d.checked(true))):(a.shiftKey||a.ctrlKey)&&c.checked(true),a.domStop=true,DlException.stopEventBubbling();break;case DlKeyboard.HOME:case DlKeyboard.END:var d=a.keyCode==DlKeyboard.HOME?this.getRowByIndex(0):this.getRowByIndex(this.getBodyTable().rows.length-1);d&&(d.focus(),a.domStop=true,this._selType!="multiple"&&(a.keyCode=DlKeyboard.ENTER,d._handle_focusKeys(a)),DlException.stopEventBubbling())}return BASE._handle_focusKeys.call(this,a)};function startResize(a,b,c){c||(c=window.event);var d=a.offsetLeft,e=DlResizeBar.getDragBar(),f=e.style;f.left=d-this.getBodyDiv().scrollLeft+1+"px",f.height="100%",f.width=a.offsetWidth-2+"px",f.top="0px",this.getElement().appendChild(e);var g=DlDialog.activateEventStopper(true);DOM.addClass(g,"CURSOR-RESIZE-E"),DlEvent.captureGlobals(this._resizeCaptures);var h=new DlEvent(c);this._resize={div:a,col:b,pos:d,orig:this.getActualColWidth(b.getIndex()),mouse:h.pos.x},DOM.stopEvent(c)}function doResize(a){var b=DlResizeBar.getDragBar(),c=this._resize.pos+a.pos.x-this._resize.mouse,d=c-this._resize.pos,e=this._resize.orig+d;e<MIN_COL_WID&&(c+=MIN_COL_WID-e,e=MIN_COL_WID),c-=this.getBodyDiv().scrollLeft,b.style.left=c+1+"px"}function stopResize(a){var b=this._resize.pos+a.pos.x-this._resize.mouse,c=b-this._resize.pos,d=this._resize.orig+c;d<MIN_COL_WID&&(b+=MIN_COL_WID-d,d=MIN_COL_WID),c=d-this._resize.orig,this.setColSize(this._resize.col,d),this._updateFillCols(c),this.getElement().removeChild(DlResizeBar.getDragBar()),DlEvent.releaseGlobals(this._resizeCaptures);var e=DlDialog.activateEventStopper(false);DOM.delClass(e,"CURSOR-RESIZE-E")}P.getNextRow=function(a){return this.getRowByIndex(a.getModel().getIndex()+1)},P.getPrevRow=function(a){return this.getRowByIndex(a.getModel().getIndex()-1)}})(),function(){var BASE=DlGridRow.inherits(DlAbstractButton);function DlGridRow(a){a&&(this._customMoveKeys=true,D.setDefaults(this,a),DlAbstractButton.call(this,a))}eval(Dynarch.EXPORT("DlGridRow",true)),D.DEFAULT_ARGS={_tagName:["tagName","tr"],_classes:["classes",{active:"DlGridRow-active",hover:"DlGridRow-hover",checked:"DlGridRow-1",unchecked:"DlGridRow-0",empty:"DlGridRow-empty",disabled:"DlGridRow-disabled"}],_btnType:["type",DlButton.TYPE.TWOSTATE],_model:["model",null],_focusable:["focusable",true],__tooltip:["tooltip",getTooltip]};function getTooltip(){var a=this.args.widget;return a.getModel().tooltip}P.getModel=function(){return this._model};function onDestroy(){this._model.removeEventListener("onChange",this._on_modelChange)}P._onClick=function(a){this.parent.getGroup().maxChecked(a.ctrlKey&&this.parent._selType=="multiple"?null:1),BASE._onClick.call(this,a)},P._handle_focusKeys=function(a){var b=this.parent,c=b.getGroup();if(a.keyCode==DlKeyboard.ENTER)c.maxChecked(a.shiftKey||a.ctrlKey&&b._selType=="multiple"?null:1),this.applyHooks("onClick",[a]),a.domStop=true;else return BASE._handle_focusKeys.call(this,a)},P._createElement=function(){DlWidget.prototype._createElement.call(this);var a=this.getElement();this._model.foreachCell(function(b,c){var d=CE("td",null,null,a);displayCell(d,b,c)},this),this._on_modelChange=this._on_modelChange.$(this),this._model.addEventListener("onChange",this._on_modelChange),this.addEventListener("onDestroy",onDestroy)},P._on_modelChange=function(a,b,c,d){switch(c){case"value":displayCell(this.getElement().cells[b.getIndex()],b,this._model.model.getColByIndex(b.getIndex()))}};function displayCell(a,b,c){a.firstChild?a.firstChild.innerHTML=b.getContent():a.innerHTML="<div class=\"DlGrid-cellData\">"+b.getContent()+"</div>",a.className="DlGrid-align-"+b.getStyle("textAlign",c.getStyle("textAlign","left"))}}(),function(){var BASE=DlGridHeadLabel.inherits(DlButton);function DlGridHeadLabel(a){a&&(this.column=a.column,a.focusable=false,this.__withIconClass="DlButton-withIcon",DlButton.call(this,a),this.column.isSortable||(this.__disabled=true))}eval(Dynarch.EXPORT("DlGridHeadLabel")),P.setWidth=function(a){this.setOuterSize({x:a})},P.label=function(a){this.setContent("<div class='DlButton-Label'>"+this._label+"</div>")},P._onClick=function(){this.column.sort()},D.DEFAULT_ARGS={_classes:["classes",{active:"DlGridHeadLabel-active",hover:"DlGridHeadLabel-hover",checked:"DlGridHeadLabel-1",unchecked:"DlGridHeadLabel-0",empty:"DlGridHeadLabel-empty",disabled:"DlGridHeadLabel-disabled"}]}}() \ No newline at end of file