AdfRichUIPeer.createPeerClass(AdfDhtmlGanttPeer,"AdfDhtmlBaseSchedulingGanttPeer");
AdfDhtmlBaseSchedulingGanttPeer.InitSubclass=function(){this._RESOURCEID="resId";this._RESOURCENAME="resName";this._TRAVEL="travel";this._CREATE_RESOURCE_MENUITEM_ID="_createRes";this._CREATE_RESOURCE_BUTTON_ID="_bCreateRes";this._UPDATE_RESOURCE_MENUITEM_ID="_updateRes";this._SNAPTO_MENUITEM_ID="_snapTo";this._DELETE_BUTTON_ID="_bDelete";this._SNAPTO_POPUP_ID="_cpSnapTo";this._PROPERTIES_POPUP_ID="_cpProp";this._DEPENDENCY_LINES_MENUITEM_ID="_dpLn";this._CM_POPUP_ID="rPopup";this._CM_CREATE_POPUP_ID=
"_rcp";this._CM_PASTE_POPUP_ID="_rpp";var a=this._GENERIC_HANDLER_MAP={};a[this._CREATE_RESOURCE_MENUITEM_ID]="createResource";a[this._CREATE_RESOURCE_BUTTON_ID]="createResource";a[this._UPDATE_RESOURCE_MENUITEM_ID]="updateResource";a[this._DEPENDENCY_LINES_MENUITEM_ID]="dependency";a=this._ACTION_HANDLER_MAP={};a[this._SNAPTO_POPUP_ID]="snapTo";a[this._SNAPTO_MENUITEM_ID]="snapTo";a[this._PROPERTIES_POPUP_ID]="properties";a[this._CM_CREATE_POPUP_ID]="create";a[this._CM_PASTE_POPUP_ID]="paste";this.draggerBackground=
this.draggerBorder=this.dragger=this.selectedTasks=null;this.isMove=this.isResize=this.dragged=!1;this.currentX=this.currentWidth=0;this.endDate=this.startDate=null;this.isRightClickOnTask=!1};AdfDhtmlBaseSchedulingGanttPeer.prototype.getSelectedTasks=function(){null==this.selectedTasks&&(this.selectedTasks=[]);return this.selectedTasks};AdfDhtmlBaseSchedulingGanttPeer.prototype.isMultipleTasksPerRow=function(){return!0};
AdfDhtmlBaseSchedulingGanttPeer.prototype.HandleComponentAction=function(a){AdfDhtmlBaseSchedulingGanttPeer.superclass.HandleComponentAction.call(this,a);var b=a.getSource();if(!b.getDisabled()){var b=b.getClientId(),c=AdfDhtmlBaseSchedulingGanttPeer._GENERIC_HANDLER_MAP,d;for(d in c)if(0<=b.indexOf(d)){this.handleAction(c[d]);a.cancel();return}c=AdfDhtmlBaseSchedulingGanttPeer._ACTION_HANDLER_MAP;for(d in c)if(0<=b.indexOf(d)){this[c[d]].call(this,a);a.cancel();return}null!=this.cachedContextMenuEvent&&
(a=this.getPositionInChart(this.cachedContextMenuEvent),a=new AdfGanttContextEvent(this.getComponent(),a),AdfPage.PAGE.queueEventToServer(a),this.cachedContextMenuEvent=null)}};AdfDhtmlBaseSchedulingGanttPeer.prototype.getChartRowContextMenuId=function(){var a=this.getDomElement().getAttribute("rcrcm");return null!=a?a:AdfDhtmlBaseSchedulingGanttPeer._CM_POPUP_ID};
AdfDhtmlBaseSchedulingGanttPeer.prototype.HandleComponentContextMenu=function(a){AdfDhtmlBaseSchedulingGanttPeer.superclass.HandleComponentContextMenu.call(this,a);var b=this.getChartTreeTableId();if(this.isRightClickOnTask){if(0<this.getSelectedTasks().length){a=a.getNativeEvent();var c=this.getComponent();this.showContextMenu(a,this.getChartContextMenuId(),c,null,null,b)}this.isRightClickOnTask=!1}else c=a.getNativeEventTarget(),this._isAncestorOrSelf(AdfPage.PAGE.findComponent(b).getPeer().getDomElement(),
c)&&null!=this.findRowKey(c)&&(a=a.getNativeEvent(),c=this.getComponent(),this.showContextMenu(a,this.getChartRowContextMenuId(),c,null,null,b),this.cachedContextMenuEvent=a)};AdfDhtmlBaseSchedulingGanttPeer.prototype.HandleComponentPopupOpened=function(a){AdfDhtmlBaseSchedulingGanttPeer.superclass.HandleComponentPopupOpened.call(this,a);a=this.getSelectedTasks();for(var b=0;b<a.length;b++)a[b].style.border="solid 1px #000000"};
AdfDhtmlBaseSchedulingGanttPeer.prototype.HandleComponentPopupClosed=function(a){AdfDhtmlBaseSchedulingGanttPeer.superclass.HandleComponentPopupOpened.call(this,a);var b=this;setTimeout(function(){b.cachedContextMenuEvent=null},0)};AdfDhtmlBaseSchedulingGanttPeer.prototype.setRightClickOnTask=function(a){this.isRightClickOnTask=!AdfAgent.AGENT.isLeftButton(a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.handleAction=function(a){var b=AdfPage.PAGE,c=this.getComponent(),d=null;if("legend"!=a){var d={},e=this.getSelectedTasksAndRowKeys();d.taskId=e.taskIds;d.rowKeys=e.rowKeys}a=new AdfGanttActionEvent(c,a,d);b.queueEventToServer(a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.startNormalSplitDrag=function(a){var b=this.dragged;AdfDhtmlBaseSchedulingGanttPeer.superclass.startNormalSplitDrag.call(this,a);if(!b&&null!=this.dragger&&null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)){b=this.getGhost();b.style.height="12px";var c=b.childNodes;c[0].style.height="12px";c[1].style.height="7px";c[2].style.width=Math.max(0,parseInt(this.dragger.parentNode.style.width)-5)+"px";for(c=0;c<this.dragger.parentNode.childNodes.length;c++){var d=
this.dragger.parentNode.childNodes[c],d=d.cloneNode(!0);d.onmouseover=null;d.onmouseout=null;d.onmousedown=null;b.firstChild.appendChild(d)}for(c=0;c<this.dragger.childNodes.length;c++)d=this.dragger.childNodes[c],d.style.display="none";b.style.width=parseInt(this.dragger.parentNode.style.width)+"px";this.currentX=AdfAgent.AGENT.getElementLeft(this.dragger.parentNode);AdfPage.PAGE.getLocaleContext().isRightToLeft()?b.style.right=parseInt(this.currentX)-parseInt(this.findElemRight(this.getDomElement()))+
"px":b.style.left=parseInt(this.currentX)-parseInt(AdfAgent.AGENT.getElementLeft(this.getDomElement()))+"px";b.style.top=parseInt(this.getY(a))-10+"px"}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.endNormalRecurringDragMove=function(a){for(var b=this.getGhost(),c=b.firstChild;c.firstChild;)c.removeChild(c.firstChild);b.style.display="none";for(c=0;c<this.dragger.childNodes.length;c++)this.dragger.childNodes[c].style.display="block";this.isMove=!1;c=AdfAgent.AGENT.getElementLeft(this.getDomElement());AdfPage.PAGE.getLocaleContext().isRightToLeft()?(parseInt(b.style.right),parseInt(this.dragger.parentNode.style.right),parseInt(this.currentX),parseInt(this.findElemRight(this.getDomElement()))):
(parseInt(b.style.left),parseInt(this.dragger.parentNode.style.left),parseInt(this.currentX),parseInt(c));AdfDhtmlBaseSchedulingGanttPeer.superclass.endNormalRecurringDragMove.call(this,a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getSelectedTasksAndRowKeys=function(){var a=this.getSelectedTasks();a.reverse();for(var b=a.pop(),c="",d="";null!=b;)""!=c&&(c+=" "),""!=d&&(d+=" "),c+=b.getAttribute(AdfDhtmlBaseGanttPeer._TASKID),d+=this.findRowKey(b),b.style.border=this.draggerBorder,b=a.pop();a={};a.taskIds=c;a.rowKeys=d;return a};
AdfDhtmlBaseSchedulingGanttPeer.prototype.create=function(a){this._handleContextMenuAction(this.cachedContextMenuEvent,"cmCreate");this.cachedContextMenuEvent=null};AdfDhtmlBaseSchedulingGanttPeer.prototype.paste=function(a){this._handleContextMenuAction(this.cachedContextMenuEvent,"cmPaste");this.cachedContextMenuEvent=null};
AdfDhtmlBaseSchedulingGanttPeer.prototype._handleContextMenuAction=function(a,b){var c={};c.actionType=b;c.rowKey=this.findRowKey(this.getTarget(a));c.location=this.getPositionInChart(a);var d=this.getComponent(),c=new AdfGanttDataChangeEvent(d,c);c.setPartial(!0);d.queueEvent(c)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.properties=function(a){var b="",c="";null!=this._currentTask&&(b=this.findRowKey(this._currentTask),c=this._currentTask.getAttribute(AdfDhtmlBaseGanttPeer._TASKID),a={actionType:"properties"},a.taskId=c,a.rowKey=b,b=this.getComponent(),a=new AdfGanttDataChangeEvent(b,a),a.setPartial(!0),b.queueEvent(a))};
AdfDhtmlBaseSchedulingGanttPeer.prototype.snapTo=function(){var a=this.dragger;null==a&&(a=this.oldDragger);var b=a.parentNode,c=b.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);null==c&&(a=a.parentNode,b=b.parentNode,c=b.getAttribute(AdfDhtmlBaseGanttPeer._TASKID));if(null!=c){for(var d=AdfPage.PAGE.getLocaleContext().isRightToLeft(),e=0,f=null,g=d?parseInt(b.style.right):parseInt(b.style.left),a=parseInt(a.style.width),g=g+a,h=0;h<b.parentNode.childNodes.length;h++){var l=b.parentNode.childNodes[h],
m=l.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);if(null!=m&&m!=c&&(l=d?parseInt(l.style.right):parseInt(l.style.left),g<l&&(0==e||0<e&&e>l)))e=l,f=m}0<e&&0<e-a-4&&(d=b.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID),e=this.findRowKey(b.parentNode),b={actionType:"snapTo"},b.taskId=c,b.fromResourceId=d,b.rowKeys=e,b.nextTaskId=f,c=this.getComponent(),f=new AdfGanttDataChangeEvent(c,b),f.setPartial(!0),c.queueEvent(f));this.oldDragger=null}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.selectTask=function(a,b){this.draggerBorder=a.style.border;this.addSelectedTask(a)};AdfDhtmlBaseSchedulingGanttPeer.prototype.deselectTask=function(a,b){this.removeSelectedTasks();a.style.border=this.draggerBorder};
AdfDhtmlBaseSchedulingGanttPeer.prototype.isTaskSelected=function(a){var b=a.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);a=a.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID);if(null==b)return-1;for(var c=this.getSelectedTasks(),d=c.length-1;0<=d;d--)if(c[d].getAttribute(AdfDhtmlBaseGanttPeer._TASKID)==b&&(null==a||null==c[d].getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)||c[d].getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)==a))return d;return-1};
AdfDhtmlBaseSchedulingGanttPeer.prototype.addSelectedTask=function(a){a=this.findTopLevelTask(a);var b="add",c=this.isTaskSelected(a);if(-1<c){if(this.isRightClickOnTask){b={};b.taskId=a.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);c=this.getComponent();b=new AdfGanttActionEvent(c,"setCurrent",b);AdfPage.PAGE.queueEventToServer(b);return}this.removeSelectedTask(a);b=this.selectedTasks.slice(0,c);c=this.selectedTasks.slice(c+1);this.selectedTasks=b.concat(c);b={};b.taskId=a.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);
c=this.getComponent();b=new AdfGanttActionEvent(c,"deselect",b);AdfPage.PAGE.queueEventToServer(b);b="remove"}else{if("1px"!=AdfAgent.AGENT.getComputedStyle(a).borderTopWidth){var c=AdfAgent.AGENT.getComputedStyle(a).marginTop,d=c.indexOf("px");-1!=d&&(c=parseInt(c.substring(0,d)),a.style.marginTop=c-1+"px");AdfPage.PAGE.getLocaleContext().isRightToLeft()?a.style.right=parseInt(a.style.right)-1+"px":a.style.left=parseInt(a.style.left)-1+"px"}a.style.border="solid 1px #000000";a.style.zIndex=3;d=this.getSelectedTasks();
d.push(a);this._currentTask=a}for(var d=this.getSelectedTasks(),c="",e=d.length-1;0<=e;e--)""!=c&&(c+=" "),c+=d[e].getAttribute(AdfDhtmlBaseGanttPeer._TASKID);d=a.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID);if(null==d)for(e=a.parentNode.parentNode;null!=e;){if(null!=e.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID)){d=e.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID);break}e=e.parentNode}var f=this.findRowKey(a),g=a.getAttribute(AdfDhtmlBaseGanttPeer._TASKID),
e=this.getComponent();a=null==a.getAttribute("data-tooltip")?a.parentNode.id:null;a=new AdfGanttSelectionEvent(e,d,f,g,c,b,a);a.setPartial(!0);e.queueEvent(a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.removeSelectedTask=function(a){a.style.border=this.draggerBorder;var b=AdfAgent.AGENT.getComputedStyle(a).marginTop,c=b.indexOf("px");-1!=c&&(b=parseInt(b.substring(0,c)),a.style.marginTop=b+1+"px");AdfPage.PAGE.getLocaleContext().isRightToLeft()?a.style.right=parseInt(a.style.right)+1+"px":a.style.left=parseInt(a.style.left)+1+"px";a.style.zIndex=2};
AdfDhtmlBaseSchedulingGanttPeer.prototype.setupResourceActionEvent=function(a){var b=a.getNativeEvent(),c=a.getNativeEventTarget();for(a=c.getAttribute("resid");null==a&&null!=c&&c!=this.getDomElement();)c=c.parentElement,null!=c&&(a=c.getAttribute("resid"));if(null!=a){var c=this.getPositionInChart(b),d={};d.rid=a;d.location=c;this.m_resourceAction=d;this.m_eventPosition=this.getEventPosition(b)}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.queueResourceActionEvent=function(a){if(null!=this.m_resourceAction&&null!=this.m_eventPosition){var b=this.getComponent();a=a.getNativeEvent();a=this.getEventPosition(a);a=this.m_eventPosition.x==a.x&&this.m_eventPosition.y==a.y?new AdfGanttResourceActionEvent(b,this.m_resourceAction):new AdfGanttResourceActionEvent(b);a.setPartial(!0);b.queueEvent(a)}this.m_eventPosition=this.m_resourceAction=null};
AdfDhtmlBaseSchedulingGanttPeer.prototype.HandleComponentClick=function(a){this.queueResourceActionEvent(a);AdfDhtmlBaseSchedulingGanttPeer.superclass.HandleComponentClick.call(this,a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.DispatchComponentEvent=function(a){a.getType()==AdfSelectionEvent.SELECTION_EVENT_TYPE&&!(a instanceof AdfSelectionWrapperEvent)&&null!=this.m_resourceAction&&(a.cancel(),(new AdfSelectionWrapperEvent(a)).queue());AdfDhtmlBaseSchedulingGanttPeer.superclass.DispatchComponentEvent.call(this,a)};AdfDhtmlBaseSchedulingGanttPeer.prototype.removeSelectedTasks=function(){for(var a=this.getSelectedTasks();0<a.length;){var b=a.pop();this.removeSelectedTask(b)}};
AdfDhtmlBaseSchedulingGanttPeer.setSelectedTasks=function(a,b){for(var c=AdfPage.PAGE.findComponent(a).getPeer(),d=c.getSelectedTasks(),e=d.length=0;e<b.length;e++){var f=c._getSelectedRowKeyAndRow(b[e],a);if(null!=f&&null!=f.row){var g=AdfDhtmlBaseSchedulingGanttPeer.findTaskByRow(f.row.firstChild.firstChild,b[e+1]);if(null!=g){g.style.border="solid 1px #000000";var f=AdfAgent.AGENT.getComputedStyle(g).marginTop,h=f.indexOf("px");-1!=h&&(f=parseInt(f.substring(0,h)),g.style.marginTop=f-1+"px");g.style.zIndex=
3;d.push(g)}e++}}null!=g&&(this._currentTask=g)};AdfDhtmlBaseSchedulingGanttPeer.findTaskByRow=function(a,b){if("DIV"==a.nodeName){var c=AdfAgent.AGENT.getAttribute(a,AdfDhtmlBaseGanttPeer._TASKID);if(null!=c&&c==b)return a}for(c=0;c<a.childNodes.length;c++){var d=AdfDhtmlBaseSchedulingGanttPeer.findTaskByRow(a.childNodes[c],b);if(null!=d)return d}return null};
AdfDhtmlBaseSchedulingGanttPeer.prototype.showResizeCursor=function(a){this.dragged||(this.dragger=this.getTarget(a),this.isCtrlClick(a)||(!this.isFeatureOff("edit")&&this.areEditsEnabled()&&(this.dragger.style.cursor="w-resize"),this.isResize=!0,this.isMove=!1,null!=this.getTooltip()&&this.showTooltip(a)))};
AdfDhtmlBaseSchedulingGanttPeer.prototype.showMoveCursor=function(a){if(!this.dragged){this.dragger=this.getTarget(a);!this.isFeatureOff("edit")&&this.areEditsEnabled()&&(this.dragger.style.cursor="move");if("IMG"==this.dragger.nodeName||this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._INNER)this.dragger=this.findElement(this.dragger,AdfDhtmlBaseGanttPeer._TASKID).firstChild;this.selectedDivBorder=this.draggerBorder=this.dragger.style.border;this.setSelectedTask(this.dragger.parentNode);
this.isCtrlClick(a)||(this.isMove=!0,this.isResize=!1,null!=this.getTooltip()&&this.showTooltip(a))}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.startNormalEntireDrag=function(a){if(!this.dragged){this.fromResourceId=this.dragger.parentNode.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID);this.fromResourceName=this.dragger.parentNode.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCENAME);this.fromResourceRowKey=this.findRowKey(this.dragger.parentNode.parentNode);null==this.fromResourceName&&(this.fromResourceName=this.fromResourceId);this.taskId=this.dragger.parentNode.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);
a.cancelBubble=!0;this.globalStartX=this.getX(a);this.globalStartY=this.getY(a);this.dragged=!0;this.startDate=new Date(parseInt(this.dragger.parentNode.getAttribute(AdfDhtmlBaseGanttPeer._STARTTIME)));this.endDate=new Date(parseInt(this.dragger.parentNode.getAttribute(AdfDhtmlBaseGanttPeer._ENDTIME)));var b=this.getTooltip();null!=b&&(b.style.display="none");if(null!=this.dragger&&this.isMove){b=this.getGhost();b.style.height="15px";var c=b.childNodes;c[0].style.height="15px";c[1].style.height="10px";
c[2].style.width=Math.max(0,parseInt(this.dragger.parentNode.style.width)-5)+"px";for(c=0;c<this.dragger.parentNode.childNodes.length;c++){var d=this.dragger.parentNode.childNodes[c].cloneNode(!1);b.firstChild.appendChild(d)}this.currentX=AdfAgent.AGENT.getElementLeft(this.dragger.parentNode);b.style.width=this.dragger.parentNode.style.width;AdfPage.PAGE.getLocaleContext().isRightToLeft()?b.style.right=parseInt(this.currentX)-parseInt(this.findElemRight(this.getDomElement()))+"px":b.style.left=parseInt(this.currentX)-
parseInt(AdfAgent.AGENT.getElementLeft(this.getDomElement()))+"px";b.style.top=parseInt(this.getY(a))-10+"px";b.style.opacity=0.75;b.style.filter="alpha(opacity\x3d75)";this.currentX=this.dragger.parentNode.style.left;AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(this.currentX=this.dragger.parentNode.style.right)}}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.contNormalEntireDrag=function(a,b,c){this.dragged&&(a.cancelBubble=!0,this.isMove&&(this.handleTaskbarMove(a,b,c),this.handleAutoScrollMove(a,b,c)),this.renderDateTooltip(a))};
AdfDhtmlBaseSchedulingGanttPeer.prototype.endNormalEntireDrag=function(a){a.cancelBubble=!0;this.globalStartY=this.globalStartX=0;this.dragged=!1;var b=this.getDateTooltip();null!=b&&(b.style.display="none");b=this.getComponent();if(null!=this.dragger){var c={},d=this.getAutoScrollScroller();null!=d&&(c.scrollLeft=parseInt(d.scrollLeft),c.scrollTop=parseInt(d.scrollTop));if(this.isMove){for(var e=this.getGhost(),d=e.firstChild;d.firstChild;)d.removeChild(d.firstChild);e.style.display="none";this.isMove=
!1;this.dragger.style.cursor="default";var f=AdfAgent.AGENT.getElementLeft(this.getDomElement()),d=parseInt(e.style.left)+(parseInt(this.dragger.parentNode.style.left)-parseInt(this.currentX))+parseInt(f)+this.totalScrollX;AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(d=parseInt(e.style.right)+(parseInt(this.dragger.parentNode.style.right)-parseInt(this.currentX))+parseInt(this.findElemRight(this.getDomElement()))+this.totalScrollX);if(null!=d&&null!=this.currentX&&(parseInt(this.currentX)!=parseInt(e.style.left)+
parseInt(f)&&!AdfPage.PAGE.getLocaleContext().isRightToLeft()||parseInt(this.currentX)!=parseInt(e.style.right)+parseInt(this.findElemRight(this.getDomElement()))&&AdfPage.PAGE.getLocaleContext().isRightToLeft()))a=this.findResource(a),e=null,e=null==a?this.fromResourceId:a.id,c.actionType="move",c.taskId=this.taskId,c.fromResourceId=this.fromResourceId,c.toResourceId=e,AdfPage.PAGE.getLocaleContext().isRightToLeft()?c.oldx=parseInt(this.dragger.parentNode.style.right):c.oldx=parseInt(this.dragger.parentNode.style.left),
c.newx=d,c.rowKeys=this.fromResourceRowKey+" "+a.rowKey,c=new AdfGanttDataChangeEvent(b,c),c.setPartial(!0),b.queueEvent(c)}this.dragger=null;this.currentX=-1;this.totalScrollX=0}};AdfDhtmlBaseSchedulingGanttPeer.prototype.areEditsEnabled=function(){var a=null;if(null!=this.dragger){var b=this.findTopLevelTask(this.dragger);null!=b&&(a=b.getAttribute("ea"))}return null==a?!0:!1};
AdfDhtmlBaseSchedulingGanttPeer.prototype.handleSelectTask=function(a){var b=this.findTopLevelTask(this.dragger.parentNode);if(null==this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)||!this.isResize)this.isCtrlClick(a)?AdfAgent.AGENT.disableUserSelect(this.getDomElement()):-1==this.isTaskSelected(b)&&!AdfDhtmlBaseGanttPeer.isMobileTouchDevice()&&this.removeSelectedTasks(),this.addSelectedTask(b)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.findTopLevelTask=function(a){a=this.findElement(a,AdfDhtmlBaseGanttPeer._TASKID);if(null==a)return null;null!=a.getAttribute(AdfDhtmlBaseGanttPeer._PART)&&(a=this.findElement(a.parentNode,AdfDhtmlBaseGanttPeer._TASKID));return a};
AdfDhtmlBaseSchedulingGanttPeer.prototype.startNormalDrag=function(a){if(null!=this.dragger&&!this.dragged){a.cancelBubble=!0;var b=this.findTopLevelTask(this.dragger.parentNode);this.fromResourceId=b.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID);this.fromResourceName=b.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCENAME);this.fromResourceRowKey=this.findRowKey(b.parentNode);null==this.fromResourceName&&(this.fromResourceName=this.fromResourceId);this.taskId=
b.getAttribute(AdfDhtmlBaseGanttPeer._TASKID);this.globalStartX=this.getX(a);this.globalStartY=this.getY(a);this.dragged=!0;this.startDate=new Date(parseInt(b.getAttribute(AdfDhtmlBaseGanttPeer._STARTTIME)));this.endDate=new Date(parseInt(b.getAttribute(AdfDhtmlBaseGanttPeer._ENDTIME)));var c=this.getTooltip();null!=c&&(c.style.display="none");if(null!=this.dragger)if(this.isResize){this.removeSelectedTasks();var d=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID),e=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID);
a=null;for(var f=0;f<b.childNodes.length;f++)if(c=b.childNodes[f],"DIV"==c.nodeName&&("travel"==c.getAttribute("part")&&(a=c),null==d&&null==e||null!=d&&d==c.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)||null!=e&&e==c.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)))if(c.getAttribute("part")==AdfDhtmlBaseGanttPeer._BAR||c.getAttribute("part")==AdfDhtmlBaseGanttPeer._SPLIT)this.resizeGhost=c.cloneNode(!0);AdfAgent.AGENT.setOpacity(this.resizeGhost,70);this.resizeGhost.style.positon="absolute";this.resizeGhost.style.top=
AdfAgent.AGENT.getComputedStyle(b).top;this.resizeGhost.style.marginTop=AdfAgent.AGENT.getComputedStyle(b).marginTop;null!=d?(AdfPage.PAGE.getLocaleContext().isRightToLeft()?null!=a&&parseInt(a.style.right)+parseInt(a.style.width)==parseInt(this.resizeGhost.style.right)&&(this.resizeGhost.style.right=a.style.right):null!=a&&parseInt(a.style.left)+parseInt(a.style.width)==parseInt(this.resizeGhost.style.left)&&(this.resizeGhost.style.left=a.style.left),c=0,null!=this.dragger.previousSibling&&(null!=
this.dragger.previousSibling.previousSibling&&this.dragger.previousSibling.previousSibling.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseSchedulingGanttPeer._TRAVEL&&null!=a)&&(c=a.style.width),this.resizeGhost.style.width=parseInt(this.resizeGhost.style.width)+parseInt(c)+"px",this.resizeGhost.style.width=parseInt(this.resizeGhost.style.width)+5+"px"):(AdfPage.PAGE.getLocaleContext().isRightToLeft()?this.resizeGhost.style.right=null!=a?parseInt(b.style.right)-parseInt(a.style.width)+"px":
b.style.right:this.resizeGhost.style.left=null!=a?parseInt(b.style.left)+parseInt(a.style.width)+"px":b.style.left,this.resizeGhost.style.width=null!=a?parseInt(b.style.width)-parseInt(a.style.width)+"px":b.style.width);this.resizeGhost.style.cursor="w-resize";b.parentNode.appendChild(this.resizeGhost);for(b=0;b<this.dragger.childNodes.length;b++)c=this.dragger.childNodes[b],c.style.display="none";this.currentWidth=this.resizeGhost.style.width;this.resizeGhostWidth=parseInt(this.currentWidth)}else if(this.isMove)if(AdfAgent.AGENT.disableUserSelect(this.getDomElement()),
d=this.getGhost(),d.style.height="15px",this.dragger=this.findElement(this.dragger,AdfDhtmlBaseGanttPeer._PART),null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)||null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)){for(f=0;f<b.childNodes.length;f++)c=b.childNodes[f],e=c.cloneNode(!0),e.onmouseover=null,e.onmouseout=null,e.onmousedown=null,e.style.cursor="move",c.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._LEFT||c.getAttribute(AdfDhtmlBaseGanttPeer._PART)==
AdfDhtmlBaseGanttPeer._BAR||c.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._SPLIT?AdfPage.PAGE.getLocaleContext().isRightToLeft()?e.style.right="0px":e.style.left="0px":c.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._GRABBER?AdfPage.PAGE.getLocaleContext().isRightToLeft()?e.style.right=parseInt(this.dragger.style.width)+"px":e.style.left=parseInt(this.dragger.style.width)+"px":c.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._RIGHT&&(AdfPage.PAGE.getLocaleContext().isRightToLeft()?
e.style.right=parseInt(this.dragger.style.width)+5+"px":e.style.left=parseInt(this.dragger.style.width)+5+"px"),d.firstChild.appendChild(e);AdfAgent.AGENT.setOpacity(d,70);d.style.width=parseInt(this.dragger.style.width)+5+"px";AdfPage.PAGE.getLocaleContext().isRightToLeft()?d.style.right=parseInt(AdfAgent.AGENT.getElementLeft(this.dragger))-parseInt(AdfAgent.AGENT.getElementLeft(this.getDomElement()))-4+"px":d.style.left=parseInt(AdfAgent.AGENT.getElementLeft(this.dragger))-parseInt(AdfAgent.AGENT.getElementLeft(this.getDomElement()))-
4+"px";d.style.top=parseInt(AdfAgent.AGENT.getElementTop(this.dragger))-parseInt(AdfAgent.AGENT.getElementTop(this.getDomElement())-8)+"px";AdfPage.PAGE.getLocaleContext().isRightToLeft()?this.currentX=this.dragger.style.right:this.currentX=this.dragger.style.left}else{c=d.childNodes;c[0].style.height="15px";c[1].style.height="10px";c[2].style.width=Math.max(0,parseInt(b.style.width)-5)+"px";for(f=0;f<b.childNodes.length;f++)c=b.childNodes[f],e=c.cloneNode(!0),e.onmouseover=null,e.onmouseout=null,
e.onmousedown=null,d.firstChild.appendChild(e);AdfAgent.AGENT.setOpacity(d,70);d.style.width=parseInt(b.style.width)+"px";AdfPage.PAGE.getLocaleContext().isRightToLeft()?(this.currentX=this.findElemRightWithScroller(b),d.style.right=parseInt(this.currentX)-parseInt(this.findElemRight(this.getDomElement()))+"px"):(this.currentX=AdfAgent.AGENT.getElementLeft(b),d.style.left=parseInt(this.currentX)-parseInt(AdfAgent.AGENT.getElementLeft(this.getDomElement()))+"px");d.style.top=parseInt(this.getY(a))-
10+"px"}}};AdfDhtmlBaseSchedulingGanttPeer.prototype.autoScrollTaskbarMove=function(a,b){if(this.isResize&&5>=parseInt(this.resizeGhost.style.width))return!0;this.autoScrollTaskbar(a,b);return!1};
AdfDhtmlBaseSchedulingGanttPeer.prototype.autoScrollTaskbar=function(a,b){if(this.isResize){this.mergeWith=null;var c=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID),d=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID);if(null!=c||null!=d)for(i=0;i<this.dragger.parentNode.childNodes.length;i++){var e=this.dragger.parentNode.childNodes[i];if(null!=c&&e.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._SPLIT){if(c!=e.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&(!AdfPage.PAGE.getLocaleContext().isRightToLeft()&&
parseInt(this.dragger.style.left)<parseInt(e.style.left)&&parseInt(this.resizeGhost.style.left)+parseInt(this.resizeGhostWidth)+a>parseInt(e.style.left)||AdfPage.PAGE.getLocaleContext().isRightToLeft()&&parseInt(this.dragger.style.right)<parseInt(e.style.right)&&parseInt(this.resizeGhost.style.right)+parseInt(this.resizeGhostWidth)+a>parseInt(e.style.right))){this.mergeWith=e.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID);break}}else if(null!=d&&e.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._BAR&&
d!=e.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)&&(!AdfPage.PAGE.getLocaleContext().isRightToLeft()&&parseInt(this.dragger.style.left)<parseInt(e.style.left)&&parseInt(this.resizeGhost.style.left)+parseInt(this.resizeGhostWidth)+a>parseInt(e.style.left)||AdfPage.PAGE.getLocaleContext().isRightToLeft()&&parseInt(this.dragger.style.right)<parseInt(e.style.right)&&parseInt(this.resizeGhost.style.right)+parseInt(this.resizeGhostWidth)+a>parseInt(e.style.right))){this.mergeWith=e.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID);
break}}this.resizeGhostWidth+=a;null==this.mergeWith&&(this.resizeGhost.style.width=0<this.resizeGhostWidth?this.resizeGhostWidth+"px":"2px")}else 0!=a&&(null==this.totalScrollX&&(this.totalScrollX=0),this.totalScrollX+=a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.handleTaskbarMove=function(a,b,c){a=this.getGhost();a.style.display="block";_x=b;AdfPage.PAGE.getLocaleContext().isRightToLeft()?0>parseInt(a.style.right)+_x?a.style.right="0px":a.style.right=parseInt(a.style.right)+_x+"px":0>parseInt(a.style.left)+_x?a.style.left="0px":a.style.left=parseInt(a.style.left)+_x+"px";null==this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&null==this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)&&(0>parseInt(a.style.top)+
c?a.style.top="0px":a.style.top=parseInt(a.style.top)+c+"px")};
AdfDhtmlBaseSchedulingGanttPeer.prototype.handleAutoScrollMove=function(a,b,c){var d=this.getChartTreeTableId(),e=this.getAutoScrollScroller(),f=this.getDomElement().offsetWidth,g=this.findChartStarts(),h=0,l=0;e.scrollHeight!=e.clientHeight&&(l=22);if(0<=b&&f<=this.getX(a)+AdfDhtmlBaseGanttPeer.SCROLLZONE+l)h=f<=this.getX(a)+AdfDhtmlBaseGanttPeer.SCROLLZONE/2+l?2*AdfDhtmlBaseGanttPeer.SCROLLSPEED:AdfDhtmlBaseGanttPeer.SCROLLSPEED;else if(0>=b&&this.getX(a)<=g+AdfDhtmlBaseGanttPeer.SCROLLZONE&&(!AdfPage.PAGE.getLocaleContext().isRightToLeft()&&
0<e.scrollLeft||AdfPage.PAGE.getLocaleContext().isRightToLeft()))h=this.getX(a)<=g+AdfDhtmlBaseGanttPeer.SCROLLZONE/2?0-2*AdfDhtmlBaseGanttPeer.SCROLLSPEED:0-AdfDhtmlBaseGanttPeer.SCROLLSPEED;b=0;f=this.getHeight();g=this.findChartTop();l=0;null!=document.getElementById(this.getComponent().getClientId()+AdfDhtmlBaseGanttPeer._NAMING_SEP+AdfDhtmlBaseGanttPeer._LEGEND_ID)&&(l=AdfDhtmlBaseGanttPeer.LEGEND_HEIGHT);var m=0;e.scrollWidth!=e.clientWidth&&(m=22);0<=c&&f<=this.getY(a)+AdfDhtmlBaseGanttPeer.SCROLLZONE+
l+m?b=f<=this.getY(a)+AdfDhtmlBaseGanttPeer.SCROLLZONE/2+l+m?2*AdfDhtmlBaseGanttPeer.SCROLLSPEED:AdfDhtmlBaseGanttPeer.SCROLLSPEED:0>=c&&(this.getY(a)<=g+AdfDhtmlBaseGanttPeer.SCROLLZONE&&0<e.scrollTop)&&(b=this.getY(a)<=g+AdfDhtmlBaseGanttPeer.SCROLLZONE/2?0-2*AdfDhtmlBaseGanttPeer.SCROLLSPEED:0-AdfDhtmlBaseGanttPeer.SCROLLSPEED);if(0!=h||0!=b){if(null==this.scrollTimeout||!this.isScrolling||this.isScrolling&&(this.currentScrollX!=h||this.currentScrollY!=b))this.isScrolling&&this.cancelAutoScroll(),
AdfDhtmlBaseGanttPeer.doAutoScroll(this.getComponent().getClientId(),d,this.getX(a),this.getY(a),h,b),this.isScrolling=!0,this.currentScrollX=h,this.currentScrollY=b}else this.cancelAutoScroll()};AdfDhtmlBaseSchedulingGanttPeer.prototype.contNormalDrag=function(a,b,c){this.dragged&&(a.cancelBubble=!0,this.isResize?(this.cancelAutoScroll(),this.handleAutoScrollResize(a,b,c)):this.isMove&&(this.handleTaskbarMove(a,b,c),this.handleAutoScrollMove(a,b,c)),this.renderDateTooltip(a))};
AdfDhtmlBaseSchedulingGanttPeer.prototype.endNormalDrag=function(a){a.cancelBubble=!0;this.globalStartY=this.globalStartX=0;this.dragged=!1;var b=this.getDateTooltip();null!=b&&(b.style.display="none");if(this.isCtrlClick(a))for(b=0;b<this.dragger.childNodes.length;b++)this.dragger.childNodes[b].style.display="block";else if(b=this.getComponent(),null!=this.dragger){var c={},d=this.getAutoScrollScroller();null!=d&&(c.scrollLeft=parseInt(d.scrollLeft),c.scrollTop=parseInt(d.scrollTop));d=this.getGhost();
if(this.isResize){this.isResize=!1;this.dragger.style.cursor="default";var e=0;null!=this.dragger&&(null!=this.dragger.parentNode&&null!=this.dragger.parentNode.childNodes[0]&&this.dragger.parentNode.childNodes[0].getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseSchedulingGanttPeer._TRAVEL)&&(e=parseInt(this.dragger.parentNode.childNodes[0].style.width));null!=this.dragger.previousSibling&&this.dragger.previousSibling.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._SPLIT?this.resizeGhost.style.width!=
this.currentWidth&&(c.actionType="resize",c.taskId=this.taskId,c.resourceId=this.fromResourceId,null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&(c.splitId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)),null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)&&(c.recurId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)),AdfPage.PAGE.getLocaleContext().isRightToLeft()?(c.oldwidth=parseInt(this.dragger.parentNode.style.right)+parseInt(this.currentWidth)+
parseInt(this.dragger.previousSibling.style.right),c.newwidth=parseInt(this.dragger.parentNode.style.right)+parseInt(this.resizeGhost.style.width)+parseInt(this.dragger.previousSibling.style.right),c.oldx=parseInt(this.dragger.parentNode.style.right)+parseInt(this.dragger.previousSibling.style.right),c.newx=parseInt(this.dragger.parentNode.style.right)+parseInt(this.dragger.previousSibling.style.right)):(c.oldwidth=parseInt(this.dragger.parentNode.style.left)+parseInt(this.currentWidth)+parseInt(this.dragger.previousSibling.style.left),
c.newwidth=parseInt(this.dragger.parentNode.style.left)+parseInt(this.resizeGhost.style.width)+parseInt(this.dragger.previousSibling.style.left),c.oldx=parseInt(this.dragger.parentNode.style.left)+parseInt(this.dragger.previousSibling.style.left),c.newx=parseInt(this.dragger.parentNode.style.left)+parseInt(this.dragger.previousSibling.style.left)),c.rowKeys=this.fromResourceRowKey,c=new AdfGanttDataChangeEvent(b,c),c.setPartial(!0),b.queueEvent(c)):this.resizeGhost.style.width!=this.currentWidth&&
(c.actionType="resize",c.taskId=this.taskId,c.resourceId=this.fromResourceId,null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&(c.splitId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)),null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)&&(c.recurId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)),AdfPage.PAGE.getLocaleContext().isRightToLeft()?(c.oldwidth=parseInt(this.dragger.parentNode.style.right)+parseInt(this.currentWidth),c.newwidth=parseInt(this.dragger.parentNode.style.right)+
parseInt(this.resizeGhost.style.width)+e,c.oldx=parseInt(this.dragger.parentNode.style.right)+e,c.newx=parseInt(this.dragger.parentNode.style.right)+e):(c.oldwidth=parseInt(this.dragger.parentNode.style.left)+parseInt(this.currentWidth),c.newwidth=parseInt(this.dragger.parentNode.style.left)+parseInt(this.resizeGhost.style.width)+e,c.oldx=parseInt(this.dragger.parentNode.style.left)+e,c.newx=parseInt(this.dragger.parentNode.style.left)+e),c.rowKeys=this.fromResourceRowKey,c=new AdfGanttDataChangeEvent(b,
c),c.setPartial(!0),b.queueEvent(c));this.resizeGhost.style.display="none"}else if(this.isMove){for(var f=d.firstChild;f.firstChild;)f.removeChild(f.firstChild);d.style.display="none";this.isMove=!1;e=AdfAgent.AGENT.getElementLeft(this.getDomElement());AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(e=this.findElemRight(this.getDomElement()));null==this.totalScrollX&&(this.totalScrollX=0);this.dragger=this.findElement(this.dragger,AdfDhtmlBaseGanttPeer._PART);if(null==this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&
null==this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)){var g=d.style.left,f=this.dragger.parentNode.style.left;AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(g=d.style.right,f=this.dragger.parentNode.style.right);var h=parseInt(g)+(parseInt(f)-parseInt(this.currentX))+parseInt(e)+this.totalScrollX;null!=h&&(null!=this.currentX&&parseInt(this.currentX)!=parseInt(g)+parseInt(e))&&(e=0,this.dragger.parentNode.childNodes[0].getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseSchedulingGanttPeer._TRAVEL&&
(e=parseInt(this.dragger.parentNode.childNodes[0].style.width)),a=this.findResource(a),g=null,g=null==a?this.fromResourceId:a.id,c.actionType="move",c.taskId=this.taskId,c.fromResourceId=this.fromResourceId,c.toResourceId=g,c.oldx=parseInt(f)+e,c.newx=h+e,c.oldwidth=parseInt(f)+parseInt(d.style.width),c.newwidth=h+parseInt(d.style.width),c.rowKeys=this.fromResourceRowKey+" "+a.rowKey,c=new AdfGanttDataChangeEvent(b,c),c.setPartial(!0),b.queueEvent(c))}else f=this.getAutoScrollScroller(),a=parseInt(d.style.left)-
this.findChartStarts()+f.scrollLeft+"px",AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(a=parseInt(d.style.right)-this.findChartStarts()+f.scrollLeft+"px"),a!=this.currentX&&(c.actionType=null!=this.mergeWith?"merge":"move",c.taskId=this.getTaskId(),f=parseInt(this.dragger.parentNode.style.left),AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(f=parseInt(this.dragger.parentNode.style.right)),c.oldx=parseInt(this.currentX)+f,c.newx=parseInt(a)-4,c.oldwidth=parseInt(this.currentX)+f+parseInt(d.style.width),
c.newwidth=parseInt(a)-4+parseInt(d.style.width),null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&(c.splitId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)),null!=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)&&(c.recurId=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID)),null!=this.mergeWith&&(c.mergeWith=this.mergeWith),c=new AdfGanttDataChangeEvent(b,c),c.setPartial(!0),b.queueEvent(c))}this.dragger=null;this.currentX=-1;this.totalScrollX=0}};
AdfDhtmlBaseSchedulingGanttPeer.adjustLabels=function(a,b,c){var d=AdfPage.PAGE.findComponent(a+AdfDhtmlBaseGanttPeer._NAMING_SEP+AdfDhtmlBaseGanttPeer._CHART_TREETABLE_ID).getPeer().getDomElement();a=AdfPage.PAGE.findComponent(a).getPeer().GetDatabody(d).childNodes;if(null!=a[0]){a=a[0].rows;for(var d=a.length,e=0;e<d;++e){var f=AdfDhtmlBaseSchedulingGanttPeer.sortTasks(a[e]);if(!(null==f||null==f[0]))for(var g=f[0],h=null,l=null,m=null,n=1;null!=g;){var p=f[n],q=null,r=b;g.getAttribute(AdfDhtmlBaseGanttPeer._LABEL_ALIGNMENT)==
AdfDhtmlBaseGanttPeer._LABEL_ICON_ALIGNMENT_LEFT?b="left":g.getAttribute(AdfDhtmlBaseGanttPeer._LABEL_ALIGNMENT)==AdfDhtmlBaseGanttPeer._LABEL_ICON_ALIGNMENT_RIGHT&&(b="right");var v=c;g.getAttribute(AdfDhtmlBaseGanttPeer._ICON_ALIGNMENT)==AdfDhtmlBaseGanttPeer._LABEL_ICON_ALIGNMENT_LEFT?c="left":g.getAttribute(AdfDhtmlBaseGanttPeer._ICON_ALIGNMENT)==AdfDhtmlBaseGanttPeer._LABEL_ICON_ALIGNMENT_RIGHT&&(c="right");AdfPage.PAGE.getLocaleContext().isRightToLeft()?"left"==b&&null!=p?(q=g.nextSibling,l=
p,m=g):"right"==b&&null!=h&&(q=g.nextSibling,l=g,m=h):"right"==b&&null!=p?(q=g.nextSibling,l=p,m=g):"left"==b&&null!=h&&(q=g.nextSibling,l=g,m=h);null!=q&&q.getAttribute(AdfDhtmlBaseGanttPeer._PART)!=AdfDhtmlBaseGanttPeer._LABEL&&(q=null);if(null!=q){b=parseInt(l.style.left);AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(b=parseInt(l.style.right));var u=parseInt(m.style.left)+parseInt(m.style.width);AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(u=parseInt(m.style.right)+parseInt(m.style.width));
b-=u;u=Math.abs(m.offsetTop-l.offsetTop);q.offsetWidth>=b&&2>=u&&(b-=5,0>b&&(b=0),q.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._LABEL&&(q.style.width=b+"px"))}q=null;AdfPage.PAGE.getLocaleContext().isRightToLeft()?"left"==c&&null!=p?(q=g.nextSibling,l=p,m=g):"right"==c&&null!=h&&(q=g.nextSibling,l=g,m=h):"right"==c&&null!=p?(q=g.nextSibling,l=p,m=g):"left"==c&&null!=h&&(q=g.nextSibling,l=g,m=h);null!=q&&(null!=q.childNodes[0]&&"IMG"!=q.childNodes[0].nodeName)&&(q=null);null!=
q&&(b=parseInt(l.style.left),u=parseInt(m.style.left)+parseInt(m.style.width),AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(b=parseInt(l.style.right),u=parseInt(m.style.right)+parseInt(m.style.width)),b-=u,u=Math.abs(m.offsetTop-l.offsetTop),q.offsetWidth>=b&&2>=u&&(b-=5,0>b&&(b=0),null!=q.childNodes[0]&&"IMG"==q.childNodes[0].nodeName&&(q.style.overflow="hidden",q.style.maxWidth=b+"px")));b=r;c=v;h=g;g=p;n++}}}};
AdfDhtmlBaseSchedulingGanttPeer.sortTasks=function(a){var b=[],c=0;if(null!=a){for(a=a.childNodes;null!=a&&0<a.length&&(null==a[0].id||""==a[0].id);)a=a[0].childNodes;if(null!=a){a=a[0].childNodes;for(var d=0;d<a.length;d++)null!=a[d]&&null!=a[d].getAttribute(AdfDhtmlBaseGanttPeer._TASKID)&&(b[c]=a[d],c++);b.sort(AdfDhtmlBaseSchedulingGanttPeer.sortNumber)}}return b};
AdfDhtmlBaseSchedulingGanttPeer.sortNumber=function(a,b){var c=parseInt(a.style.left)-parseInt(b.style.left);AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(c=parseInt(a.style.right)-parseInt(b.style.right));return c};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getResourceId=function(a){for(a=a.parentNode;a;){if("DIV"==a.nodeName&&null!=a.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID))return a.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID);if("TR"==a.nodeName)break;else{var b=this.getResourceId(a);if(null!=b)return b}a=a.parentNode}return null};
AdfDhtmlBaseSchedulingGanttPeer.prototype.findResource=function(a){var b=this.getComponent(),b=document.getElementById(b.getClientId()+":"+AdfDhtmlBaseGanttPeer._CHART_TREETABLE_ID);a=AdfDhtmlBaseGanttPeer.isMobileTouchDevice()?this.currentDraggedPos:this.getEventPosition(a);b=AdfDhtmlBaseSchedulingGanttPeer.getResourceAtPoint(b,a.x,a.y);return null!=b?(a={},a.id=b.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID),a.rowKey=this.findRowKey(b),b=b.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCENAME),
a.name=null!=b?b:a.id,a):null};AdfDhtmlBaseSchedulingGanttPeer.getResourceAtPoint=function(a,b,c){for(a=a.firstChild;a;){if("DIV"==a.nodeName&&null!=a.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID)){if(AdfAgent.AGENT.pointInElementBounds(a,b,c))return a}else{var d=AdfDhtmlBaseSchedulingGanttPeer.getResourceAtPoint(a,b,c);if(null!=d)return d}a=a.nextSibling}return null};
AdfDhtmlBaseSchedulingGanttPeer.prototype.resetCursor=function(a){if(!this.dragged&&!this.isCtrlClick(a)){this.dragger=this.getTarget(a);this.dragger.style.cursor="default";if(this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._INNER||"img"==this.dragger.nodeName)this.dragger=this.dragger.parentNode;a=this.getTooltip();null!=a&&(a.style.display="none");this.oldDragger=this.dragger;this.dragger=null}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getTaskId=function(a){return null!=this.dragger?(a=this.dragger.getAttribute(AdfDhtmlBaseGanttPeer._TASKID),null==a&&null!=this.dragger.parentNode&&(a=this.dragger.parentNode.getAttribute(AdfDhtmlBaseGanttPeer._TASKID)),a):null};AdfDhtmlBaseSchedulingGanttPeer.prototype.handleCtrlClick=function(a){null!=this.dragger&&(this.dragger.style.borderStyle="solid",this.dragger.style.borderWidth="1px",this.dragger.style.borderColor="#000000",this.addSelectedTask(this.dragger))};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getGanttSpecificProperties=function(a){null!=this.dragger&&(null!=this.dragger.parentNode&&null!=this.dragger.parentNode.parentNode)&&(a.fromResourceId=this.dragger.parentNode.parentNode.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID),a.toResourceId=a.fromResourceId)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getGhostPos=function(a){var b=AdfPage.PAGE.getLocaleContext().isRightToLeft()?this.findElemRight(this.getDomElement()):AdfAgent.AGENT.getElementLeft(this.getDomElement()),c=null==this.totalScrollX?0:this.totalScrollX,d=this.findElement(this.dragger,AdfDhtmlBaseGanttPeer._PART);if(null==d.getAttribute(AdfDhtmlBaseGanttPeer._SPLITID)&&null==d.getAttribute(AdfDhtmlBaseGanttPeer._RECURRID))return parseInt(this.getStyleStart(a))+(parseInt(this.getStyleStart(d.parentNode))-
parseInt(this.currentX))+parseInt(b)+c;b=this.getAutoScrollScroller();return parseInt(this.getStyleStart(a))-this.findChartStarts()+b.scrollLeft-4};AdfDhtmlBaseSchedulingGanttPeer.prototype.getTravelWidth=function(a){return a&&a.parentNode&&a.parentNode.childNodes[0]&&a.parentNode.childNodes[0].getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseSchedulingGanttPeer._TRAVEL?parseInt(a.parentNode.childNodes[0].style.width):0};
AdfDhtmlBaseSchedulingGanttPeer.prototype.__renderDateTooltip=function(a,b,c){var d=new Date;d.setTime(this.startDate.getTime());var e=new Date;e.setTime(this.endDate.getTime());var f=this.getDateIncrementUnit(),g=this.findElement(this.dragger,AdfDhtmlBaseGanttPeer._PART),h=this.getTravelWidth(g);this.isMove?(g=this.getGhostPos(this.getGhost())+h,g=this.getPositionTime(g,this.getAxisStartDate(),this.getAxisEndDate(),this.getAxisWidth()),h=this.endDate.getTime()-this.startDate.getTime(),d.setTime(g),
e.setTime(g+h)):this.isResize&&(h=parseInt(this.getStyleStart(g.parentNode))+parseInt(this.resizeGhost.style.width)+h,g.previousSibling&&g.previousSibling.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._SPLIT&&(h+=parseInt(this.getStyleStart(g.previousSibling))),g=this.getPositionTime(h,this.getAxisStartDate(),this.getAxisEndDate(),this.getAxisWidth()),e.setTime(g));g=this.getDateTooltip();if(null!=g){var l="",m="",h=this.getDomElement(),n=this.getComponent().getClientId()+AdfDhtmlBaseGanttPeer._NAMING_SEP+
AdfDhtmlBaseGanttPeer._CHART_TREETABLE_ID,n=AdfPage.PAGE.findComponent(n).getPeer().getDomElement(),p=AdfAgent.AGENT.getElementPageBounds(h),q=p.top+b,p=AdfPage.PAGE.getLocaleContext().isRightToLeft()?p.right-a:p.left+a,n=AdfDhtmlBaseSchedulingGanttPeer.getResourceAtPoint(n,p,q);null!=n&&(m=n.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCEID),l=n.getAttribute(AdfDhtmlBaseSchedulingGanttPeer._RESOURCENAME),null==l&&(l=m));n="\x3ctable cellpadding\x3d'0' cellspacing\x3d'0' style\x3d'padding-bottom:3px;padding-right:3px'\x3e\x3ctr valign\x3d'top'\x3e\x3ctd class\x3d'"+
h.getAttribute(AdfDhtmlBaseGanttPeer._TOOLTIP_LABEL_CLASS)+"' style\x3d'text-align:right; padding:0 8px 0 0; white-space: nowrap;'\x3e";n=null!=this.fromResourceId&&this.fromResourceId!=m?n+this.getResource("resource")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+l:n+this.getResource("resource")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+this.fromResourceName;n+="\x3c/td\x3e\x3c/tr\x3e";l=this.getClientConverter(AdfDhtmlBaseGanttPeer._ENDTIME_CONVERTER);null!=l?l=l.getAsString(e):
(l=this.formatDate(e),"hour"==f&&(l+="\x3c/b\x3e"));this.isMove?(e=this.getClientConverter(AdfDhtmlBaseGanttPeer._STARTTIME_CONVERTER),null!=e?d=e.getAsString(d):(d=this.formatDate(d),"hour"==f&&(d+="\x3c/b\x3e")),n=n+"\x3ctr valign\x3d'top'\x3e\x3ctd class\x3d'"+h.getAttribute(AdfDhtmlBaseGanttPeer._TOOLTIP_LABEL_CLASS)+"' style\x3d'text-align:right; padding:0 8px 0 0; white-space: nowrap;'\x3e"+this.getResource("start_time")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+d+"\x3c/td\x3e\x3c/tr\x3e",
n=n+"\x3ctr valign\x3d'top'\x3e\x3ctd class\x3d'"+h.getAttribute(AdfDhtmlBaseGanttPeer._TOOLTIP_LABEL_CLASS)+"' style\x3d'text-align:right; padding:0 8px 0 0; white-space: nowrap;'\x3e"+this.getResource("end_time")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+l+"\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e"):this.isResize&&("hour"==f?(f=(e.getTime()-this.startDate.getTime())/36E5,f=Math.max(0,Math.round(100*f)/100),f+=" h"):(f=(e.getTime()-this.startDate.getTime())/864E5,f=Math.max(0,Math.round(100*
f)/100),f=f+" "+this.getResource("days")),n="\x3ctable cellpadding\x3d'0' cellspacing\x3d'0' style\x3d'padding-bottom:3px;padding-right:3px'\x3e\x3ctr valign\x3d'top'\x3e\x3ctd class\x3d'"+h.getAttribute(AdfDhtmlBaseGanttPeer._TOOLTIP_LABEL_CLASS)+"' style\x3d'text-align:right; padding:0 8px 0 0; white-space: nowrap;'\x3e"+this.getResource("end_time")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+l+"\x3c/td\x3e\x3c/tr\x3e",n=n+"\x3ctr valign\x3d'top'\x3e\x3ctd class\x3d'"+h.getAttribute(AdfDhtmlBaseGanttPeer._TOOLTIP_LABEL_CLASS)+
"' style\x3d'text-align:right; padding:0 8px 0 0; white-space: nowrap;'\x3e"+this.getResource("duration")+"\x3c/td\x3e\x3ctd style\x3d'text-align:left;'\x3e"+f+"\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e");g.childNodes[0].childNodes[1].childNodes[1].innerHTML=n;c&&(g.style.display="block",g.style.top=b-parseInt(g.offsetHeight)-10+"px",AdfPage.PAGE.getLocaleContext().isRightToLeft()?g.style.right=a-parseInt(g.offsetWidth)-10+"px":g.style.left=a-parseInt(g.offsetWidth)-10+"px")}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.cancelDrag=function(a){if(this.dragged){this.cancelAutoScroll();a.cancelBubble=!0;var b=this.getDateTooltip();null!=b&&(b.style.display="none");var c=b=0;this.isMove&&(b=parseInt(this.getX(a))-parseInt(this.globalStartX),c=parseInt(this.getY(a))-parseInt(this.globalStartY));this.isMove=!1;this.dragger.style.cursor="default";for(var d=0;d<this.dragger.childNodes.length;d++)this.dragger.childNodes[d].style.display="block";null!=this.resizeGhost&&(this.resizeGhost.style.display=
"none",this.resizeGhost=null);this.globalStartY=this.globalStartX=0;this.dragged=!1;this.dragger=null;this.currentX=-1;d=this.getGhostId();AdfDhtmlBaseGanttPeer.doMove(b,c,d);AdfDhtmlBaseSchedulingGanttPeer.superclass.cancelDrag.call(this,a)}};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getDragNode=function(a){a.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._INNER&&(a=a.parentNode);a=a.cloneNode(!0);AdfPage.PAGE.getLocaleContext().isRightToLeft()?a.style.right="0px":a.style.left="0px";return a};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getHeight=function(){var a=AdfAgent.AGENT.getComputedStyle(this.getDomElement()),b=0,b="100%"==a.height?parseInt(AdfAgent.AGENT.getWindowClientHeight(AdfAgent.AGENT.getDomWindow())):Math.min(parseInt(AdfAgent.AGENT.getWindowClientHeight(AdfAgent.AGENT.getDomWindow())),parseInt(a.top)+parseInt(a.height));parseInt(AdfAgent.AGENT.getWindowClientWidth(AdfAgent.AGENT.getDomWindow()))<parseInt(AdfAgent.AGENT.getWindowScrollWidth(AdfAgent.AGENT.getDomWindow()))&&
(b-=14);return b};AdfDhtmlBaseSchedulingGanttPeer.prototype.findChartTop=function(){var a=0,b=this.getComponent(),c=b.getClientId()+"::majorAxis",c=document.getElementById(c);null==c&&(c=b.getClientId()+"::minorAxis",c=document.getElementById(c));if(null!=c)if(c.offsetParent)for(;c.offsetParent;)a+=c.offsetTop,c=c.offsetParent;else c.y&&(a+=c.y);return a+36};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getRowSensitiveItems=function(){return[AdfDhtmlBaseGanttPeer._INDENT_BUTTON_ID,AdfDhtmlBaseGanttPeer._OUTDENT_BUTTON_ID,AdfDhtmlBaseGanttPeer._INDENT_MENUITEM_ID,AdfDhtmlBaseGanttPeer._OUTDENT_MENUITEM_ID,AdfDhtmlBaseSchedulingGanttPeer._UPDATE_RESOURCE_MENUITEM_ID]};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getTaskSensitiveItems=function(){return[AdfDhtmlBaseGanttPeer._EDIT_BUTTON_ID,AdfDhtmlBaseGanttPeer._CUT_BUTTON_ID,AdfDhtmlBaseGanttPeer._COPY_BUTTON_ID,AdfDhtmlBaseGanttPeer._DELETE_BUTTON_ID,AdfDhtmlBaseGanttPeer._UPDATE_MENUITEM_ID,AdfDhtmlBaseGanttPeer._CUT_MENUITEM_ID,AdfDhtmlBaseGanttPeer._COPY_MENUITEM_ID,AdfDhtmlBaseGanttPeer._DELETE_MENUITEM_ID,AdfDhtmlBaseSchedulingGanttPeer._SNAPTO_MENUITEM_ID,AdfDhtmlBaseGanttPeer._PROPERTIES_MENUITEM_ID]};
AdfDhtmlBaseSchedulingGanttPeer.prototype.updateMenuItems=function(a){0>=AdfDhtmlBaseSchedulingGanttPeer.superclass.updateMenuItems.call(this,a)||this.setDisable(this.getTaskSensitiveItems(),!0)};AdfDhtmlBaseSchedulingGanttPeer.prototype.shouldCancelMoveForDnD=function(a){if(null!=this.startDragPos){if(a=this.isEventOutsideGantt(a))this.getGhost().style.display="none";return a}return!1};
AdfDhtmlBaseSchedulingGanttPeer.prototype.isEventOutsideGantt=function(a){var b=this.getDomElement(),c=AdfAgent.AGENT;return c.getPlatform()==AdfAgent.IE_PLATFORM?!c.pointInElementBounds(b,a.clientX+b.scrollLeft,a.clientY+b.scrollTop):!c.pointInElementBounds(b,a.clientX,a.clientY)};AdfDhtmlBaseSchedulingGanttPeer.prototype.handleContentFocus=function(a){this.selectTask(a,"focus");this.populateAriaLabel(a)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.getFirstContentElement=function(a){a=AdfDhtmlBaseGanttPeer.findRowDiv(a);return this._getFirstTask(a)};AdfDhtmlBaseSchedulingGanttPeer.prototype._getFirstTask=function(a){a=a.childNodes;for(var b=0;b<a.length;b++){var c=this.getContentElement(a[b]);if(null!=c)return c}return null};AdfDhtmlBaseSchedulingGanttPeer.prototype.getContentElement=function(a){return this.findElement(a,AdfDhtmlBaseGanttPeer._STARTTIME)};
AdfDhtmlBaseSchedulingGanttPeer.prototype.populateAriaLabel=function(a){null!=this._prevTask&&(this._prevTask.removeAttribute("aria-label"),this._prevTask.removeAttribute("tabIndex"));this._prevTask=a;if(null!=a){var b=this.getResource("ts"),b=b.concat(" "),c=a.getAttribute("data-n");null!=c&&(b=this.appendAttribute(b,this.getResource("tn"),c));c=a.getAttribute("data-tt");b=this.appendAttribute(b,this.getResource("tt"),c);c=a.getAttribute(AdfDhtmlBaseGanttPeer._STARTTIME);if(null!=c){var d=a.getAttribute("data-fst");
null==d&&(d=new Date(+c));b=this.appendAttribute(b,this.getResource("start_time"),d)}c=a.getAttribute(AdfDhtmlBaseGanttPeer._ENDTIME);null!=c&&(d=a.getAttribute("data-fet"),null==d&&(d=new Date(+c)),b=this.appendAttribute(b,this.getResource("end_time"),d));c=a.getAttribute("data-sut");null!=c&&(d=a.getAttribute("data-fsut"),null==d&&(d=new Date(+c)),b=this.appendAttribute(b,this.getResource("sut"),d));c=this.findLabel(a);null!=c&&(b=this.appendAttribute(b,this.getResource("lbl"),c));d=a.parentNode;
if(d.firstChild==a&&(c=d.getAttribute("data-wst"),d=d.getAttribute("data-wet"),null!=c&&null!=d))var e=this.getResource("wt"),e=e.replace("{0}",c),e=e.replace("{1}",d),b=b.concat(" "),b=b.concat(e);a.setAttribute("aria-label",b);AdfDhtmlBaseSchedulingGanttPeer.superclass.populateAriaLabel.call(this,a)}};AdfDhtmlBaseSchedulingGanttPeer.prototype.findLabel=function(a){a=a.nextSibling;return null!=a&&a.getAttribute(AdfDhtmlBaseGanttPeer._PART)==AdfDhtmlBaseGanttPeer._LABEL?a.textContent:null};