1 2 3/* band.js */ 4Timeline._Band=function(B,G,C){if(B.autoWidth&&typeof G.width=="string"){G.width=G.width.indexOf("%")>-1?0:parseInt(G.width); 5}this._timeline=B; 6this._bandInfo=G; 7this._index=C; 8this._locale=("locale" in G)?G.locale:Timeline.getDefaultLocale(); 9this._timeZone=("timeZone" in G)?G.timeZone:0; 10this._labeller=("labeller" in G)?G.labeller:(("createLabeller" in B.getUnit())?B.getUnit().createLabeller(this._locale,this._timeZone):new Timeline.GregorianDateLabeller(this._locale,this._timeZone)); 11this._theme=G.theme; 12this._zoomIndex=("zoomIndex" in G)?G.zoomIndex:0; 13this._zoomSteps=("zoomSteps" in G)?G.zoomSteps:null; 14this._dragging=false; 15this._changing=false; 16this._originalScrollSpeed=5; 17this._scrollSpeed=this._originalScrollSpeed; 18this._onScrollListeners=[]; 19var A=this; 20this._syncWithBand=null; 21this._syncWithBandHandler=function(H){A._onHighlightBandScroll(); 22}; 23this._selectorListener=function(H){A._onHighlightBandScroll(); 24}; 25var E=this._timeline.getDocument().createElement("div"); 26E.className="timeline-band-input"; 27this._timeline.addDiv(E); 28this._keyboardInput=document.createElement("input"); 29this._keyboardInput.type="text"; 30E.appendChild(this._keyboardInput); 31SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keydown",this,"_onKeyDown"); 32SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keyup",this,"_onKeyUp"); 33this._div=this._timeline.getDocument().createElement("div"); 34this._div.id="timeline-band-"+C; 35this._div.className="timeline-band timeline-band-"+C; 36this._timeline.addDiv(this._div); 37SimileAjax.DOM.registerEventWithObject(this._div,"mousedown",this,"_onMouseDown"); 38SimileAjax.DOM.registerEventWithObject(this._div,"mousemove",this,"_onMouseMove"); 39SimileAjax.DOM.registerEventWithObject(this._div,"mouseup",this,"_onMouseUp"); 40SimileAjax.DOM.registerEventWithObject(this._div,"mouseout",this,"_onMouseOut"); 41SimileAjax.DOM.registerEventWithObject(this._div,"dblclick",this,"_onDblClick"); 42var F=this._theme!=null?this._theme.mouseWheel:"scroll"; 43if(F==="zoom"||F==="scroll"||this._zoomSteps){if(SimileAjax.Platform.browser.isFirefox){SimileAjax.DOM.registerEventWithObject(this._div,"DOMMouseScroll",this,"_onMouseScroll"); 44}else{SimileAjax.DOM.registerEventWithObject(this._div,"mousewheel",this,"_onMouseScroll"); 45}}this._innerDiv=this._timeline.getDocument().createElement("div"); 46this._innerDiv.className="timeline-band-inner"; 47this._div.appendChild(this._innerDiv); 48this._ether=G.ether; 49G.ether.initialize(this,B); 50this._etherPainter=G.etherPainter; 51G.etherPainter.initialize(this,B); 52this._eventSource=G.eventSource; 53if(this._eventSource){this._eventListener={onAddMany:function(){A._onAddMany(); 54},onClear:function(){A._onClear(); 55}}; 56this._eventSource.addListener(this._eventListener); 57}this._eventPainter=G.eventPainter; 58this._eventTracksNeeded=0; 59this._eventTrackIncrement=0; 60G.eventPainter.initialize(this,B); 61this._decorators=("decorators" in G)?G.decorators:[]; 62for(var D=0; 63D<this._decorators.length; 64D++){this._decorators[D].initialize(this,B); 65}}; 66Timeline._Band.SCROLL_MULTIPLES=5; 67Timeline._Band.prototype.dispose=function(){this.closeBubble(); 68if(this._eventSource){this._eventSource.removeListener(this._eventListener); 69this._eventListener=null; 70this._eventSource=null; 71}this._timeline=null; 72this._bandInfo=null; 73this._labeller=null; 74this._ether=null; 75this._etherPainter=null; 76this._eventPainter=null; 77this._decorators=null; 78this._onScrollListeners=null; 79this._syncWithBandHandler=null; 80this._selectorListener=null; 81this._div=null; 82this._innerDiv=null; 83this._keyboardInput=null; 84}; 85Timeline._Band.prototype.addOnScrollListener=function(A){this._onScrollListeners.push(A); 86}; 87Timeline._Band.prototype.removeOnScrollListener=function(B){for(var A=0; 88A<this._onScrollListeners.length; 89A++){if(this._onScrollListeners[A]==B){this._onScrollListeners.splice(A,1); 90break; 91}}}; 92Timeline._Band.prototype.setSyncWithBand=function(B,A){if(this._syncWithBand){this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler); 93}this._syncWithBand=B; 94this._syncWithBand.addOnScrollListener(this._syncWithBandHandler); 95this._highlight=A; 96this._positionHighlight(); 97}; 98Timeline._Band.prototype.getLocale=function(){return this._locale; 99}; 100Timeline._Band.prototype.getTimeZone=function(){return this._timeZone; 101}; 102Timeline._Band.prototype.getLabeller=function(){return this._labeller; 103}; 104Timeline._Band.prototype.getIndex=function(){return this._index; 105}; 106Timeline._Band.prototype.getEther=function(){return this._ether; 107}; 108Timeline._Band.prototype.getEtherPainter=function(){return this._etherPainter; 109}; 110Timeline._Band.prototype.getEventSource=function(){return this._eventSource; 111}; 112Timeline._Band.prototype.getEventPainter=function(){return this._eventPainter; 113}; 114Timeline._Band.prototype.getTimeline=function(){return this._timeline; 115}; 116Timeline._Band.prototype.updateEventTrackInfo=function(A,B){this._eventTrackIncrement=B; 117if(A>this._eventTracksNeeded){this._eventTracksNeeded=A; 118}}; 119Timeline._Band.prototype.checkAutoWidth=function(){if(!this._timeline.autoWidth){return ; 120}var C=this._eventPainter.getType()=="overview"; 121var A=C?this._theme.event.overviewTrack.autoWidthMargin:this._theme.event.track.autoWidthMargin; 122var B=Math.ceil((this._eventTracksNeeded+A)*this._eventTrackIncrement); 123B+=C?this._theme.event.overviewTrack.offset:this._theme.event.track.offset; 124var D=this._bandInfo; 125if(B!=D.width){D.width=B; 126}}; 127Timeline._Band.prototype.layout=function(){this.paint(); 128}; 129Timeline._Band.prototype.paint=function(){this._etherPainter.paint(); 130this._paintDecorators(); 131this._paintEvents(); 132}; 133Timeline._Band.prototype.softLayout=function(){this.softPaint(); 134}; 135Timeline._Band.prototype.softPaint=function(){this._etherPainter.softPaint(); 136this._softPaintDecorators(); 137this._softPaintEvents(); 138}; 139Timeline._Band.prototype.setBandShiftAndWidth=function(A,D){var C=this._keyboardInput.parentNode; 140var B=A+Math.floor(D/2); 141if(this._timeline.isHorizontal()){this._div.style.top=A+"px"; 142this._div.style.height=D+"px"; 143C.style.top=B+"px"; 144C.style.left="-1em"; 145}else{this._div.style.left=A+"px"; 146this._div.style.width=D+"px"; 147C.style.left=B+"px"; 148C.style.top="-1em"; 149}}; 150Timeline._Band.prototype.getViewWidth=function(){if(this._timeline.isHorizontal()){return this._div.offsetHeight; 151}else{return this._div.offsetWidth; 152}}; 153Timeline._Band.prototype.setViewLength=function(A){this._viewLength=A; 154this._recenterDiv(); 155this._onChanging(); 156}; 157Timeline._Band.prototype.getViewLength=function(){return this._viewLength; 158}; 159Timeline._Band.prototype.getTotalViewLength=function(){return Timeline._Band.SCROLL_MULTIPLES*this._viewLength; 160}; 161Timeline._Band.prototype.getViewOffset=function(){return this._viewOffset; 162}; 163Timeline._Band.prototype.getMinDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset); 164}; 165Timeline._Band.prototype.getMaxDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset+Timeline._Band.SCROLL_MULTIPLES*this._viewLength); 166}; 167Timeline._Band.prototype.getMinVisibleDate=function(){return this._ether.pixelOffsetToDate(0); 168}; 169Timeline._Band.prototype.getMinVisibleDateAfterDelta=function(A){return this._ether.pixelOffsetToDate(A); 170}; 171Timeline._Band.prototype.getMaxVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength); 172}; 173Timeline._Band.prototype.getMaxVisibleDateAfterDelta=function(A){return this._ether.pixelOffsetToDate(this._viewLength+A); 174}; 175Timeline._Band.prototype.getCenterVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength/2); 176}; 177Timeline._Band.prototype.setMinVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(-this._ether.dateToPixelOffset(A))); 178}}; 179Timeline._Band.prototype.setMaxVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength-this._ether.dateToPixelOffset(A))); 180}}; 181Timeline._Band.prototype.setCenterVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A))); 182}}; 183Timeline._Band.prototype.dateToPixelOffset=function(A){return this._ether.dateToPixelOffset(A)-this._viewOffset; 184}; 185Timeline._Band.prototype.pixelOffsetToDate=function(A){return this._ether.pixelOffsetToDate(A+this._viewOffset); 186}; 187Timeline._Band.prototype.createLayerDiv=function(C,A){var D=this._timeline.getDocument().createElement("div"); 188D.className="timeline-band-layer"+(typeof A=="string"?(" "+A):""); 189D.style.zIndex=C; 190this._innerDiv.appendChild(D); 191var B=this._timeline.getDocument().createElement("div"); 192B.className="timeline-band-layer-inner"; 193if(SimileAjax.Platform.browser.isIE){B.style.cursor="move"; 194}else{B.style.cursor="-moz-grab"; 195}D.appendChild(B); 196return B; 197}; 198Timeline._Band.prototype.removeLayerDiv=function(A){this._innerDiv.removeChild(A.parentNode); 199}; 200Timeline._Band.prototype.scrollToCenter=function(A,C){var B=this._ether.dateToPixelOffset(A); 201if(B<-this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(B+this._viewLength)); 202}else{if(B>3*this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(B-this._viewLength)); 203}}this._autoScroll(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A)),C); 204}; 205Timeline._Band.prototype.showBubbleForEvent=function(C){var A=this.getEventSource().getEvent(C); 206if(A){var B=this; 207this.scrollToCenter(A.getStart(),function(){B._eventPainter.showBubble(A); 208}); 209}}; 210Timeline._Band.prototype.zoom=function(C,A,F,E){if(!this._zoomSteps){return ; 211}A+=this._viewOffset; 212var D=this._ether.pixelOffsetToDate(A); 213var B=this._ether.zoom(C); 214this._etherPainter.zoom(B); 215this._moveEther(Math.round(-this._ether.dateToPixelOffset(D))); 216this._moveEther(A); 217}; 218Timeline._Band.prototype._onMouseDown=function(B,A,C){this.closeBubble(); 219this._dragging=true; 220this._dragX=A.clientX; 221this._dragY=A.clientY; 222}; 223Timeline._Band.prototype._onMouseMove=function(D,A,E){if(this._dragging){var C=A.clientX-this._dragX; 224var B=A.clientY-this._dragY; 225this._dragX=A.clientX; 226this._dragY=A.clientY; 227this._moveEther(this._timeline.isHorizontal()?C:B); 228this._positionHighlight(); 229}}; 230Timeline._Band.prototype._onMouseUp=function(B,A,C){this._dragging=false; 231this._keyboardInput.focus(); 232}; 233Timeline._Band.prototype._onMouseOut=function(C,B,D){var A=SimileAjax.DOM.getEventRelativeCoordinates(B,C); 234A.x+=this._viewOffset; 235if(A.x<0||A.x>C.offsetWidth||A.y<0||A.y>C.offsetHeight){this._dragging=false; 236}}; 237Timeline._Band.prototype._onMouseScroll=function(G,H,B){var A=new Date(); 238A=A.getTime(); 239if(!this._lastScrollTime||((A-this._lastScrollTime)>50)){this._lastScrollTime=A; 240var I=0; 241if(H.wheelDelta){I=H.wheelDelta/120; 242}else{if(H.detail){I=-H.detail/3; 243}}var F=this._theme.mouseWheel; 244if(this._zoomSteps||F==="zoom"){var E=SimileAjax.DOM.getEventRelativeCoordinates(H,G); 245if(I!=0){var D; 246if(I>0){D=true; 247}if(I<0){D=false; 248}this._timeline.zoom(D,E.x,E.y,G); 249}}else{if(F==="scroll"){var C=50*(I<0?-1:1); 250this._moveEther(C); 251}}}if(H.stopPropagation){H.stopPropagation(); 252}H.cancelBubble=true; 253if(H.preventDefault){H.preventDefault(); 254}H.returnValue=false; 255}; 256Timeline._Band.prototype._onDblClick=function(C,B,E){var A=SimileAjax.DOM.getEventRelativeCoordinates(B,C); 257var D=A.x-(this._viewLength/2-this._viewOffset); 258this._autoScroll(-D); 259}; 260Timeline._Band.prototype._onKeyDown=function(B,A,C){if(!this._dragging){switch(A.keyCode){case 27:break; 261case 37:case 38:this._scrollSpeed=Math.min(50,Math.abs(this._scrollSpeed*1.05)); 262this._moveEther(this._scrollSpeed); 263break; 264case 39:case 40:this._scrollSpeed=-Math.min(50,Math.abs(this._scrollSpeed*1.05)); 265this._moveEther(this._scrollSpeed); 266break; 267default:return true; 268}this.closeBubble(); 269SimileAjax.DOM.cancelEvent(A); 270return false; 271}return true; 272}; 273Timeline._Band.prototype._onKeyUp=function(B,A,C){if(!this._dragging){this._scrollSpeed=this._originalScrollSpeed; 274switch(A.keyCode){case 35:this.setCenterVisibleDate(this._eventSource.getLatestDate()); 275break; 276case 36:this.setCenterVisibleDate(this._eventSource.getEarliestDate()); 277break; 278case 33:this._autoScroll(this._timeline.getPixelLength()); 279break; 280case 34:this._autoScroll(-this._timeline.getPixelLength()); 281break; 282default:return true; 283}this.closeBubble(); 284SimileAjax.DOM.cancelEvent(A); 285return false; 286}return true; 287}; 288Timeline._Band.prototype._autoScroll=function(D,C){var A=this; 289var B=SimileAjax.Graphics.createAnimation(function(E,F){A._moveEther(F); 290},0,D,1000,C); 291B.run(); 292}; 293Timeline._Band.prototype._moveEther=function(A){this.closeBubble(); 294if(!this._timeline.shiftOK(this._index,A)){return ; 295}this._viewOffset+=A; 296this._ether.shiftPixels(-A); 297if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px"; 298}else{this._div.style.top=this._viewOffset+"px"; 299}if(this._viewOffset>-this._viewLength*0.5||this._viewOffset<-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1.5)){this._recenterDiv(); 300}else{this.softLayout(); 301}this._onChanging(); 302}; 303Timeline._Band.prototype._onChanging=function(){this._changing=true; 304this._fireOnScroll(); 305this._setSyncWithBandDate(); 306this._changing=false; 307}; 308Timeline._Band.prototype.busy=function(){return(this._changing); 309}; 310Timeline._Band.prototype._fireOnScroll=function(){for(var A=0; 311A<this._onScrollListeners.length; 312A++){this._onScrollListeners[A](this); 313}}; 314Timeline._Band.prototype._setSyncWithBandDate=function(){if(this._syncWithBand){var A=this._ether.pixelOffsetToDate(this.getViewLength()/2); 315this._syncWithBand.setCenterVisibleDate(A); 316}}; 317Timeline._Band.prototype._onHighlightBandScroll=function(){if(this._syncWithBand){var A=this._syncWithBand.getCenterVisibleDate(); 318var B=this._ether.dateToPixelOffset(A); 319this._moveEther(Math.round(this._viewLength/2-B)); 320if(this._highlight){this._etherPainter.setHighlight(this._syncWithBand.getMinVisibleDate(),this._syncWithBand.getMaxVisibleDate()); 321}}}; 322Timeline._Band.prototype._onAddMany=function(){this._paintEvents(); 323}; 324Timeline._Band.prototype._onClear=function(){this._paintEvents(); 325}; 326Timeline._Band.prototype._positionHighlight=function(){if(this._syncWithBand){var A=this._syncWithBand.getMinVisibleDate(); 327var B=this._syncWithBand.getMaxVisibleDate(); 328if(this._highlight){this._etherPainter.setHighlight(A,B); 329}}}; 330Timeline._Band.prototype._recenterDiv=function(){this._viewOffset=-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1)/2; 331if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px"; 332this._div.style.width=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px"; 333}else{this._div.style.top=this._viewOffset+"px"; 334this._div.style.height=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px"; 335}this.layout(); 336}; 337Timeline._Band.prototype._paintEvents=function(){this._eventPainter.paint(); 338}; 339Timeline._Band.prototype._softPaintEvents=function(){this._eventPainter.softPaint(); 340}; 341Timeline._Band.prototype._paintDecorators=function(){for(var A=0; 342A<this._decorators.length; 343A++){this._decorators[A].paint(); 344}}; 345Timeline._Band.prototype._softPaintDecorators=function(){for(var A=0; 346A<this._decorators.length; 347A++){this._decorators[A].softPaint(); 348}}; 349Timeline._Band.prototype.closeBubble=function(){SimileAjax.WindowManager.cancelPopups(); 350}; 351 352 353/* compact-painter.js */ 354Timeline.CompactEventPainter=function(A){this._params=A; 355this._onSelectListeners=[]; 356this._filterMatcher=null; 357this._highlightMatcher=null; 358this._frc=null; 359this._eventIdToElmt={}; 360}; 361Timeline.CompactEventPainter.prototype.initialize=function(B,A){this._band=B; 362this._timeline=A; 363this._backLayer=null; 364this._eventLayer=null; 365this._lineLayer=null; 366this._highlightLayer=null; 367this._eventIdToElmt=null; 368}; 369Timeline.CompactEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); 370}; 371Timeline.CompactEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; 372A<this._onSelectListeners.length; 373A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); 374break; 375}}}; 376Timeline.CompactEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; 377}; 378Timeline.CompactEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; 379}; 380Timeline.CompactEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; 381}; 382Timeline.CompactEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; 383}; 384Timeline.CompactEventPainter.prototype.paint=function(){var N=this._band.getEventSource(); 385if(N==null){return ; 386}this._eventIdToElmt={}; 387this._prepareForPainting(); 388var O=this._params.theme; 389var L=O.event; 390var G={trackOffset:"trackOffset" in this._params?this._params.trackOffset:10,trackHeight:"trackHeight" in this._params?this._params.trackHeight:10,tapeHeight:O.event.tape.height,tapeBottomMargin:"tapeBottomMargin" in this._params?this._params.tapeBottomMargin:2,labelBottomMargin:"labelBottomMargin" in this._params?this._params.labelBottomMargin:5,labelRightMargin:"labelRightMargin" in this._params?this._params.labelRightMargin:5,defaultIcon:L.instant.icon,defaultIconWidth:L.instant.iconWidth,defaultIconHeight:L.instant.iconHeight,customIconWidth:"iconWidth" in this._params?this._params.iconWidth:L.instant.iconWidth,customIconHeight:"iconHeight" in this._params?this._params.iconHeight:L.instant.iconHeight,iconLabelGap:"iconLabelGap" in this._params?this._params.iconLabelGap:2,iconBottomMargin:"iconBottomMargin" in this._params?this._params.iconBottomMargin:2}; 391if("compositeIcon" in this._params){G.compositeIcon=this._params.compositeIcon; 392G.compositeIconWidth=this._params.compositeIconWidth||G.customIconWidth; 393G.compositeIconHeight=this._params.compositeIconHeight||G.customIconHeight; 394}else{G.compositeIcon=G.defaultIcon; 395G.compositeIconWidth=G.defaultIconWidth; 396G.compositeIconHeight=G.defaultIconHeight; 397}G.defaultStackIcon="icon" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.icon:G.defaultIcon; 398G.defaultStackIconWidth="iconWidth" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.iconWidth:G.defaultIconWidth; 399G.defaultStackIconHeight="iconHeight" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.iconHeight:G.defaultIconHeight; 400var B=this._band.getMinDate(); 401var D=this._band.getMaxDate(); 402var R=(this._filterMatcher!=null)?this._filterMatcher:function(S){return true; 403}; 404var Q=(this._highlightMatcher!=null)?this._highlightMatcher:function(S){return -1; 405}; 406var F=N.getEventIterator(B,D); 407var H="stackConcurrentPreciseInstantEvents" in this._params&&typeof this._params.stackConcurrentPreciseInstantEvents=="object"; 408var P="collapseConcurrentPreciseInstantEvents" in this._params&&this._params.collapseConcurrentPreciseInstantEvents; 409if(P||H){var M=[]; 410var A=null; 411while(F.hasNext()){var E=F.next(); 412if(R(E)){if(!E.isInstant()||E.isImprecise()){this.paintEvent(E,G,this._params.theme,Q(E)); 413}else{if(A!=null&&A.getStart().getTime()==E.getStart().getTime()){M[M.length-1].push(E); 414}else{M.push([E]); 415A=E; 416}}}}for(var J=0; 417J<M.length; 418J++){var K=M[J]; 419if(K.length==1){this.paintEvent(K[0],G,this._params.theme,Q(E)); 420}else{var C=-1; 421for(var I=0; 422C<0&&I<K.length; 423I++){C=Q(K[I]); 424}if(H){this.paintStackedPreciseInstantEvents(K,G,this._params.theme,C); 425}else{this.paintCompositePreciseInstantEvents(K,G,this._params.theme,C); 426}}}}else{while(F.hasNext()){var E=F.next(); 427if(R(E)){this.paintEvent(E,G,this._params.theme,Q(E)); 428}}}this._highlightLayer.style.display="block"; 429this._lineLayer.style.display="block"; 430this._eventLayer.style.display="block"; 431}; 432Timeline.CompactEventPainter.prototype.softPaint=function(){}; 433Timeline.CompactEventPainter.prototype._prepareForPainting=function(){var B=this._band; 434if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); 435this._backLayer.style.visibility="hidden"; 436var A=document.createElement("span"); 437A.className="timeline-event-label"; 438this._backLayer.appendChild(A); 439this._frc=SimileAjax.Graphics.getFontRenderingContext(A); 440}this._frc.update(); 441this._tracks=[]; 442if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); 443}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); 444this._highlightLayer.style.display="none"; 445if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); 446}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); 447this._lineLayer.style.display="none"; 448if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); 449}this._eventLayer=B.createLayerDiv(115,"timeline-band-events"); 450this._eventLayer.style.display="none"; 451}; 452Timeline.CompactEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); 453}else{this.paintDurationEvent(B,C,D,A); 454}}; 455Timeline.CompactEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); 456}else{this.paintPreciseInstantEvent(B,C,D,A); 457}}; 458Timeline.CompactEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); 459}else{this.paintPreciseDurationEvent(B,C,D,A); 460}}; 461Timeline.CompactEventPainter.prototype.paintPreciseInstantEvent=function(H,F,B,A){var C={tooltip:H.getProperty("tooltip")||H.getText()}; 462var E={url:H.getIcon()}; 463if(E.url==null){E.url=F.defaultIcon; 464E.width=F.defaultIconWidth; 465E.height=F.defaultIconHeight; 466E.className="timeline-event-icon-default"; 467}else{E.width=H.getProperty("iconWidth")||F.customIconWidth; 468E.height=H.getProperty("iconHeight")||F.customIconHeight; 469}var J={text:H.getText(),color:H.getTextColor()||H.getColor(),className:H.getClassName()}; 470var G=this.paintTapeIconLabel(H.getStart(),C,null,E,J,F,B,A); 471var I=this; 472var D=function(L,K,M){return I._onClickInstantEvent(G.iconElmtData.elmt,K,H); 473}; 474SimileAjax.DOM.registerEvent(G.iconElmtData.elmt,"mousedown",D); 475SimileAjax.DOM.registerEvent(G.labelElmtData.elmt,"mousedown",D); 476this._eventIdToElmt[H.getID()]=G.iconElmtData.elmt; 477}; 478Timeline.CompactEventPainter.prototype.paintCompositePreciseInstantEvents=function(J,H,D,B){var K=J[0]; 479var A=[]; 480for(var C=0; 481C<J.length; 482C++){A.push(J[C].getProperty("tooltip")||J[C].getText()); 483}var E={tooltip:A.join("; ")}; 484var G={url:H.compositeIcon,width:H.compositeIconWidth,height:H.compositeIconHeight,className:"timeline-event-icon-composite"}; 485var M={text:String.substitute(this._params.compositeEventLabelTemplate,[J.length])}; 486var I=this.paintTapeIconLabel(K.getStart(),E,null,G,M,H,D,B); 487var L=this; 488var F=function(O,N,P){return L._onClickMultiplePreciseInstantEvent(I.iconElmtData.elmt,N,J); 489}; 490SimileAjax.DOM.registerEvent(I.iconElmtData.elmt,"mousedown",F); 491SimileAjax.DOM.registerEvent(I.labelElmtData.elmt,"mousedown",F); 492for(var C=0; 493C<J.length; 494C++){this._eventIdToElmt[J[C].getID()]=I.iconElmtData.elmt; 495}}; 496Timeline.CompactEventPainter.prototype.paintStackedPreciseInstantEvents=function(T,j,c,E){var S="limit" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.limit:10; 497var G="moreMessageTemplate" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.moreMessageTemplate:"%0 More Events"; 498var Q=S<=T.length-2; 499var B=this._band; 500var L=function(i){return Math.round(B.dateToPixelOffset(i)); 501}; 502var O=function(i){var r={url:i.getIcon()}; 503if(r.url==null){r.url=j.defaultStackIcon; 504r.width=j.defaultStackIconWidth; 505r.height=j.defaultStackIconHeight; 506r.className="timeline-event-icon-stack timeline-event-icon-default"; 507}else{r.width=i.getProperty("iconWidth")||j.customIconWidth; 508r.height=i.getProperty("iconHeight")||j.customIconHeight; 509r.className="timeline-event-icon-stack"; 510}return r; 511}; 512var C=O(T[0]); 513var V=5; 514var D=0; 515var g=0; 516var p=0; 517var U=0; 518var l=[]; 519for(var n=0; 520n<T.length&&(!Q||n<S); 521n++){var b=T[n]; 522var a=b.getText(); 523var X=O(b); 524var W=this._frc.computeSize(a); 525var K={text:a,iconData:X,labelSize:W,iconLeft:C.width+n*V-X.width}; 526K.labelLeft=C.width+n*V+j.iconLabelGap; 527K.top=p; 528l.push(K); 529D=Math.min(D,K.iconLeft); 530p+=W.height; 531g=Math.max(g,K.labelLeft+W.width); 532U=Math.max(U,K.top+X.height); 533}if(Q){var e=String.substitute(G,[T.length-S]); 534var H=this._frc.computeSize(e); 535var J=C.width+(S-1)*V+j.iconLabelGap; 536var m=p; 537p+=H.height; 538g=Math.max(g,J+H.width); 539}g+=j.labelRightMargin; 540p+=j.labelBottomMargin; 541U+=j.iconBottomMargin; 542var F=L(T[0].getStart()); 543var Y=[]; 544var N=Math.ceil(Math.max(U,p)/j.trackHeight); 545var M=C.width+(T.length-1)*V; 546for(var n=0; 547n<N; 548n++){Y.push({start:D,end:M}); 549}var f=Math.ceil(p/j.trackHeight); 550for(var n=0; 551n<f; 552n++){var P=Y[n]; 553P.end=Math.max(P.end,g); 554}var k=this._fitTracks(F,Y); 555var Z=k*j.trackHeight+j.trackOffset; 556var q=this._timeline.getDocument().createElement("div"); 557q.className="timeline-event-icon-stack"; 558q.style.position="absolute"; 559q.style.overflow="visible"; 560q.style.left=F+"px"; 561q.style.top=Z+"px"; 562q.style.width=M+"px"; 563q.style.height=U+"px"; 564q.innerHTML="<div style='position: relative'></div>"; 565this._eventLayer.appendChild(q); 566var I=this; 567var R=function(r){try{var w=parseInt(this.getAttribute("index")); 568var u=q.firstChild.childNodes; 569for(var s=0; 570s<u.length; 571s++){var v=u[s]; 572if(s==w){v.style.zIndex=u.length; 573}else{v.style.zIndex=u.length-s; 574}}}catch(t){}}; 575var d=function(u){var w=l[u]; 576var r=T[u]; 577var i=r.getProperty("tooltip")||r.getText(); 578var v=I._paintEventLabel({tooltip:i},{text:w.text},F+w.labelLeft,Z+w.top,w.labelSize.width,w.labelSize.height,c); 579v.elmt.setAttribute("index",u); 580v.elmt.onmouseover=R; 581var t=SimileAjax.Graphics.createTranslucentImage(w.iconData.url); 582var s=I._timeline.getDocument().createElement("div"); 583s.className="timeline-event-icon"+("className" in w.iconData?(" "+w.iconData.className):""); 584s.style.left=w.iconLeft+"px"; 585s.style.top=w.top+"px"; 586s.style.zIndex=(l.length-u); 587s.appendChild(t); 588s.setAttribute("index",u); 589s.onmouseover=R; 590q.firstChild.appendChild(s); 591var x=function(z,y,AA){return I._onClickInstantEvent(v.elmt,y,r); 592}; 593SimileAjax.DOM.registerEvent(s,"mousedown",x); 594SimileAjax.DOM.registerEvent(v.elmt,"mousedown",x); 595I._eventIdToElmt[r.getID()]=s; 596}; 597for(var n=0; 598n<l.length; 599n++){d(n); 600}if(Q){var o=T.slice(S); 601var A=this._paintEventLabel({tooltip:e},{text:e},F+J,Z+m,H.width,H.height,c); 602var h=function(r,i,s){return I._onClickMultiplePreciseInstantEvent(A.elmt,i,o); 603}; 604SimileAjax.DOM.registerEvent(A.elmt,"mousedown",h); 605for(var n=0; 606n<o.length; 607n++){this._eventIdToElmt[o[n].getID()]=A.elmt; 608}}}; 609Timeline.CompactEventPainter.prototype.paintImpreciseInstantEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; 610var E={start:I.getStart(),end:I.getEnd(),latestStart:I.getLatestStart(),earliestEnd:I.getEarliestEnd(),isInstant:true}; 611var F={url:I.getIcon()}; 612if(F.url==null){F=null; 613}else{F.width=I.getProperty("iconWidth")||G.customIconWidth; 614F.height=I.getProperty("iconHeight")||G.customIconHeight; 615}var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; 616var H=this.paintTapeIconLabel(I.getStart(),C,E,F,K,G,B,A); 617var J=this; 618var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); 619}:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); 620}; 621SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); 622SimileAjax.DOM.registerEvent(H.impreciseTapeElmtData.elmt,"mousedown",D); 623if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); 624this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; 625}else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; 626}}; 627Timeline.CompactEventPainter.prototype.paintPreciseDurationEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; 628var E={start:I.getStart(),end:I.getEnd(),isInstant:false}; 629var F={url:I.getIcon()}; 630if(F.url==null){F=null; 631}else{F.width=I.getProperty("iconWidth")||G.customIconWidth; 632F.height=I.getProperty("iconHeight")||G.customIconHeight; 633}var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; 634var H=this.paintTapeIconLabel(I.getLatestStart(),C,E,F,K,G,B,A); 635var J=this; 636var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); 637}:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); 638}; 639SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); 640SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt,"mousedown",D); 641if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); 642this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; 643}else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; 644}}; 645Timeline.CompactEventPainter.prototype.paintImpreciseDurationEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; 646var E={start:I.getStart(),end:I.getEnd(),latestStart:I.getLatestStart(),earliestEnd:I.getEarliestEnd(),isInstant:false}; 647var F={url:I.getIcon()}; 648if(F.url==null){F=null; 649}else{F.width=I.getProperty("iconWidth")||G.customIconWidth; 650F.height=I.getProperty("iconHeight")||G.customIconHeight; 651}var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; 652var H=this.paintTapeIconLabel(I.getLatestStart(),C,E,F,K,G,B,A); 653var J=this; 654var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); 655}:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); 656}; 657SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); 658SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt,"mousedown",D); 659if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); 660this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; 661}else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; 662}}; 663Timeline.CompactEventPainter.prototype.paintTapeIconLabel=function(V,O,S,I,a,X,c,Z){var R=this._band; 664var F=function(e){return Math.round(R.dateToPixelOffset(e)); 665}; 666var d=F(V); 667var W=[]; 668var b=0; 669var B=0; 670var C=0; 671if(S!=null){b=X.tapeHeight+X.tapeBottomMargin; 672B=Math.ceil(X.tapeHeight/X.trackHeight); 673var A=F(S.end)-d; 674var L=F(S.start)-d; 675for(var Q=0; 676Q<B; 677Q++){W.push({start:L,end:A}); 678}C=X.trackHeight-(b%X.tapeHeight); 679}var N=0; 680var U=0; 681if(I!=null){if("iconAlign" in I&&I.iconAlign=="center"){N=-Math.floor(I.width/2); 682}U=N+I.width+X.iconLabelGap; 683if(B>0){W[B-1].end=Math.max(W[B-1].end,U); 684}var E=I.height+X.iconBottomMargin+C; 685while(E>0){W.push({start:N,end:U}); 686E-=X.trackHeight; 687}}var P=a.text; 688var H=this._frc.computeSize(P); 689var M=H.height+X.labelBottomMargin+C; 690var J=U+H.width+X.labelRightMargin; 691if(B>0){W[B-1].end=Math.max(W[B-1].end,J); 692}for(var Y=0; 693M>0; 694Y++){if(B+Y<W.length){var T=W[B+Y]; 695T.end=J; 696}else{W.push({start:0,end:J}); 697}M-=X.trackHeight; 698}var G=this._fitTracks(d,W); 699var K=G*X.trackHeight+X.trackOffset; 700var D={}; 701D.labelElmtData=this._paintEventLabel(O,a,d+U,K+b,H.width,H.height,c); 702if(S!=null){if("latestStart" in S||"earliestEnd" in S){D.impreciseTapeElmtData=this._paintEventTape(O,S,X.tapeHeight,K,F(S.start),F(S.end),c.event.duration.impreciseColor,c.event.duration.impreciseOpacity,X,c); 703}if(!S.isInstant&&"start" in S&&"end" in S){D.tapeElmtData=this._paintEventTape(O,S,X.tapeHeight,K,d,F("earliestEnd" in S?S.earliestEnd:S.end),S.color,100,X,c); 704}}if(I!=null){D.iconElmtData=this._paintEventIcon(O,I,K+b,d+N,X,c); 705}return D; 706}; 707Timeline.CompactEventPainter.prototype._fitTracks=function(F,C){var H; 708for(H=0; 709H<this._tracks.length; 710H++){var E=true; 711for(var B=0; 712B<C.length&&(H+B)<this._tracks.length; 713B++){var G=this._tracks[H+B]; 714var A=C[B]; 715if(F+A.start<G){E=false; 716break; 717}}if(E){break; 718}}for(var D=0; 719D<C.length; 720D++){this._tracks[H+D]=F+C[D].end; 721}return H; 722}; 723Timeline.CompactEventPainter.prototype._paintEventIcon=function(C,D,H,G,E,F){var B=SimileAjax.Graphics.createTranslucentImage(D.url); 724var A=this._timeline.getDocument().createElement("div"); 725A.className="timeline-event-icon"+("className" in D?(" "+D.className):""); 726A.style.left=G+"px"; 727A.style.top=H+"px"; 728A.appendChild(B); 729if("tooltip" in C&&typeof C.tooltip=="string"){A.title=C.tooltip; 730}this._eventLayer.appendChild(A); 731return{left:G,top:H,width:E.iconWidth,height:E.iconHeight,elmt:A}; 732}; 733Timeline.CompactEventPainter.prototype._paintEventLabel=function(E,I,C,F,A,G,D){var H=this._timeline.getDocument(); 734var B=H.createElement("div"); 735B.className="timeline-event-label"; 736B.style.left=C+"px"; 737B.style.width=(A+1)+"px"; 738B.style.top=F+"px"; 739B.innerHTML=I.text; 740if("tooltip" in E&&typeof E.tooltip=="string"){B.title=E.tooltip; 741}if("color" in I&&typeof I.color=="string"){B.style.color=I.color; 742}if("className" in I&&typeof I.className=="string"){B.className+=" "+I.className; 743}this._eventLayer.appendChild(B); 744return{left:C,top:F,width:A,height:G,elmt:B}; 745}; 746Timeline.CompactEventPainter.prototype._paintEventTape=function(G,H,K,J,D,A,E,C,I,F){var B=A-D; 747var L=this._timeline.getDocument().createElement("div"); 748L.className="timeline-event-tape"; 749L.style.left=D+"px"; 750L.style.top=J+"px"; 751L.style.width=B+"px"; 752L.style.height=K+"px"; 753if("tooltip" in G&&typeof G.tooltip=="string"){L.title=G.tooltip; 754}if(E!=null&&typeof H.color=="string"){L.style.backgroundColor=E; 755}if("backgroundImage" in H&&typeof H.backgroundImage=="string"){L.style.backgroundImage="url("+backgroundImage+")"; 756L.style.backgroundRepeat=("backgroundRepeat" in H&&typeof H.backgroundRepeat=="string")?H.backgroundRepeat:"repeat"; 757}SimileAjax.Graphics.setOpacity(L,C); 758if("className" in H&&typeof H.className=="string"){L.className+=" "+H.className; 759}this._eventLayer.appendChild(L); 760return{left:D,top:J,width:B,height:K,elmt:L}; 761}; 762Timeline.CompactEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); 763var G=E.event; 764var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; 765var F=D.createElement("div"); 766F.style.position="absolute"; 767F.style.overflow="hidden"; 768F.style.left=(C.left-2)+"px"; 769F.style.width=(C.width+4)+"px"; 770F.style.top=(C.top-2)+"px"; 771F.style.height=(C.height+4)+"px"; 772this._highlightLayer.appendChild(F); 773}}; 774Timeline.CompactEventPainter.prototype._onClickMultiplePreciseInstantEvent=function(E,A,B){var F=SimileAjax.DOM.getPageCoordinates(E); 775this._showBubble(F.left+Math.ceil(E.offsetWidth/2),F.top+Math.ceil(E.offsetHeight/2),B); 776var D=[]; 777for(var C=0; 778C<B.length; 779C++){D.push(B[C].getID()); 780}this._fireOnSelect(D); 781A.cancelBubble=true; 782SimileAjax.DOM.cancelEvent(A); 783return false; 784}; 785Timeline.CompactEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); 786this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),[B]); 787this._fireOnSelect([B.getID()]); 788A.cancelBubble=true; 789SimileAjax.DOM.cancelEvent(A); 790return false; 791}; 792Timeline.CompactEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; 793var E=B.pageY; 794}else{var D=SimileAjax.DOM.getPageCoordinates(F); 795var A=B.offsetX+D.left; 796var E=B.offsetY+D.top; 797}this._showBubble(A,E,[C]); 798this._fireOnSelect([C.getID()]); 799B.cancelBubble=true; 800SimileAjax.DOM.cancelEvent(B); 801return false; 802}; 803Timeline.CompactEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; 804if(B){var C=SimileAjax.DOM.getPageCoordinates(B); 805this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,[A]); 806}}; 807Timeline.CompactEventPainter.prototype._showBubble=function(A,F,B){var E=document.createElement("div"); 808B=("fillInfoBubble" in B)?[B]:B; 809for(var D=0; 810D<B.length; 811D++){var C=document.createElement("div"); 812E.appendChild(C); 813B[D].fillInfoBubble(C,this._params.theme,this._band.getLabeller()); 814}SimileAjax.WindowManager.cancelPopups(); 815SimileAjax.Graphics.createBubbleForContentAndPoint(E,A,F,this._params.theme.event.bubble.width); 816}; 817Timeline.CompactEventPainter.prototype._fireOnSelect=function(B){for(var A=0; 818A<this._onSelectListeners.length; 819A++){this._onSelectListeners[A](B); 820}}; 821 822 823/* decorators.js */ 824Timeline.SpanHighlightDecorator=function(A){this._unit=A.unit!=null?A.unit:SimileAjax.NativeDateUnit; 825this._startDate=(typeof A.startDate=="string")?this._unit.parseFromObject(A.startDate):A.startDate; 826this._endDate=(typeof A.endDate=="string")?this._unit.parseFromObject(A.endDate):A.endDate; 827this._startLabel=A.startLabel!=null?A.startLabel:""; 828this._endLabel=A.endLabel!=null?A.endLabel:""; 829this._color=A.color; 830this._cssClass=A.cssClass!=null?A.cssClass:null; 831this._opacity=A.opacity!=null?A.opacity:100; 832this._zIndex=(A.inFront!=null&&A.inFront)?113:10; 833}; 834Timeline.SpanHighlightDecorator.prototype.initialize=function(B,A){this._band=B; 835this._timeline=A; 836this._layerDiv=null; 837}; 838Timeline.SpanHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv); 839}this._layerDiv=this._band.createLayerDiv(this._zIndex); 840this._layerDiv.setAttribute("name","span-highlight-decorator"); 841this._layerDiv.style.display="none"; 842var E=this._band.getMinDate(); 843var A=this._band.getMaxDate(); 844if(this._unit.compare(this._startDate,A)<0&&this._unit.compare(this._endDate,E)>0){E=this._unit.later(E,this._startDate); 845A=this._unit.earlier(A,this._endDate); 846var F=this._band.dateToPixelOffset(E); 847var I=this._band.dateToPixelOffset(A); 848var H=this._timeline.getDocument(); 849var K=function(){var L=H.createElement("table"); 850L.insertRow(0).insertCell(0); 851return L; 852}; 853var B=H.createElement("div"); 854B.className="timeline-highlight-decorator"; 855if(this._cssClass){B.className+=" "+this._cssClass; 856}if(this._color!=null){B.style.backgroundColor=this._color; 857}if(this._opacity<100){SimileAjax.Graphics.setOpacity(B,this._opacity); 858}this._layerDiv.appendChild(B); 859var J=K(); 860J.className="timeline-highlight-label timeline-highlight-label-start"; 861var C=J.rows[0].cells[0]; 862C.innerHTML=this._startLabel; 863if(this._cssClass){C.className="label_"+this._cssClass; 864}this._layerDiv.appendChild(J); 865var G=K(); 866G.className="timeline-highlight-label timeline-highlight-label-end"; 867var D=G.rows[0].cells[0]; 868D.innerHTML=this._endLabel; 869if(this._cssClass){D.className="label_"+this._cssClass; 870}this._layerDiv.appendChild(G); 871if(this._timeline.isHorizontal()){B.style.left=F+"px"; 872B.style.width=(I-F)+"px"; 873J.style.right=(this._band.getTotalViewLength()-F)+"px"; 874J.style.width=(this._startLabel.length)+"em"; 875G.style.left=I+"px"; 876G.style.width=(this._endLabel.length)+"em"; 877}else{B.style.top=F+"px"; 878B.style.height=(I-F)+"px"; 879J.style.bottom=F+"px"; 880J.style.height="1.5px"; 881G.style.top=I+"px"; 882G.style.height="1.5px"; 883}}this._layerDiv.style.display="block"; 884}; 885Timeline.SpanHighlightDecorator.prototype.softPaint=function(){}; 886Timeline.PointHighlightDecorator=function(A){this._unit=A.unit!=null?A.unit:SimileAjax.NativeDateUnit; 887this._date=(typeof A.date=="string")?this._unit.parseFromObject(A.date):A.date; 888this._width=A.width!=null?A.width:10; 889this._color=A.color; 890this._cssClass=A.cssClass!=null?A.cssClass:""; 891this._opacity=A.opacity!=null?A.opacity:100; 892}; 893Timeline.PointHighlightDecorator.prototype.initialize=function(B,A){this._band=B; 894this._timeline=A; 895this._layerDiv=null; 896}; 897Timeline.PointHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv); 898}this._layerDiv=this._band.createLayerDiv(10); 899this._layerDiv.setAttribute("name","span-highlight-decorator"); 900this._layerDiv.style.display="none"; 901var C=this._band.getMinDate(); 902var E=this._band.getMaxDate(); 903if(this._unit.compare(this._date,E)<0&&this._unit.compare(this._date,C)>0){var A=this._band.dateToPixelOffset(this._date); 904var B=A-Math.round(this._width/2); 905var D=this._timeline.getDocument(); 906var F=D.createElement("div"); 907F.className="timeline-highlight-point-decorator"; 908F.className+=" "+this._cssClass; 909if(this._color!=null){F.style.backgroundColor=this._color; 910}if(this._opacity<100){SimileAjax.Graphics.setOpacity(F,this._opacity); 911}this._layerDiv.appendChild(F); 912if(this._timeline.isHorizontal()){F.style.left=B+"px"; 913F.style.width=this._width; 914}else{F.style.top=B+"px"; 915F.style.height=this._width; 916}}this._layerDiv.style.display="block"; 917}; 918Timeline.PointHighlightDecorator.prototype.softPaint=function(){}; 919 920 921/* detailed-painter.js */ 922Timeline.DetailedEventPainter=function(A){this._params=A; 923this._onSelectListeners=[]; 924this._filterMatcher=null; 925this._highlightMatcher=null; 926this._frc=null; 927this._eventIdToElmt={}; 928}; 929Timeline.DetailedEventPainter.prototype.initialize=function(B,A){this._band=B; 930this._timeline=A; 931this._backLayer=null; 932this._eventLayer=null; 933this._lineLayer=null; 934this._highlightLayer=null; 935this._eventIdToElmt=null; 936}; 937Timeline.DetailedEventPainter.prototype.getType=function(){return"detailed"; 938}; 939Timeline.DetailedEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); 940}; 941Timeline.DetailedEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; 942A<this._onSelectListeners.length; 943A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); 944break; 945}}}; 946Timeline.DetailedEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; 947}; 948Timeline.DetailedEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; 949}; 950Timeline.DetailedEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; 951}; 952Timeline.DetailedEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; 953}; 954Timeline.DetailedEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); 955if(C==null){return ; 956}this._eventIdToElmt={}; 957this._prepareForPainting(); 958var I=this._params.theme.event; 959var G=Math.max(I.track.height,this._frc.getLineHeight()); 960var F={trackOffset:Math.round(this._band.getViewWidth()/2-G/2),trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width}; 961var D=this._band.getMinDate(); 962var B=this._band.getMaxDate(); 963var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true; 964}; 965var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1; 966}; 967var E=C.getEventReverseIterator(D,B); 968while(E.hasNext()){var H=E.next(); 969if(J(H)){this.paintEvent(H,F,this._params.theme,A(H)); 970}}this._highlightLayer.style.display="block"; 971this._lineLayer.style.display="block"; 972this._eventLayer.style.display="block"; 973this._band.updateEventTrackInfo(this._lowerTracks.length+this._upperTracks.length,F.trackIncrement); 974}; 975Timeline.DetailedEventPainter.prototype.softPaint=function(){}; 976Timeline.DetailedEventPainter.prototype._prepareForPainting=function(){var B=this._band; 977if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); 978this._backLayer.style.visibility="hidden"; 979var A=document.createElement("span"); 980A.className="timeline-event-label"; 981this._backLayer.appendChild(A); 982this._frc=SimileAjax.Graphics.getFontRenderingContext(A); 983}this._frc.update(); 984this._lowerTracks=[]; 985this._upperTracks=[]; 986if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); 987}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); 988this._highlightLayer.style.display="none"; 989if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); 990}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); 991this._lineLayer.style.display="none"; 992if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); 993}this._eventLayer=B.createLayerDiv(110,"timeline-band-events"); 994this._eventLayer.style.display="none"; 995}; 996Timeline.DetailedEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); 997}else{this.paintDurationEvent(B,C,D,A); 998}}; 999Timeline.DetailedEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); 1000}else{this.paintPreciseInstantEvent(B,C,D,A); 1001}}; 1002Timeline.DetailedEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); 1003}else{this.paintPreciseDurationEvent(B,C,D,A); 1004}}; 1005Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent=function(L,P,S,Q){var T=this._timeline.getDocument(); 1006var J=L.getText(); 1007var G=L.getStart(); 1008var H=Math.round(this._band.dateToPixelOffset(G)); 1009var A=Math.round(H+P.iconWidth/2); 1010var C=Math.round(H-P.iconWidth/2); 1011var E=this._frc.computeSize(J); 1012var F=this._findFreeTrackForSolid(A,H); 1013var B=this._paintEventIcon(L,F,C,P,S); 1014var K=A+S.event.label.offsetFromLine; 1015var O=F; 1016var D=this._getTrackData(F); 1017if(Math.min(D.solid,D.text)>=K+E.width){D.solid=C; 1018D.text=K; 1019}else{D.solid=C; 1020K=H+S.event.label.offsetFromLine; 1021O=this._findFreeTrackForText(F,K+E.width,function(U){U.line=H-2; 1022}); 1023this._getTrackData(O).text=C; 1024this._paintEventLine(L,H,F,O,P,S); 1025}var N=Math.round(P.trackOffset+O*P.trackIncrement+P.trackHeight/2-E.height/2); 1026var R=this._paintEventLabel(L,J,K,N,E.width,E.height,S); 1027var M=this; 1028var I=function(V,U,W){return M._onClickInstantEvent(B.elmt,U,L); 1029}; 1030SimileAjax.DOM.registerEvent(B.elmt,"mousedown",I); 1031SimileAjax.DOM.registerEvent(R.elmt,"mousedown",I); 1032this._createHighlightDiv(Q,B,S); 1033this._eventIdToElmt[L.getID()]=B.elmt; 1034}; 1035Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent=function(O,S,W,T){var X=this._timeline.getDocument(); 1036var M=O.getText(); 1037var I=O.getStart(); 1038var U=O.getEnd(); 1039var K=Math.round(this._band.dateToPixelOffset(I)); 1040var B=Math.round(this._band.dateToPixelOffset(U)); 1041var A=Math.round(K+S.iconWidth/2); 1042var D=Math.round(K-S.iconWidth/2); 1043var G=this._frc.computeSize(M); 1044var H=this._findFreeTrackForSolid(B,K); 1045var E=this._paintEventTape(O,H,K,B,W.event.instant.impreciseColor,W.event.instant.impreciseOpacity,S,W); 1046var C=this._paintEventIcon(O,H,D,S,W); 1047var F=this._getTrackData(H); 1048F.solid=D; 1049var N=A+W.event.label.offsetFromLine; 1050var J=N+G.width; 1051var R; 1052if(J<B){R=H; 1053}else{N=K+W.event.label.offsetFromLine; 1054J=N+G.width; 1055R=this._findFreeTrackForText(H,J,function(Y){Y.line=K-2; 1056}); 1057this._getTrackData(R).text=D; 1058this._paintEventLine(O,K,H,R,S,W); 1059}var Q=Math.round(S.trackOffset+R*S.trackIncrement+S.trackHeight/2-G.height/2); 1060var V=this._paintEventLabel(O,M,N,Q,G.width,G.height,W); 1061var P=this; 1062var L=function(Z,Y,a){return P._onClickInstantEvent(C.elmt,Y,O); 1063}; 1064SimileAjax.DOM.registerEvent(C.elmt,"mousedown",L); 1065SimileAjax.DOM.registerEvent(E.elmt,"mousedown",L); 1066SimileAjax.DOM.registerEvent(V.elmt,"mousedown",L); 1067this._createHighlightDiv(T,C,W); 1068this._eventIdToElmt[O.getID()]=C.elmt; 1069}; 1070Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent=function(K,O,T,Q){var U=this._timeline.getDocument(); 1071var I=K.getText(); 1072var E=K.getStart(); 1073var R=K.getEnd(); 1074var F=Math.round(this._band.dateToPixelOffset(E)); 1075var A=Math.round(this._band.dateToPixelOffset(R)); 1076var C=this._frc.computeSize(I); 1077var D=this._findFreeTrackForSolid(A); 1078var P=K.getColor(); 1079P=P!=null?P:T.event.duration.color; 1080var B=this._paintEventTape(K,D,F,A,P,100,O,T); 1081var H=this._getTrackData(D); 1082H.solid=F; 1083var J=F+T.event.label.offsetFromLine; 1084var N=this._findFreeTrackForText(D,J+C.width,function(V){V.line=F-2; 1085}); 1086this._getTrackData(N).text=F-2; 1087this._paintEventLine(K,F,D,N,O,T); 1088var M=Math.round(O.trackOffset+N*O.trackIncrement+O.trackHeight/2-C.height/2); 1089var S=this._paintEventLabel(K,I,J,M,C.width,C.height,T); 1090var L=this; 1091var G=function(W,V,X){return L._onClickDurationEvent(B.elmt,V,K); 1092}; 1093SimileAjax.DOM.registerEvent(B.elmt,"mousedown",G); 1094SimileAjax.DOM.registerEvent(S.elmt,"mousedown",G); 1095this._createHighlightDiv(Q,B,T); 1096this._eventIdToElmt[K.getID()]=B.elmt; 1097}; 1098Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent=function(M,T,Y,V){var Z=this._timeline.getDocument(); 1099var K=M.getText(); 1100var G=M.getStart(); 1101var S=M.getLatestStart(); 1102var W=M.getEnd(); 1103var O=M.getEarliestEnd(); 1104var H=Math.round(this._band.dateToPixelOffset(G)); 1105var E=Math.round(this._band.dateToPixelOffset(S)); 1106var A=Math.round(this._band.dateToPixelOffset(W)); 1107var F=Math.round(this._band.dateToPixelOffset(O)); 1108var C=this._frc.computeSize(K); 1109var D=this._findFreeTrackForSolid(A); 1110var U=M.getColor(); 1111U=U!=null?U:Y.event.duration.color; 1112var R=this._paintEventTape(M,D,H,A,Y.event.duration.impreciseColor,Y.event.duration.impreciseOpacity,T,Y); 1113var B=this._paintEventTape(M,D,E,F,U,100,T,Y); 1114var J=this._getTrackData(D); 1115J.solid=H; 1116var L=E+Y.event.label.offsetFromLine; 1117var Q=this._findFreeTrackForText(D,L+C.width,function(a){a.line=E-2; 1118}); 1119this._getTrackData(Q).text=E-2; 1120this._paintEventLine(M,E,D,Q,T,Y); 1121var P=Math.round(T.trackOffset+Q*T.trackIncrement+T.trackHeight/2-C.height/2); 1122var X=this._paintEventLabel(M,K,L,P,C.width,C.height,Y); 1123var N=this; 1124var I=function(b,a,c){return N._onClickDurationEvent(B.elmt,a,M); 1125}; 1126SimileAjax.DOM.registerEvent(B.elmt,"mousedown",I); 1127SimileAjax.DOM.registerEvent(X.elmt,"mousedown",I); 1128this._createHighlightDiv(V,B,Y); 1129this._eventIdToElmt[M.getID()]=B.elmt; 1130}; 1131Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid=function(D,A){for(var C=0; 1132true; 1133C++){if(C<this._lowerTracks.length){var B=this._lowerTracks[C]; 1134if(Math.min(B.solid,B.text)>D&&(!(A)||B.line>A)){return C; 1135}}else{this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); 1136return C; 1137}if(C<this._upperTracks.length){var B=this._upperTracks[C]; 1138if(Math.min(B.solid,B.text)>D&&(!(A)||B.line>A)){return -1-C; 1139}}else{this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); 1140return -1-C; 1141}}}; 1142Timeline.DetailedEventPainter.prototype._findFreeTrackForText=function(C,A,I){var B; 1143var E; 1144var F; 1145var H; 1146if(C<0){B=true; 1147F=-C; 1148E=this._findFreeUpperTrackForText(F,A); 1149H=-1-E; 1150}else{if(C>0){B=false; 1151F=C+1; 1152E=this._findFreeLowerTrackForText(F,A); 1153H=E; 1154}else{var G=this._findFreeUpperTrackForText(0,A); 1155var J=this._findFreeLowerTrackForText(1,A); 1156if(J-1<=G){B=false; 1157F=1; 1158E=J; 1159H=E; 1160}else{B=true; 1161F=0; 1162E=G; 1163H=-1-E; 1164}}}if(B){if(E==this._upperTracks.length){this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); 1165}for(var D=F; 1166D<E; 1167D++){I(this._upperTracks[D]); 1168}}else{if(E==this._lowerTracks.length){this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); 1169}for(var D=F; 1170D<E; 1171D++){I(this._lowerTracks[D]); 1172}}return H; 1173}; 1174Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText=function(A,C){for(; 1175A<this._lowerTracks.length; 1176A++){var B=this._lowerTracks[A]; 1177if(Math.min(B.solid,B.text)>=C){break; 1178}}return A; 1179}; 1180Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText=function(A,C){for(; 1181A<this._upperTracks.length; 1182A++){var B=this._upperTracks[A]; 1183if(Math.min(B.solid,B.text)>=C){break; 1184}}return A; 1185}; 1186Timeline.DetailedEventPainter.prototype._getTrackData=function(A){return(A<0)?this._upperTracks[-A-1]:this._lowerTracks[A]; 1187}; 1188Timeline.DetailedEventPainter.prototype._paintEventLine=function(J,E,D,A,G,F){var H=Math.round(G.trackOffset+D*G.trackIncrement+G.trackHeight/2); 1189var I=Math.round(Math.abs(A-D)*G.trackIncrement); 1190var C="1px solid "+F.event.label.lineColor; 1191var B=this._timeline.getDocument().createElement("div"); 1192B.style.position="absolute"; 1193B.style.left=E+"px"; 1194B.style.width=F.event.label.offsetFromLine+"px"; 1195B.style.height=I+"px"; 1196if(D>A){B.style.top=(H-I)+"px"; 1197B.style.borderTop=C; 1198}else{B.style.top=H+"px"; 1199B.style.borderBottom=C; 1200}B.style.borderLeft=C; 1201this._lineLayer.appendChild(B); 1202}; 1203Timeline.DetailedEventPainter.prototype._paintEventIcon=function(J,B,C,F,E){var H=J.getIcon(); 1204H=H!=null?H:F.icon; 1205var G=F.trackOffset+B*F.trackIncrement+F.trackHeight/2; 1206var I=Math.round(G-F.iconHeight/2); 1207var D=SimileAjax.Graphics.createTranslucentImage(H); 1208var A=this._timeline.getDocument().createElement("div"); 1209A.style.position="absolute"; 1210A.style.left=C+"px"; 1211A.style.top=I+"px"; 1212A.appendChild(D); 1213A.style.cursor="pointer"; 1214if(J._title!=null){A.title=J._title; 1215}this._eventLayer.appendChild(A); 1216return{left:C,top:I,width:F.iconWidth,height:F.iconHeight,elmt:A}; 1217}; 1218Timeline.DetailedEventPainter.prototype._paintEventLabel=function(I,J,C,F,A,G,E){var H=this._timeline.getDocument(); 1219var K=H.createElement("div"); 1220K.style.position="absolute"; 1221K.style.left=C+"px"; 1222K.style.width=A+"px"; 1223K.style.top=F+"px"; 1224K.style.height=G+"px"; 1225K.style.backgroundColor=E.event.label.backgroundColor; 1226SimileAjax.Graphics.setOpacity(K,E.event.label.backgroundOpacity); 1227this._eventLayer.appendChild(K); 1228var B=H.createElement("div"); 1229B.style.position="absolute"; 1230B.style.left=C+"px"; 1231B.style.width=A+"px"; 1232B.style.top=F+"px"; 1233B.innerHTML=J; 1234B.style.cursor="pointer"; 1235if(I._title!=null){B.title=I._title; 1236}var D=I.getTextColor(); 1237if(D==null){D=I.getColor(); 1238}if(D!=null){B.style.color=D; 1239}this._eventLayer.appendChild(B); 1240return{left:C,top:F,width:A,height:G,elmt:B}; 1241}; 1242Timeline.DetailedEventPainter.prototype._paintEventTape=function(L,B,D,A,G,C,I,H){var F=A-D; 1243var E=H.event.tape.height; 1244var K=I.trackOffset+B*I.trackIncrement+I.trackHeight/2; 1245var J=Math.round(K-E/2); 1246var M=this._timeline.getDocument().createElement("div"); 1247M.style.position="absolute"; 1248M.style.left=D+"px"; 1249M.style.width=F+"px"; 1250M.style.top=J+"px"; 1251M.style.height=E+"px"; 1252M.style.backgroundColor=G; 1253M.style.overflow="hidden"; 1254M.style.cursor="pointer"; 1255if(L._title!=null){M.title=L._title; 1256}SimileAjax.Graphics.setOpacity(M,C); 1257this._eventLayer.appendChild(M); 1258return{left:D,top:J,width:F,height:E,elmt:M}; 1259}; 1260Timeline.DetailedEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); 1261var G=E.event; 1262var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; 1263var F=D.createElement("div"); 1264F.style.position="absolute"; 1265F.style.overflow="hidden"; 1266F.style.left=(C.left-2)+"px"; 1267F.style.width=(C.width+4)+"px"; 1268F.style.top=(C.top-2)+"px"; 1269F.style.height=(C.height+4)+"px"; 1270F.style.background=B; 1271this._highlightLayer.appendChild(F); 1272}}; 1273Timeline.DetailedEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); 1274this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),B); 1275this._fireOnSelect(B.getID()); 1276A.cancelBubble=true; 1277SimileAjax.DOM.cancelEvent(A); 1278return false; 1279}; 1280Timeline.DetailedEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; 1281var E=B.pageY; 1282}else{var D=SimileAjax.DOM.getPageCoordinates(F); 1283var A=B.offsetX+D.left; 1284var E=B.offsetY+D.top; 1285}this._showBubble(A,E,C); 1286this._fireOnSelect(C.getID()); 1287B.cancelBubble=true; 1288SimileAjax.DOM.cancelEvent(B); 1289return false; 1290}; 1291Timeline.DetailedEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; 1292if(B){var C=SimileAjax.DOM.getPageCoordinates(B); 1293this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A); 1294}}; 1295Timeline.DetailedEventPainter.prototype._showBubble=function(B,E,C){var D=document.createElement("div"); 1296var A=this._params.theme.event.bubble; 1297C.fillInfoBubble(D,this._params.theme,this._band.getLabeller()); 1298SimileAjax.WindowManager.cancelPopups(); 1299SimileAjax.Graphics.createBubbleForContentAndPoint(D,B,E,A.width,null,A.maxHeight); 1300}; 1301Timeline.DetailedEventPainter.prototype._fireOnSelect=function(A){for(var B=0; 1302B<this._onSelectListeners.length; 1303B++){this._onSelectListeners[B](A); 1304}}; 1305 1306 1307/* ether-painters.js */ 1308Timeline.GregorianEtherPainter=function(A){this._params=A; 1309this._theme=A.theme; 1310this._unit=A.unit; 1311this._multiple=("multiple" in A)?A.multiple:1; 1312}; 1313Timeline.GregorianEtherPainter.prototype.initialize=function(C,B){this._band=C; 1314this._timeline=B; 1315this._backgroundLayer=C.createLayerDiv(0); 1316this._backgroundLayer.setAttribute("name","ether-background"); 1317this._backgroundLayer.className="timeline-ether-bg"; 1318this._markerLayer=null; 1319this._lineLayer=null; 1320var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; 1321var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; 1322this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); 1323this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); 1324}; 1325Timeline.GregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); 1326}; 1327Timeline.GregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); 1328}this._markerLayer=this._band.createLayerDiv(100); 1329this._markerLayer.setAttribute("name","ether-markers"); 1330this._markerLayer.style.display="none"; 1331if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); 1332}this._lineLayer=this._band.createLayerDiv(1); 1333this._lineLayer.setAttribute("name","ether-lines"); 1334this._lineLayer.style.display="none"; 1335var C=this._band.getMinDate(); 1336var F=this._band.getMaxDate(); 1337var A=this._band.getTimeZone(); 1338var E=this._band.getLabeller(); 1339SimileAjax.DateTime.roundDownToInterval(C,this._unit,A,this._multiple,this._theme.firstDayOfWeek); 1340var D=this; 1341var B=function(G){for(var H=0; 1342H<D._multiple; 1343H++){SimileAjax.DateTime.incrementByInterval(G,D._unit); 1344}}; 1345while(C.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(C,E,this._unit,this._markerLayer,this._lineLayer); 1346B(C); 1347}this._markerLayer.style.display="block"; 1348this._lineLayer.style.display="block"; 1349}; 1350Timeline.GregorianEtherPainter.prototype.softPaint=function(){}; 1351Timeline.GregorianEtherPainter.prototype.zoom=function(A){if(A!=0){this._unit+=A; 1352}}; 1353Timeline.HotZoneGregorianEtherPainter=function(G){this._params=G; 1354this._theme=G.theme; 1355this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,unit:G.unit,multiple:1}]; 1356for(var F=0; 1357F<G.zones.length; 1358F++){var C=G.zones[F]; 1359var E=SimileAjax.DateTime.parseGregorianDateTime(C.start).getTime(); 1360var B=SimileAjax.DateTime.parseGregorianDateTime(C.end).getTime(); 1361for(var D=0; 1362D<this._zones.length&&B>E; 1363D++){var A=this._zones[D]; 1364if(E<A.endTime){if(E>A.startTime){this._zones.splice(D,0,{startTime:A.startTime,endTime:E,unit:A.unit,multiple:A.multiple}); 1365D++; 1366A.startTime=E; 1367}if(B<A.endTime){this._zones.splice(D,0,{startTime:E,endTime:B,unit:C.unit,multiple:(C.multiple)?C.multiple:1}); 1368D++; 1369A.startTime=B; 1370E=B; 1371}else{A.multiple=C.multiple; 1372A.unit=C.unit; 1373E=A.endTime; 1374}}}}}; 1375Timeline.HotZoneGregorianEtherPainter.prototype.initialize=function(C,B){this._band=C; 1376this._timeline=B; 1377this._backgroundLayer=C.createLayerDiv(0); 1378this._backgroundLayer.setAttribute("name","ether-background"); 1379this._backgroundLayer.className="timeline-ether-bg"; 1380this._markerLayer=null; 1381this._lineLayer=null; 1382var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; 1383var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; 1384this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); 1385this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); 1386}; 1387Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); 1388}; 1389Timeline.HotZoneGregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); 1390}this._markerLayer=this._band.createLayerDiv(100); 1391this._markerLayer.setAttribute("name","ether-markers"); 1392this._markerLayer.style.display="none"; 1393if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); 1394}this._lineLayer=this._band.createLayerDiv(1); 1395this._lineLayer.setAttribute("name","ether-lines"); 1396this._lineLayer.style.display="none"; 1397var C=this._band.getMinDate(); 1398var A=this._band.getMaxDate(); 1399var I=this._band.getTimeZone(); 1400var L=this._band.getLabeller(); 1401var B=this; 1402var J=function(N,M){for(var O=0; 1403O<M.multiple; 1404O++){SimileAjax.DateTime.incrementByInterval(N,M.unit); 1405}}; 1406var D=0; 1407while(D<this._zones.length){if(C.getTime()<this._zones[D].endTime){break; 1408}D++; 1409}var E=this._zones.length-1; 1410while(E>=0){if(A.getTime()>this._zones[E].startTime){break; 1411}E--; 1412}for(var H=D; 1413H<=E; 1414H++){var G=this._zones[H]; 1415var K=new Date(Math.max(C.getTime(),G.startTime)); 1416var F=new Date(Math.min(A.getTime(),G.endTime)); 1417SimileAjax.DateTime.roundDownToInterval(K,G.unit,I,G.multiple,this._theme.firstDayOfWeek); 1418SimileAjax.DateTime.roundUpToInterval(F,G.unit,I,G.multiple,this._theme.firstDayOfWeek); 1419while(K.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(K,L,G.unit,this._markerLayer,this._lineLayer); 1420J(K,G); 1421}}this._markerLayer.style.display="block"; 1422this._lineLayer.style.display="block"; 1423}; 1424Timeline.HotZoneGregorianEtherPainter.prototype.softPaint=function(){}; 1425Timeline.HotZoneGregorianEtherPainter.prototype.zoom=function(A){if(A!=0){for(var B=0; 1426B<this._zones.length; 1427++B){if(this._zones[B]){this._zones[B].unit+=A; 1428}}}}; 1429Timeline.YearCountEtherPainter=function(A){this._params=A; 1430this._theme=A.theme; 1431this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate); 1432this._multiple=("multiple" in A)?A.multiple:1; 1433}; 1434Timeline.YearCountEtherPainter.prototype.initialize=function(C,B){this._band=C; 1435this._timeline=B; 1436this._backgroundLayer=C.createLayerDiv(0); 1437this._backgroundLayer.setAttribute("name","ether-background"); 1438this._backgroundLayer.className="timeline-ether-bg"; 1439this._markerLayer=null; 1440this._lineLayer=null; 1441var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; 1442var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; 1443this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); 1444this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); 1445}; 1446Timeline.YearCountEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); 1447}; 1448Timeline.YearCountEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); 1449}this._markerLayer=this._band.createLayerDiv(100); 1450this._markerLayer.setAttribute("name","ether-markers"); 1451this._markerLayer.style.display="none"; 1452if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); 1453}this._lineLayer=this._band.createLayerDiv(1); 1454this._lineLayer.setAttribute("name","ether-lines"); 1455this._lineLayer.style.display="none"; 1456var B=new Date(this._startDate.getTime()); 1457var F=this._band.getMaxDate(); 1458var E=this._band.getMinDate().getUTCFullYear()-this._startDate.getUTCFullYear(); 1459B.setUTCFullYear(this._band.getMinDate().getUTCFullYear()-E%this._multiple); 1460var C=this; 1461var A=function(G){for(var H=0; 1462H<C._multiple; 1463H++){SimileAjax.DateTime.incrementByInterval(G,SimileAjax.DateTime.YEAR); 1464}}; 1465var D={labelInterval:function(G,I){var H=G.getUTCFullYear()-C._startDate.getUTCFullYear(); 1466return{text:H,emphasized:H==0}; 1467}}; 1468while(B.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer); 1469A(B); 1470}this._markerLayer.style.display="block"; 1471this._lineLayer.style.display="block"; 1472}; 1473Timeline.YearCountEtherPainter.prototype.softPaint=function(){}; 1474Timeline.QuarterlyEtherPainter=function(A){this._params=A; 1475this._theme=A.theme; 1476this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate); 1477}; 1478Timeline.QuarterlyEtherPainter.prototype.initialize=function(C,B){this._band=C; 1479this._timeline=B; 1480this._backgroundLayer=C.createLayerDiv(0); 1481this._backgroundLayer.setAttribute("name","ether-background"); 1482this._backgroundLayer.className="timeline-ether-bg"; 1483this._markerLayer=null; 1484this._lineLayer=null; 1485var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; 1486var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; 1487this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); 1488this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); 1489}; 1490Timeline.QuarterlyEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); 1491}; 1492Timeline.QuarterlyEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); 1493}this._markerLayer=this._band.createLayerDiv(100); 1494this._markerLayer.setAttribute("name","ether-markers"); 1495this._markerLayer.style.display="none"; 1496if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); 1497}this._lineLayer=this._band.createLayerDiv(1); 1498this._lineLayer.setAttribute("name","ether-lines"); 1499this._lineLayer.style.display="none"; 1500var B=new Date(0); 1501var E=this._band.getMaxDate(); 1502B.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(),this._band.getMinDate().getUTCFullYear())); 1503B.setUTCMonth(this._startDate.getUTCMonth()); 1504var C=this; 1505var A=function(F){F.setUTCMonth(F.getUTCMonth()+3); 1506}; 1507var D={labelInterval:function(G,H){var F=(4+(G.getUTCMonth()-C._startDate.getUTCMonth())/3)%4; 1508if(F!=0){return{text:"Q"+(F+1),emphasized:false}; 1509}else{return{text:"Y"+(G.getUTCFullYear()-C._startDate.getUTCFullYear()+1),emphasized:true}; 1510}}}; 1511while(B.getTime()<E.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer); 1512A(B); 1513}this._markerLayer.style.display="block"; 1514this._lineLayer.style.display="block"; 1515}; 1516Timeline.QuarterlyEtherPainter.prototype.softPaint=function(){}; 1517Timeline.EtherIntervalMarkerLayout=function(I,L,C,E,M){var A=I.isHorizontal(); 1518if(A){if(E=="Top"){this.positionDiv=function(O,N){O.style.left=N+"px"; 1519O.style.top="0px"; 1520}; 1521}else{this.positionDiv=function(O,N){O.style.left=N+"px"; 1522O.style.bottom="0px"; 1523}; 1524}}else{if(E=="Left"){this.positionDiv=function(O,N){O.style.top=N+"px"; 1525O.style.left="0px"; 1526}; 1527}else{this.positionDiv=function(O,N){O.style.top=N+"px"; 1528O.style.right="0px"; 1529}; 1530}}var D=C.ether.interval.marker; 1531var K=C.ether.interval.line; 1532var B=C.ether.interval.weekend; 1533var H=(A?"h":"v")+E; 1534var G=D[H+"Styler"]; 1535var J=D[H+"EmphasizedStyler"]; 1536var F=SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]; 1537this.createIntervalMarker=function(T,c,a,Y,P){var U=Math.round(L.dateToPixelOffset(T)); 1538if(M&&a!=SimileAjax.DateTime.WEEK){var V=I.getDocument().createElement("div"); 1539V.className="timeline-ether-lines"; 1540if(K.opacity<100){SimileAjax.Graphics.setOpacity(V,K.opacity); 1541}if(A){V.style.left=U+"px"; 1542}else{V.style.top=U+"px"; 1543}P.appendChild(V); 1544}if(a==SimileAjax.DateTime.WEEK){var N=C.firstDayOfWeek; 1545var R=new Date(T.getTime()+(6-N-7)*F); 1546var b=new Date(R.getTime()+2*F); 1547var Q=Math.round(L.dateToPixelOffset(R)); 1548var S=Math.round(L.dateToPixelOffset(b)); 1549var W=Math.max(1,S-Q); 1550var X=I.getDocument().createElement("div"); 1551X.className="timeline-ether-weekends"; 1552if(B.opacity<100){SimileAjax.Graphics.setOpacity(X,B.opacity); 1553}if(A){X.style.left=Q+"px"; 1554X.style.width=W+"px"; 1555}else{X.style.top=Q+"px"; 1556X.style.height=W+"px"; 1557}P.appendChild(X); 1558}var Z=c.labelInterval(T,a); 1559var O=I.getDocument().createElement("div"); 1560O.innerHTML=Z.text; 1561O.className="timeline-date-label"; 1562if(Z.emphasized){O.className+=" timeline-date-label-em"; 1563}this.positionDiv(O,U); 1564Y.appendChild(O); 1565return O; 1566}; 1567}; 1568Timeline.EtherHighlight=function(B,E,D,C){var A=B.isHorizontal(); 1569this._highlightDiv=null; 1570this._createHighlightDiv=function(){if(this._highlightDiv==null){this._highlightDiv=B.getDocument().createElement("div"); 1571this._highlightDiv.setAttribute("name","ether-highlight"); 1572this._highlightDiv.className="timeline-ether-highlight"; 1573var F=D.ether.highlightOpacity; 1574if(F<100){SimileAjax.Graphics.setOpacity(this._highlightDiv,F); 1575}C.appendChild(this._highlightDiv); 1576}}; 1577this.position=function(H,J){this._createHighlightDiv(); 1578var I=Math.round(E.dateToPixelOffset(H)); 1579var G=Math.round(E.dateToPixelOffset(J)); 1580var F=Math.max(G-I,3); 1581if(A){this._highlightDiv.style.left=I+"px"; 1582this._highlightDiv.style.width=F+"px"; 1583this._highlightDiv.style.height=(E.getViewWidth()-4)+"px"; 1584}else{this._highlightDiv.style.top=I+"px"; 1585this._highlightDiv.style.height=F+"px"; 1586this._highlightDiv.style.width=(E.getViewWidth()-4)+"px"; 1587}}; 1588}; 1589 1590 1591/* ethers.js */ 1592Timeline.LinearEther=function(A){this._params=A; 1593this._interval=A.interval; 1594this._pixelsPerInterval=A.pixelsPerInterval; 1595}; 1596Timeline.LinearEther.prototype.initialize=function(B,A){this._band=B; 1597this._timeline=A; 1598this._unit=A.getUnit(); 1599if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn); 1600}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn); 1601this.shiftPixels(-this._timeline.getPixelLength()); 1602}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn); 1603this.shiftPixels(-this._timeline.getPixelLength()/2); 1604}else{this._start=this._unit.makeDefaultValue(); 1605this.shiftPixels(-this._timeline.getPixelLength()/2); 1606}}}}; 1607Timeline.LinearEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A); 1608}; 1609Timeline.LinearEther.prototype.shiftPixels=function(B){var A=this._interval*B/this._pixelsPerInterval; 1610this._start=this._unit.change(this._start,A); 1611}; 1612Timeline.LinearEther.prototype.dateToPixelOffset=function(B){var A=this._unit.compare(B,this._start); 1613return this._pixelsPerInterval*A/this._interval; 1614}; 1615Timeline.LinearEther.prototype.pixelOffsetToDate=function(B){var A=B*this._interval/this._pixelsPerInterval; 1616return this._unit.change(this._start,A); 1617}; 1618Timeline.LinearEther.prototype.zoom=function(D){var A=0; 1619var B=this._band._zoomIndex; 1620var C=B; 1621if(D&&(B>0)){C=B-1; 1622}if(!D&&(B<(this._band._zoomSteps.length-1))){C=B+1; 1623}this._band._zoomIndex=C; 1624this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; 1625this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval; 1626A=this._band._zoomSteps[C].unit-this._band._zoomSteps[B].unit; 1627return A; 1628}; 1629Timeline.HotZoneEther=function(A){this._params=A; 1630this._interval=A.interval; 1631this._pixelsPerInterval=A.pixelsPerInterval; 1632this._theme=A.theme; 1633}; 1634Timeline.HotZoneEther.prototype.initialize=function(I,H){this._band=I; 1635this._timeline=H; 1636this._unit=H.getUnit(); 1637this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,magnify:1}]; 1638var D=this._params; 1639for(var E=0; 1640E<D.zones.length; 1641E++){var G=D.zones[E]; 1642var F=this._unit.parseFromObject(G.start); 1643var B=this._unit.parseFromObject(G.end); 1644for(var C=0; 1645C<this._zones.length&&this._unit.compare(B,F)>0; 1646C++){var A=this._zones[C]; 1647if(this._unit.compare(F,A.endTime)<0){if(this._unit.compare(F,A.startTime)>0){this._zones.splice(C,0,{startTime:A.startTime,endTime:F,magnify:A.magnify}); 1648C++; 1649A.startTime=F; 1650}if(this._unit.compare(B,A.endTime)<0){this._zones.splice(C,0,{startTime:F,endTime:B,magnify:G.magnify*A.magnify}); 1651C++; 1652A.startTime=B; 1653F=B; 1654}else{A.magnify*=G.magnify; 1655F=A.endTime; 1656}}}}if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn); 1657}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn); 1658this.shiftPixels(-this._timeline.getPixelLength()); 1659}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn); 1660this.shiftPixels(-this._timeline.getPixelLength()/2); 1661}else{this._start=this._unit.makeDefaultValue(); 1662this.shiftPixels(-this._timeline.getPixelLength()/2); 1663}}}}; 1664Timeline.HotZoneEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A); 1665}; 1666Timeline.HotZoneEther.prototype.shiftPixels=function(A){this._start=this.pixelOffsetToDate(A); 1667}; 1668Timeline.HotZoneEther.prototype.dateToPixelOffset=function(A){return this._dateDiffToPixelOffset(this._start,A); 1669}; 1670Timeline.HotZoneEther.prototype.pixelOffsetToDate=function(A){return this._pixelOffsetToDate(A,this._start); 1671}; 1672Timeline.HotZoneEther.prototype.zoom=function(D){var A=0; 1673var B=this._band._zoomIndex; 1674var C=B; 1675if(D&&(B>0)){C=B-1; 1676}if(!D&&(B<(this._band._zoomSteps.length-1))){C=B+1; 1677}this._band._zoomIndex=C; 1678this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; 1679this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval; 1680A=this._band._zoomSteps[C].unit-this._band._zoomSteps[B].unit; 1681return A; 1682}; 1683Timeline.HotZoneEther.prototype._dateDiffToPixelOffset=function(H,C){var D=this._getScale(); 1684var I=H; 1685var B=C; 1686var E=0; 1687if(this._unit.compare(I,B)<0){var G=0; 1688while(G<this._zones.length){if(this._unit.compare(I,this._zones[G].endTime)<0){break; 1689}G++; 1690}while(this._unit.compare(I,B)<0){var F=this._zones[G]; 1691var A=this._unit.earlier(B,F.endTime); 1692E+=(this._unit.compare(A,I)/(D/F.magnify)); 1693I=A; 1694G++; 1695}}else{var G=this._zones.length-1; 1696while(G>=0){if(this._unit.compare(I,this._zones[G].startTime)>0){break; 1697}G--; 1698}while(this._unit.compare(I,B)>0){var F=this._zones[G]; 1699var A=this._unit.later(B,F.startTime); 1700E+=(this._unit.compare(A,I)/(D/F.magnify)); 1701I=A; 1702G--; 1703}}return E; 1704}; 1705Timeline.HotZoneEther.prototype._pixelOffsetToDate=function(E,B){var G=this._getScale(); 1706var D=B; 1707if(E>0){var F=0; 1708while(F<this._zones.length){if(this._unit.compare(D,this._zones[F].endTime)<0){break; 1709}F++; 1710}while(E>0){var A=this._zones[F]; 1711var H=G/A.magnify; 1712if(A.endTime==Number.POSITIVE_INFINITY){D=this._unit.change(D,E*H); 1713E=0; 1714}else{var C=this._unit.compare(A.endTime,D)/H; 1715if(C>E){D=this._unit.change(D,E*H); 1716E=0; 1717}else{D=A.endTime; 1718E-=C; 1719}}F++; 1720}}else{var F=this._zones.length-1; 1721while(F>=0){if(this._unit.compare(D,this._zones[F].startTime)>0){break; 1722}F--; 1723}E=-E; 1724while(E>0){var A=this._zones[F]; 1725var H=G/A.magnify; 1726if(A.startTime==Number.NEGATIVE_INFINITY){D=this._unit.change(D,-E*H); 1727E=0; 1728}else{var C=this._unit.compare(D,A.startTime)/H; 1729if(C>E){D=this._unit.change(D,-E*H); 1730E=0; 1731}else{D=A.startTime; 1732E-=C; 1733}}F--; 1734}}return D; 1735}; 1736Timeline.HotZoneEther.prototype._getScale=function(){return this._interval/this._pixelsPerInterval; 1737}; 1738 1739 1740/* event-utils.js */ 1741Timeline.EventUtils={}; 1742Timeline.EventUtils.getNewEventID=function(){if(this._lastEventID==null){this._lastEventID=0; 1743}this._lastEventID+=1; 1744return"e"+this._lastEventID; 1745}; 1746Timeline.EventUtils.decodeEventElID=function(C){var D=C.split("-"); 1747if(D[1]!="tl"){alert("Internal Timeline problem 101, please consult support"); 1748return{band:null,evt:null}; 1749}var B=Timeline.getTimelineFromID(D[2]); 1750var E=B.getBand(D[3]); 1751var A=E.getEventSource.getEvent(D[4]); 1752return{band:E,evt:A}; 1753}; 1754Timeline.EventUtils.encodeEventElID=function(B,D,C,A){return C+"-tl-"+B.timelineID+"-"+D.getIndex()+"-"+A.getID(); 1755}; 1756 1757 1758/* labellers.js */ 1759Timeline.GregorianDateLabeller=function(B,A){this._locale=B; 1760this._timeZone=A; 1761}; 1762Timeline.GregorianDateLabeller.monthNames=[]; 1763Timeline.GregorianDateLabeller.dayNames=[]; 1764Timeline.GregorianDateLabeller.labelIntervalFunctions=[]; 1765Timeline.GregorianDateLabeller.getMonthName=function(B,A){return Timeline.GregorianDateLabeller.monthNames[A][B]; 1766}; 1767Timeline.GregorianDateLabeller.prototype.labelInterval=function(A,C){var B=Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale]; 1768if(B==null){B=Timeline.GregorianDateLabeller.prototype.defaultLabelInterval; 1769}return B.call(this,A,C); 1770}; 1771Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toUTCString(); 1772}; 1773Timeline.GregorianDateLabeller.prototype.defaultLabelInterval=function(B,C){var D; 1774var F=false; 1775B=SimileAjax.DateTime.removeTimeZoneOffset(B,this._timeZone); 1776switch(C){case SimileAjax.DateTime.MILLISECOND:D=B.getUTCMilliseconds(); 1777break; 1778case SimileAjax.DateTime.SECOND:D=B.getUTCSeconds(); 1779break; 1780case SimileAjax.DateTime.MINUTE:var A=B.getUTCMinutes(); 1781if(A==0){D=B.getUTCHours()+":00"; 1782F=true; 1783}else{D=A; 1784}break; 1785case SimileAjax.DateTime.HOUR:D=B.getUTCHours()+"hr"; 1786break; 1787case SimileAjax.DateTime.DAY:D=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate(); 1788break; 1789case SimileAjax.DateTime.WEEK:D=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate(); 1790break; 1791case SimileAjax.DateTime.MONTH:var A=B.getUTCMonth(); 1792if(A!=0){D=Timeline.GregorianDateLabeller.getMonthName(A,this._locale); 1793break; 1794}case SimileAjax.DateTime.YEAR:case SimileAjax.DateTime.DECADE:case SimileAjax.DateTime.CENTURY:case SimileAjax.DateTime.MILLENNIUM:var E=B.getUTCFullYear(); 1795if(E>0){D=B.getUTCFullYear(); 1796}else{D=(1-E)+"BC"; 1797}F=(C==SimileAjax.DateTime.MONTH)||(C==SimileAjax.DateTime.DECADE&&E%100==0)||(C==SimileAjax.DateTime.CENTURY&&E%1000==0); 1798break; 1799default:D=B.toUTCString(); 1800}return{text:D,emphasized:F}; 1801}; 1802 1803 1804/* original-painter.js */ 1805Timeline.OriginalEventPainter=function(A){this._params=A; 1806this._onSelectListeners=[]; 1807this._eventPaintListeners=[]; 1808this._filterMatcher=null; 1809this._highlightMatcher=null; 1810this._frc=null; 1811this._eventIdToElmt={}; 1812}; 1813Timeline.OriginalEventPainter.prototype.initialize=function(B,A){this._band=B; 1814this._timeline=A; 1815this._backLayer=null; 1816this._eventLayer=null; 1817this._lineLayer=null; 1818this._highlightLayer=null; 1819this._eventIdToElmt=null; 1820}; 1821Timeline.OriginalEventPainter.prototype.getType=function(){return"original"; 1822}; 1823Timeline.OriginalEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); 1824}; 1825Timeline.OriginalEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; 1826A<this._onSelectListeners.length; 1827A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); 1828break; 1829}}}; 1830Timeline.OriginalEventPainter.prototype.addEventPaintListener=function(A){this._eventPaintListeners.push(A); 1831}; 1832Timeline.OriginalEventPainter.prototype.removeEventPaintListener=function(B){for(var A=0; 1833A<this._eventPaintListeners.length; 1834A++){if(this._eventPaintListeners[A]==B){this._eventPaintListeners.splice(A,1); 1835break; 1836}}}; 1837Timeline.OriginalEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; 1838}; 1839Timeline.OriginalEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; 1840}; 1841Timeline.OriginalEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; 1842}; 1843Timeline.OriginalEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; 1844}; 1845Timeline.OriginalEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); 1846if(C==null){return ; 1847}this._eventIdToElmt={}; 1848this._fireEventPaintListeners("paintStarting",null,null); 1849this._prepareForPainting(); 1850var I=this._params.theme.event; 1851var G=Math.max(I.track.height,I.tape.height+this._frc.getLineHeight()); 1852var F={trackOffset:I.track.offset,trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width,maxLabelChar:I.label.maxLabelChar,impreciseIconMargin:I.instant.impreciseIconMargin}; 1853var D=this._band.getMinDate(); 1854var B=this._band.getMaxDate(); 1855var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true; 1856}; 1857var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1; 1858}; 1859var E=C.getEventReverseIterator(D,B); 1860while(E.hasNext()){var H=E.next(); 1861if(J(H)){this.paintEvent(H,F,this._params.theme,A(H)); 1862}}this._highlightLayer.style.display="block"; 1863this._lineLayer.style.display="block"; 1864this._eventLayer.style.display="block"; 1865this._band.updateEventTrackInfo(this._tracks.length,F.trackIncrement); 1866this._fireEventPaintListeners("paintEnded",null,null); 1867}; 1868Timeline.OriginalEventPainter.prototype.softPaint=function(){}; 1869Timeline.OriginalEventPainter.prototype._prepareForPainting=function(){var B=this._band; 1870if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); 1871this._backLayer.style.visibility="hidden"; 1872var A=document.createElement("span"); 1873A.className="timeline-event-label"; 1874this._backLayer.appendChild(A); 1875this._frc=SimileAjax.Graphics.getFontRenderingContext(A); 1876}this._frc.update(); 1877this._tracks=[]; 1878if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); 1879}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); 1880this._highlightLayer.style.display="none"; 1881if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); 1882}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); 1883this._lineLayer.style.display="none"; 1884if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); 1885}this._eventLayer=B.createLayerDiv(115,"timeline-band-events"); 1886this._eventLayer.style.display="none"; 1887}; 1888Timeline.OriginalEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); 1889}else{this.paintDurationEvent(B,C,D,A); 1890}}; 1891Timeline.OriginalEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); 1892}else{this.paintPreciseInstantEvent(B,C,D,A); 1893}}; 1894Timeline.OriginalEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); 1895}else{this.paintPreciseDurationEvent(B,C,D,A); 1896}}; 1897Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent=function(N,S,V,T){var W=this._timeline.getDocument(); 1898var L=N.getText(); 1899var H=N.getStart(); 1900var I=Math.round(this._band.dateToPixelOffset(H)); 1901var A=Math.round(I+S.iconWidth/2); 1902var C=Math.round(I-S.iconWidth/2); 1903var F=this._getLabelDivClassName(N); 1904var D=this._frc.computeSize(L,F); 1905var M=A+V.event.label.offsetFromLine; 1906var J=M+D.width; 1907var Q=J; 1908var P=this._findFreeTrack(N,Q); 1909var R=Math.round(S.trackOffset+P*S.trackIncrement+S.trackHeight/2-D.height/2); 1910var B=this._paintEventIcon(N,P,C,S,V,0); 1911var U=this._paintEventLabel(N,L,M,R,D.width,D.height,V,F,T); 1912var E=[B.elmt,U.elmt]; 1913var O=this; 1914var K=function(Y,X,Z){return O._onClickInstantEvent(B.elmt,X,N); 1915}; 1916SimileAjax.DOM.registerEvent(B.elmt,"mousedown",K); 1917SimileAjax.DOM.registerEvent(U.elmt,"mousedown",K); 1918var G=this._createHighlightDiv(T,B,V,N); 1919if(G!=null){E.push(G); 1920}this._fireEventPaintListeners("paintedEvent",N,E); 1921this._eventIdToElmt[N.getID()]=B.elmt; 1922this._tracks[P]=C; 1923}; 1924Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent=function(P,U,Z,W){var b=this._timeline.getDocument(); 1925var N=P.getText(); 1926var J=P.getStart(); 1927var X=P.getEnd(); 1928var K=Math.round(this._band.dateToPixelOffset(J)); 1929var B=Math.round(this._band.dateToPixelOffset(X)); 1930var A=Math.round(K+U.iconWidth/2); 1931var D=Math.round(K-U.iconWidth/2); 1932var H=this._getLabelDivClassName(P); 1933var F=this._frc.computeSize(N,H); 1934var O=A+Z.event.label.offsetFromLine; 1935var L=O+F.width; 1936var S=Math.max(L,B); 1937var R=this._findFreeTrack(P,S); 1938var a=Z.event.tape.height; 1939var T=Math.round(U.trackOffset+R*U.trackIncrement+a); 1940var C=this._paintEventIcon(P,R,D,U,Z,a); 1941var Y=this._paintEventLabel(P,N,O,T,F.width,F.height,Z,H,W); 1942var V=P.getColor(); 1943V=V!=null?V:Z.event.instant.impreciseColor; 1944var E=this._paintEventTape(P,R,K,B,V,Z.event.instant.impreciseOpacity,U,Z,0); 1945var G=[C.elmt,Y.elmt,E.elmt]; 1946var Q=this; 1947var M=function(d,c,e){return Q._onClickInstantEvent(C.elmt,c,P); 1948}; 1949SimileAjax.DOM.registerEvent(C.elmt,"mousedown",M); 1950SimileAjax.DOM.registerEvent(E.elmt,"mousedown",M); 1951SimileAjax.DOM.registerEvent(Y.elmt,"mousedown",M); 1952var I=this._createHighlightDiv(W,C,Z,P); 1953if(I!=null){G.push(I); 1954}this._fireEventPaintListeners("paintedEvent",P,G); 1955this._eventIdToElmt[P.getID()]=C.elmt; 1956this._tracks[R]=D; 1957}; 1958Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent=function(M,R,W,T){var X=this._timeline.getDocument(); 1959var K=M.getText(); 1960var G=M.getStart(); 1961var U=M.getEnd(); 1962var H=Math.round(this._band.dateToPixelOffset(G)); 1963var A=Math.round(this._band.dateToPixelOffset(U)); 1964var E=this._getLabelDivClassName(M); 1965var C=this._frc.computeSize(K,E); 1966var L=H; 1967var I=L+C.width; 1968var P=Math.max(I,A); 1969var O=this._findFreeTrack(M,P); 1970var Q=Math.round(R.trackOffset+O*R.trackIncrement+W.event.tape.height); 1971var S=M.getColor(); 1972S=S!=null?S:W.event.duration.color; 1973var B=this._paintEventTape(M,O,H,A,S,100,R,W,0); 1974var V=this._paintEventLabel(M,K,L,Q,C.width,C.height,W,E,T); 1975var D=[B.elmt,V.elmt]; 1976var N=this; 1977var J=function(Z,Y,a){return N._onClickDurationEvent(B.elmt,Y,M); 1978}; 1979SimileAjax.DOM.registerEvent(B.elmt,"mousedown",J); 1980SimileAjax.DOM.registerEvent(V.elmt,"mousedown",J); 1981var F=this._createHighlightDiv(T,B,W,M); 1982if(F!=null){D.push(F); 1983}this._fireEventPaintListeners("paintedEvent",M,D); 1984this._eventIdToElmt[M.getID()]=B.elmt; 1985this._tracks[O]=H; 1986}; 1987Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent=function(O,W,b,Y){var c=this._timeline.getDocument(); 1988var M=O.getText(); 1989var I=O.getStart(); 1990var V=O.getLatestStart(); 1991var Z=O.getEnd(); 1992var Q=O.getEarliestEnd(); 1993var K=Math.round(this._band.dateToPixelOffset(I)); 1994var F=Math.round(this._band.dateToPixelOffset(V)); 1995var A=Math.round(this._band.dateToPixelOffset(Z)); 1996var G=Math.round(this._band.dateToPixelOffset(Q)); 1997var E=this._getLabelDivClassName(O); 1998var C=this._frc.computeSize(M,E); 1999var N=F; 2000var J=N+C.width; 2001var S=Math.max(J,A); 2002var R=this._findFreeTrack(O,S); 2003var T=Math.round(W.trackOffset+R*W.trackIncrement+b.event.tape.height); 2004var X=O.getColor(); 2005X=X!=null?X:b.event.duration.color; 2006var U=this._paintEventTape(O,R,K,A,b.event.duration.impreciseColor,b.event.duration.impreciseOpacity,W,b,0); 2007var B=this._paintEventTape(O,R,F,G,X,100,W,b,1); 2008var a=this._paintEventLabel(O,M,N,T,C.width,C.height,b,E,Y); 2009var D=[U.elmt,B.elmt,a.elmt]; 2010var P=this; 2011var L=function(e,d,f){return P._onClickDurationEvent(B.elmt,d,O); 2012}; 2013SimileAjax.DOM.registerEvent(B.elmt,"mousedown",L); 2014SimileAjax.DOM.registerEvent(a.elmt,"mousedown",L); 2015var H=this._createHighlightDiv(Y,B,b,O); 2016if(H!=null){D.push(H); 2017}this._fireEventPaintListeners("paintedEvent",O,D); 2018this._eventIdToElmt[O.getID()]=B.elmt; 2019this._tracks[R]=K; 2020}; 2021Timeline.OriginalEventPainter.prototype._encodeEventElID=function(B,A){return Timeline.EventUtils.encodeEventElID(this._timeline,this._band,B,A); 2022}; 2023Timeline.OriginalEventPainter.prototype._findFreeTrack=function(E,D){var A=E.getTrackNum(); 2024if(A!=null){return A; 2025}for(var C=0; 2026C<this._tracks.length; 2027C++){var B=this._tracks[C]; 2028if(B>D){break; 2029}}return C; 2030}; 2031Timeline.OriginalEventPainter.prototype._paintEventIcon=function(K,B,C,G,F,D){var I=K.getIcon(); 2032I=I!=null?I:G.icon; 2033var J; 2034if(D>0){J=G.trackOffset+B*G.trackIncrement+D+G.impreciseIconMargin; 2035}else{var H=G.trackOffset+B*G.trackIncrement+G.trackHeight/2; 2036J=Math.round(H-G.iconHeight/2); 2037}var E=SimileAjax.Graphics.createTranslucentImage(I); 2038var A=this._timeline.getDocument().createElement("div"); 2039A.className=this._getElClassName("timeline-event-icon",K,"icon"); 2040A.id=this._encodeEventElID("icon",K); 2041A.style.left=C+"px"; 2042A.style.top=J+"px"; 2043A.appendChild(E); 2044if(K._title!=null){A.title=K._title; 2045}this._eventLayer.appendChild(A); 2046return{left:C,top:J,width:G.iconWidth,height:G.iconHeight,elmt:A}; 2047}; 2048Timeline.OriginalEventPainter.prototype._paintEventLabel=function(K,L,D,H,A,J,G,E,C){var I=this._timeline.getDocument(); 2049var B=I.createElement("div"); 2050B.className=E; 2051B.id=this._encodeEventElID("label",K); 2052B.style.left=D+"px"; 2053B.style.width=A+"px"; 2054B.style.top=H+"px"; 2055B.innerHTML=L; 2056if(K._title!=null){B.title=K._title; 2057}var F=K.getTextColor(); 2058if(F==null){F=K.getColor(); 2059}if(F!=null){B.style.color=F; 2060}if(G.event.highlightLabelBackground&&C>=0){B.style.background=this._getHighlightColor(C,G); 2061}this._eventLayer.appendChild(B); 2062return{left:D,top:H,width:A,height:J,elmt:B}; 2063}; 2064Timeline.OriginalEventPainter.prototype._paintEventTape=function(N,B,D,A,G,C,J,I,M){var F=A-D; 2065var E=I.event.tape.height; 2066var K=J.trackOffset+B*J.trackIncrement; 2067var O=this._timeline.getDocument().createElement("div"); 2068O.className=this._getElClassName("timeline-event-tape",N,"tape"); 2069O.id=this._encodeEventElID("tape"+M,N); 2070O.style.left=D+"px"; 2071O.style.width=F+"px"; 2072O.style.height=E+"px"; 2073O.style.top=K+"px"; 2074if(N._title!=null){O.title=N._title; 2075}if(G!=null){O.style.backgroundColor=G; 2076}var L=N.getTapeImage(); 2077var H=N.getTapeRepeat(); 2078H=H!=null?H:"repeat"; 2079if(L!=null){O.style.backgroundImage="url("+L+")"; 2080O.style.backgroundRepeat=H; 2081}SimileAjax.Graphics.setOpacity(O,C); 2082this._eventLayer.appendChild(O); 2083return{left:D,top:K,width:F,height:E,elmt:O}; 2084}; 2085Timeline.OriginalEventPainter.prototype._getLabelDivClassName=function(A){return this._getElClassName("timeline-event-label",A,"label"); 2086}; 2087Timeline.OriginalEventPainter.prototype._getElClassName=function(D,C,A){var E=C.getClassName(),B=[]; 2088if(E){if(A){B.push(A+"-"+E+" "); 2089}B.push(E+" "); 2090}B.push(D); 2091return(B.join("")); 2092}; 2093Timeline.OriginalEventPainter.prototype._getHighlightColor=function(A,B){var C=B.event.highlightColors; 2094return C[Math.min(A,C.length-1)]; 2095}; 2096Timeline.OriginalEventPainter.prototype._createHighlightDiv=function(A,D,F,B){var G=null; 2097if(A>=0){var E=this._timeline.getDocument(); 2098var C=this._getHighlightColor(A,F); 2099G=E.createElement("div"); 2100G.className=this._getElClassName("timeline-event-highlight",B,"highlight"); 2101G.id=this._encodeEventElID("highlight0",B); 2102G.style.position="absolute"; 2103G.style.overflow="hidden"; 2104G.style.left=(D.left-2)+"px"; 2105G.style.width=(D.width+4)+"px"; 2106G.style.top=(D.top-2)+"px"; 2107G.style.height=(D.height+4)+"px"; 2108G.style.background=C; 2109this._highlightLayer.appendChild(G); 2110}return G; 2111}; 2112Timeline.OriginalEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); 2113this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),B); 2114this._fireOnSelect(B.getID()); 2115A.cancelBubble=true; 2116SimileAjax.DOM.cancelEvent(A); 2117return false; 2118}; 2119Timeline.OriginalEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; 2120var E=B.pageY; 2121}else{var D=SimileAjax.DOM.getPageCoordinates(F); 2122var A=B.offsetX+D.left; 2123var E=B.offsetY+D.top; 2124}this._showBubble(A,E,C); 2125this._fireOnSelect(C.getID()); 2126B.cancelBubble=true; 2127SimileAjax.DOM.cancelEvent(B); 2128return false; 2129}; 2130Timeline.OriginalEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; 2131if(B){var C=SimileAjax.DOM.getPageCoordinates(B); 2132this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A); 2133}}; 2134Timeline.OriginalEventPainter.prototype._showBubble=function(B,E,C){var D=document.createElement("div"); 2135var A=this._params.theme.event.bubble; 2136C.fillInfoBubble(D,this._params.theme,this._band.getLabeller()); 2137SimileAjax.WindowManager.cancelPopups(); 2138SimileAjax.Graphics.createBubbleForContentAndPoint(D,B,E,A.width,null,A.maxHeight); 2139}; 2140Timeline.OriginalEventPainter.prototype._fireOnSelect=function(A){for(var B=0; 2141B<this._onSelectListeners.length; 2142B++){this._onSelectListeners[B](A); 2143}}; 2144Timeline.OriginalEventPainter.prototype._fireEventPaintListeners=function(D,A,C){for(var B=0; 2145B<this._eventPaintListeners.length; 2146B++){this._eventPaintListeners[B](this._band,D,A,C); 2147}}; 2148 2149 2150/* overview-painter.js */ 2151Timeline.OverviewEventPainter=function(A){this._params=A; 2152this._onSelectListeners=[]; 2153this._filterMatcher=null; 2154this._highlightMatcher=null; 2155}; 2156Timeline.OverviewEventPainter.prototype.initialize=function(B,A){this._band=B; 2157this._timeline=A; 2158this._eventLayer=null; 2159this._highlightLayer=null; 2160}; 2161Timeline.OverviewEventPainter.prototype.getType=function(){return"overview"; 2162}; 2163Timeline.OverviewEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); 2164}; 2165Timeline.OverviewEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; 2166A<this._onSelectListeners.length; 2167A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); 2168break; 2169}}}; 2170Timeline.OverviewEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; 2171}; 2172Timeline.OverviewEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; 2173}; 2174Timeline.OverviewEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; 2175}; 2176Timeline.OverviewEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; 2177}; 2178Timeline.OverviewEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); 2179if(C==null){return ; 2180}this._prepareForPainting(); 2181var H=this._params.theme.event; 2182var F={trackOffset:H.overviewTrack.offset,trackHeight:H.overviewTrack.height,trackGap:H.overviewTrack.gap,trackIncrement:H.overviewTrack.height+H.overviewTrack.gap}; 2183var D=this._band.getMinDate(); 2184var B=this._band.getMaxDate(); 2185var I=(this._filterMatcher!=null)?this._filterMatcher:function(J){return true; 2186}; 2187var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(J){return -1; 2188}; 2189var E=C.getEventReverseIterator(D,B); 2190while(E.hasNext()){var G=E.next(); 2191if(I(G)){this.paintEvent(G,F,this._params.theme,A(G)); 2192}}this._highlightLayer.style.display="block"; 2193this._eventLayer.style.display="block"; 2194this._band.updateEventTrackInfo(this._tracks.length,F.trackIncrement); 2195}; 2196Timeline.OverviewEventPainter.prototype.softPaint=function(){}; 2197Timeline.OverviewEventPainter.prototype._prepareForPainting=function(){var A=this._band; 2198this._tracks=[]; 2199if(this._highlightLayer!=null){A.removeLayerDiv(this._highlightLayer); 2200}this._highlightLayer=A.createLayerDiv(105,"timeline-band-highlights"); 2201this._highlightLayer.style.display="none"; 2202if(this._eventLayer!=null){A.removeLayerDiv(this._eventLayer); 2203}this._eventLayer=A.createLayerDiv(110,"timeline-band-events"); 2204this._eventLayer.style.display="none"; 2205}; 2206Timeline.OverviewEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); 2207}else{this.paintDurationEvent(B,C,D,A); 2208}}; 2209Timeline.OverviewEventPainter.prototype.paintInstantEvent=function(I,H,E,A){var F=I.getStart(); 2210var B=Math.round(this._band.dateToPixelOffset(F)); 2211var C=I.getColor(),D=I.getClassName(); 2212if(D){C=null; 2213}else{C=C!=null?C:E.event.duration.color; 2214}var G=this._paintEventTick(I,B,C,100,H,E); 2215this._createHighlightDiv(A,G,E); 2216}; 2217Timeline.OverviewEventPainter.prototype.paintDurationEvent=function(L,K,H,B){var A=L.getLatestStart(); 2218var I=L.getEarliestEnd(); 2219var J=Math.round(this._band.dateToPixelOffset(A)); 2220var C=Math.round(this._band.dateToPixelOffset(I)); 2221var F=0; 2222for(; 2223F<this._tracks.length; 2224F++){if(C<this._tracks[F]){break; 2225}}this._tracks[F]=C; 2226var E=L.getColor(),G=L.getClassName(); 2227if(G){E=null; 2228}else{E=E!=null?E:H.event.duration.color; 2229}var D=this._paintEventTape(L,F,J,C,E,100,K,H,G); 2230this._createHighlightDiv(B,D,H); 2231}; 2232Timeline.OverviewEventPainter.prototype._paintEventTape=function(K,B,D,L,E,C,H,G,F){var I=H.trackOffset+B*H.trackIncrement; 2233var A=L-D; 2234var J=H.trackHeight; 2235var M=this._timeline.getDocument().createElement("div"); 2236M.className="timeline-small-event-tape"; 2237if(F){M.className+=" small-"+F; 2238}M.style.left=D+"px"; 2239M.style.width=A+"px"; 2240M.style.top=I+"px"; 2241M.style.height=J+"px"; 2242if(E){M.style.backgroundColor=E; 2243}if(C<100){SimileAjax.Graphics.setOpacity(M,C); 2244}this._eventLayer.appendChild(M); 2245return{left:D,top:I,width:A,height:J,elmt:M}; 2246}; 2247Timeline.OverviewEventPainter.prototype._paintEventTick=function(J,C,D,B,G,F){var I=F.event.overviewTrack.tickHeight; 2248var H=G.trackOffset-I; 2249var A=1; 2250var K=this._timeline.getDocument().createElement("div"); 2251K.className="timeline-small-event-icon"; 2252K.style.left=C+"px"; 2253K.style.top=H+"px"; 2254var E=J.getClassName(); 2255if(E){K.className+=" small-"+E; 2256}if(B<100){SimileAjax.Graphics.setOpacity(K,B); 2257}this._eventLayer.appendChild(K); 2258return{left:C,top:H,width:A,height:I,elmt:K}; 2259}; 2260Timeline.OverviewEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); 2261var G=E.event; 2262var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; 2263var F=D.createElement("div"); 2264F.style.position="absolute"; 2265F.style.overflow="hidden"; 2266F.style.left=(C.left-1)+"px"; 2267F.style.width=(C.width+2)+"px"; 2268F.style.top=(C.top-1)+"px"; 2269F.style.height=(C.height+2)+"px"; 2270F.style.background=B; 2271this._highlightLayer.appendChild(F); 2272}}; 2273Timeline.OverviewEventPainter.prototype.showBubble=function(A){}; 2274 2275 2276/* sources.js */ 2277Timeline.DefaultEventSource=function(A){this._events=(A instanceof Object)?A:new SimileAjax.EventIndex(); 2278this._listeners=[]; 2279}; 2280Timeline.DefaultEventSource.prototype.addListener=function(A){this._listeners.push(A); 2281}; 2282Timeline.DefaultEventSource.prototype.removeListener=function(B){for(var A=0; 2283A<this._listeners.length; 2284A++){if(this._listeners[A]==B){this._listeners.splice(A,1); 2285break; 2286}}}; 2287Timeline.DefaultEventSource.prototype.loadXML=function(G,A){var C=this._getBaseURL(A); 2288var H=G.documentElement.getAttribute("wiki-url"); 2289var J=G.documentElement.getAttribute("wiki-section"); 2290var F=G.documentElement.getAttribute("date-time-format"); 2291var E=this._events.getUnit().getParser(F); 2292var D=G.documentElement.firstChild; 2293var I=false; 2294while(D!=null){if(D.nodeType==1){var L=""; 2295if(D.firstChild!=null&&D.firstChild.nodeType==3){L=D.firstChild.nodeValue; 2296}var B=(D.getAttribute("isDuration")===null&&D.getAttribute("durationEvent")===null)||D.getAttribute("isDuration")=="false"||D.getAttribute("durationEvent")=="false"; 2297var K=new Timeline.DefaultEventSource.Event({id:D.getAttribute("id"),start:E(D.getAttribute("start")),end:E(D.getAttribute("end")),latestStart:E(D.getAttribute("latestStart")),earliestEnd:E(D.getAttribute("earliestEnd")),instant:B,text:D.getAttribute("title"),description:L,image:this._resolveRelativeURL(D.getAttribute("image"),C),link:this._resolveRelativeURL(D.getAttribute("link"),C),icon:this._resolveRelativeURL(D.getAttribute("icon"),C),color:D.getAttribute("color"),textColor:D.getAttribute("textColor"),hoverText:D.getAttribute("hoverText"),classname:D.getAttribute("classname"),tapeImage:D.getAttribute("tapeImage"),tapeRepeat:D.getAttribute("tapeRepeat"),caption:D.getAttribute("caption"),eventID:D.getAttribute("eventID"),trackNum:D.getAttribute("trackNum")}); 2298K._node=D; 2299K.getProperty=function(M){return this._node.getAttribute(M); 2300}; 2301K.setWikiInfo(H,J); 2302this._events.add(K); 2303I=true; 2304}D=D.nextSibling; 2305}if(I){this._fire("onAddMany",[]); 2306}}; 2307Timeline.DefaultEventSource.prototype.loadJSON=function(H,B){var D=this._getBaseURL(B); 2308var J=false; 2309if(H&&H.events){var I=("wikiURL" in H)?H.wikiURL:null; 2310var K=("wikiSection" in H)?H.wikiSection:null; 2311var F=("dateTimeFormat" in H)?H.dateTimeFormat:null; 2312var E=this._events.getUnit().getParser(F); 2313for(var G=0; 2314G<H.events.length; 2315G++){var A=H.events[G]; 2316var C=A.isDuration||(A.durationEvent!=null&&!A.durationEvent); 2317var L=new Timeline.DefaultEventSource.Event({id:("id" in A)?A.id:undefined,start:E(A.start),end:E(A.end),latestStart:E(A.latestStart),earliestEnd:E(A.earliestEnd),instant:C,text:A.title,description:A.description,image:this._resolveRelativeURL(A.image,D),link:this._resolveRelativeURL(A.link,D),icon:this._resolveRelativeURL(A.icon,D),color:A.color,textColor:A.textColor,hoverText:A.hoverText,classname:A.classname,tapeImage:A.tapeImage,tapeRepeat:A.tapeRepeat,caption:A.caption,eventID:A.eventID,trackNum:A.trackNum}); 2318L._obj=A; 2319L.getProperty=function(M){return this._obj[M]; 2320}; 2321L.setWikiInfo(I,K); 2322this._events.add(L); 2323J=true; 2324}}if(J){this._fire("onAddMany",[]); 2325}}; 2326Timeline.DefaultEventSource.prototype.loadSPARQL=function(I,B){var E=this._getBaseURL(B); 2327var H="iso8601"; 2328var G=this._events.getUnit().getParser(H); 2329if(I==null){return ; 2330}var F=I.documentElement.firstChild; 2331while(F!=null&&(F.nodeType!=1||F.nodeName!="results")){F=F.nextSibling; 2332}var J=null; 2333var L=null; 2334if(F!=null){J=F.getAttribute("wiki-url"); 2335L=F.getAttribute("wiki-section"); 2336F=F.firstChild; 2337}var K=false; 2338while(F!=null){if(F.nodeType==1){var D={}; 2339var A=F.firstChild; 2340while(A!=null){if(A.nodeType==1&&A.firstChild!=null&&A.firstChild.nodeType==1&&A.firstChild.firstChild!=null&&A.firstChild.firstChild.nodeType==3){D[A.getAttribute("name")]=A.firstChild.firstChild.nodeValue; 2341}A=A.nextSibling; 2342}if(D["start"]==null&&D["date"]!=null){D["start"]=D["date"]; 2343}var C=(D["isDuration"]===null&&D["durationEvent"]===null)||D["isDuration"]=="false"||D["durationEvent"]=="false"; 2344var M=new Timeline.DefaultEventSource.Event({id:D["id"],start:G(D["start"]),end:G(D["end"]),latestStart:G(D["latestStart"]),earliestEnd:G(D["earliestEnd"]),instant:C,text:D["title"],description:D["description"],image:this._resolveRelativeURL(D["image"],E),link:this._resolveRelativeURL(D["link"],E),icon:this._resolveRelativeURL(D["icon"],E),color:D["color"],textColor:D["textColor"],hoverText:D["hoverText"],caption:D["caption"],classname:D["classname"],tapeImage:D["tapeImage"],tapeRepeat:D["tapeRepeat"],eventID:D["eventID"],trackNum:D["trackNum"]}); 2345M._bindings=D; 2346M.getProperty=function(N){return this._bindings[N]; 2347}; 2348M.setWikiInfo(J,L); 2349this._events.add(M); 2350K=true; 2351}F=F.nextSibling; 2352}if(K){this._fire("onAddMany",[]); 2353}}; 2354Timeline.DefaultEventSource.prototype.add=function(A){this._events.add(A); 2355this._fire("onAddOne",[A]); 2356}; 2357Timeline.DefaultEventSource.prototype.addMany=function(A){for(var B=0; 2358B<A.length; 2359B++){this._events.add(A[B]); 2360}this._fire("onAddMany",[]); 2361}; 2362Timeline.DefaultEventSource.prototype.clear=function(){this._events.removeAll(); 2363this._fire("onClear",[]); 2364}; 2365Timeline.DefaultEventSource.prototype.getEvent=function(A){return this._events.getEvent(A); 2366}; 2367Timeline.DefaultEventSource.prototype.getEventIterator=function(A,B){return this._events.getIterator(A,B); 2368}; 2369Timeline.DefaultEventSource.prototype.getEventReverseIterator=function(A,B){return this._events.getReverseIterator(A,B); 2370}; 2371Timeline.DefaultEventSource.prototype.getAllEventIterator=function(){return this._events.getAllIterator(); 2372}; 2373Timeline.DefaultEventSource.prototype.getCount=function(){return this._events.getCount(); 2374}; 2375Timeline.DefaultEventSource.prototype.getEarliestDate=function(){return this._events.getEarliestDate(); 2376}; 2377Timeline.DefaultEventSource.prototype.getLatestDate=function(){return this._events.getLatestDate(); 2378}; 2379Timeline.DefaultEventSource.prototype._fire=function(B,A){for(var C=0; 2380C<this._listeners.length; 2381C++){var D=this._listeners[C]; 2382if(B in D){try{D[B].apply(D,A); 2383}catch(E){SimileAjax.Debug.exception(E); 2384}}}}; 2385Timeline.DefaultEventSource.prototype._getBaseURL=function(A){if(A.indexOf("://")<0){var C=this._getBaseURL(document.location.href); 2386if(A.substr(0,1)=="/"){A=C.substr(0,C.indexOf("/",C.indexOf("://")+3))+A; 2387}else{A=C+A; 2388}}var B=A.lastIndexOf("/"); 2389if(B<0){return""; 2390}else{return A.substr(0,B+1); 2391}}; 2392Timeline.DefaultEventSource.prototype._resolveRelativeURL=function(A,B){if(A==null||A==""){return A; 2393}else{if(A.indexOf("://")>0){return A; 2394}else{if(A.substr(0,1)=="/"){return B.substr(0,B.indexOf("/",B.indexOf("://")+3))+A; 2395}else{return B+A; 2396}}}}; 2397Timeline.DefaultEventSource.Event=function(A){function D(E){return(A[E]!=null&&A[E]!="")?A[E]:null; 2398}var C=A.id?A.id.trim():""; 2399this._id=C.length>0?C:Timeline.EventUtils.getNewEventID(); 2400this._instant=A.instant||(A.end==null); 2401this._start=A.start; 2402this._end=(A.end!=null)?A.end:A.start; 2403this._latestStart=(A.latestStart!=null)?A.latestStart:(A.instant?this._end:this._start); 2404this._earliestEnd=(A.earliestEnd!=null)?A.earliestEnd:this._end; 2405var B=[]; 2406if(this._start>this._latestStart){this._latestStart=this._start; 2407B.push("start is > latestStart"); 2408}if(this._start>this._earliestEnd){this._earliestEnd=this._latestStart; 2409B.push("start is > earliestEnd"); 2410}if(this._start>this._end){this._end=this._earliestEnd; 2411B.push("start is > end"); 2412}if(this._latestStart>this._earliestEnd){this._earliestEnd=this._latestStart; 2413B.push("latestStart is > earliestEnd"); 2414}if(this._latestStart>this._end){this._end=this._earliestEnd; 2415B.push("latestStart is > end"); 2416}if(this._earliestEnd>this._end){this._end=this._earliestEnd; 2417B.push("earliestEnd is > end"); 2418}this._eventID=D("eventID"); 2419this._text=(A.text!=null)?SimileAjax.HTML.deEntify(A.text):""; 2420if(B.length>0){this._text+=" PROBLEM: "+B.join(", "); 2421}this._description=SimileAjax.HTML.deEntify(A.description); 2422this._image=D("image"); 2423this._link=D("link"); 2424this._title=D("hoverText"); 2425this._title=D("caption"); 2426this._icon=D("icon"); 2427this._color=D("color"); 2428this._textColor=D("textColor"); 2429this._classname=D("classname"); 2430this._tapeImage=D("tapeImage"); 2431this._tapeRepeat=D("tapeRepeat"); 2432this._trackNum=D("trackNum"); 2433if(this._trackNum!=null){this._trackNum=parseInt(this._trackNum); 2434}this._wikiURL=null; 2435this._wikiSection=null; 2436}; 2437Timeline.DefaultEventSource.Event.prototype={getID:function(){return this._id; 2438},isInstant:function(){return this._instant; 2439},isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd; 2440},getStart:function(){return this._start; 2441},getEnd:function(){return this._end; 2442},getLatestStart:function(){return this._latestStart; 2443},getEarliestEnd:function(){return this._earliestEnd; 2444},getEventID:function(){return this._eventID; 2445},getText:function(){return this._text; 2446},getDescription:function(){return this._description; 2447},getImage:function(){return this._image; 2448},getLink:function(){return this._link; 2449},getIcon:function(){return this._icon; 2450},getColor:function(){return this._color; 2451},getTextColor:function(){return this._textColor; 2452},getClassName:function(){return this._classname; 2453},getTapeImage:function(){return this._tapeImage; 2454},getTapeRepeat:function(){return this._tapeRepeat; 2455},getTrackNum:function(){return this._trackNum; 2456},getProperty:function(A){return null; 2457},getWikiURL:function(){return this._wikiURL; 2458},getWikiSection:function(){return this._wikiSection; 2459},setWikiInfo:function(B,A){this._wikiURL=B; 2460this._wikiSection=A; 2461},fillDescription:function(A){A.innerHTML=this._description; 2462},fillWikiInfo:function(D){D.style.display="none"; 2463if(this._wikiURL==null||this._wikiSection==null){return ; 2464}var C=this.getProperty("wikiID"); 2465if(C==null||C.length==0){C=this.getText(); 2466}if(C==null||C.length==0){return ; 2467}D.style.display="inline"; 2468C=C.replace(/\s/g,"_"); 2469var B=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+C; 2470var A=document.createElement("a"); 2471A.href=B; 2472A.target="new"; 2473A.innerHTML=Timeline.strings[Timeline.clientLocale].wikiLinkLabel; 2474D.appendChild(document.createTextNode("[")); 2475D.appendChild(A); 2476D.appendChild(document.createTextNode("]")); 2477},fillTime:function(A,B){if(this._instant){if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); 2478A.appendChild(A.ownerDocument.createElement("br")); 2479A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end))); 2480}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); 2481}}else{if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)+" ~ "+B.labelPrecise(this._latestStart))); 2482A.appendChild(A.ownerDocument.createElement("br")); 2483A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._earliestEnd)+" ~ "+B.labelPrecise(this._end))); 2484}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); 2485A.appendChild(A.ownerDocument.createElement("br")); 2486A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end))); 2487}}},fillInfoBubble:function(A,E,M){var K=A.ownerDocument; 2488var J=this.getText(); 2489var H=this.getLink(); 2490var B=this.getImage(); 2491if(B!=null){var D=K.createElement("img"); 2492D.src=B; 2493E.event.bubble.imageStyler(D); 2494A.appendChild(D); 2495}var L=K.createElement("div"); 2496var C=K.createTextNode(J); 2497if(H!=null){var I=K.createElement("a"); 2498I.href=H; 2499I.appendChild(C); 2500L.appendChild(I); 2501}else{L.appendChild(C); 2502}E.event.bubble.titleStyler(L); 2503A.appendChild(L); 2504var N=K.createElement("div"); 2505this.fillDescription(N); 2506E.event.bubble.bodyStyler(N); 2507A.appendChild(N); 2508var G=K.createElement("div"); 2509this.fillTime(G,M); 2510E.event.bubble.timeStyler(G); 2511A.appendChild(G); 2512var F=K.createElement("div"); 2513this.fillWikiInfo(F); 2514E.event.bubble.wikiStyler(F); 2515A.appendChild(F); 2516}}; 2517 2518 2519/* themes.js */ 2520Timeline.ClassicTheme=new Object(); 2521Timeline.ClassicTheme.implementations=[]; 2522Timeline.ClassicTheme.create=function(B){if(B==null){B=Timeline.getDefaultLocale(); 2523}var A=Timeline.ClassicTheme.implementations[B]; 2524if(A==null){A=Timeline.ClassicTheme._Impl; 2525}return new A(); 2526}; 2527Timeline.ClassicTheme._Impl=function(){this.firstDayOfWeek=0; 2528this.autoWidth=false; 2529this.autoWidthAnimationTime=500; 2530this.timeline_start=null; 2531this.timeline_stop=null; 2532this.ether={backgroundColors:[],highlightOpacity:50,interval:{line:{show:true,opacity:25},weekend:{opacity:30},marker:{hAlign:"Bottom",vAlign:"Right"}}}; 2533this.event={track:{height:10,gap:2,offset:2,autoWidthMargin:1.5},overviewTrack:{offset:20,tickHeight:6,height:2,gap:1,autoWidthMargin:5},tape:{height:4},instant:{icon:Timeline.urlPrefix+"images/dull-blue-circle.png",iconWidth:10,iconHeight:10,impreciseOpacity:20,impreciseIconMargin:3},duration:{impreciseOpacity:20},label:{backgroundOpacity:50,offsetFromLine:3},highlightColors:["#FFFF00","#FFC000","#FF0000","#0000FF"],highlightLabelBackground:false,bubble:{width:250,maxHeight:0,titleStyler:function(A){A.className="timeline-event-bubble-title"; 2534},bodyStyler:function(A){A.className="timeline-event-bubble-body"; 2535},imageStyler:function(A){A.className="timeline-event-bubble-image"; 2536},wikiStyler:function(A){A.className="timeline-event-bubble-wiki"; 2537},timeStyler:function(A){A.className="timeline-event-bubble-time"; 2538}}}; 2539this.mouseWheel="scroll"; 2540}; 2541 2542 2543/* timeline.js */ 2544Timeline.version="2.3.0"; 2545Timeline.ajax_lib_version=SimileAjax.version; 2546Timeline.display_version=Timeline.version+" (with Ajax lib "+Timeline.ajax_lib_version+")"; 2547Timeline.strings={}; 2548Timeline.HORIZONTAL=0; 2549Timeline.VERTICAL=1; 2550Timeline._defaultTheme=null; 2551Timeline.getDefaultLocale=function(){return Timeline.clientLocale; 2552}; 2553Timeline.create=function(D,C,E,F){if(Timeline.timelines==null){Timeline.timelines=[]; 2554}var B=Timeline.timelines.length; 2555Timeline.timelines[B]=null; 2556var A=new Timeline._Impl(D,C,E,F,B); 2557Timeline.timelines[B]=A; 2558return A; 2559}; 2560Timeline.createBandInfo=function(F){var G=("theme" in F)?F.theme:Timeline.getDefaultTheme(); 2561var D=("eventSource" in F)?F.eventSource:null; 2562var H=new Timeline.LinearEther({centersOn:("date" in F)?F.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[F.intervalUnit],pixelsPerInterval:F.intervalPixels,theme:G}); 2563var C=new Timeline.GregorianEtherPainter({unit:F.intervalUnit,multiple:("multiple" in F)?F.multiple:1,theme:G,align:("align" in F)?F.align:undefined}); 2564var I={showText:("showEventText" in F)?F.showEventText:true,theme:G}; 2565if("eventPainterParams" in F){for(var A in F.eventPainterParams){I[A]=F.eventPainterParams[A]; 2566}}if("trackHeight" in F){I.trackHeight=F.trackHeight; 2567}if("trackGap" in F){I.trackGap=F.trackGap; 2568}var B=("overview" in F&&F.overview)?"overview":("layout" in F?F.layout:"original"); 2569var E; 2570if("eventPainter" in F){E=new F.eventPainter(I); 2571}else{switch(B){case"overview":E=new Timeline.OverviewEventPainter(I); 2572break; 2573case"detailed":E=new Timeline.DetailedEventPainter(I); 2574break; 2575default:E=new Timeline.OriginalEventPainter(I); 2576}}return{width:F.width,eventSource:D,timeZone:("timeZone" in F)?F.timeZone:0,ether:H,etherPainter:C,eventPainter:E,theme:G,zoomIndex:("zoomIndex" in F)?F.zoomIndex:0,zoomSteps:("zoomSteps" in F)?F.zoomSteps:null}; 2577}; 2578Timeline.createHotZoneBandInfo=function(F){var G=("theme" in F)?F.theme:Timeline.getDefaultTheme(); 2579var D=("eventSource" in F)?F.eventSource:null; 2580var H=new Timeline.HotZoneEther({centersOn:("date" in F)?F.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[F.intervalUnit],pixelsPerInterval:F.intervalPixels,zones:F.zones,theme:G}); 2581var C=new Timeline.HotZoneGregorianEtherPainter({unit:F.intervalUnit,zones:F.zones,theme:G,align:("align" in F)?F.align:undefined}); 2582var I={showText:("showEventText" in F)?F.showEventText:true,theme:G}; 2583if("eventPainterParams" in F){for(var A in F.eventPainterParams){I[A]=F.eventPainterParams[A]; 2584}}if("trackHeight" in F){I.trackHeight=F.trackHeight; 2585}if("trackGap" in F){I.trackGap=F.trackGap; 2586}var B=("overview" in F&&F.overview)?"overview":("layout" in F?F.layout:"original"); 2587var E; 2588if("eventPainter" in F){E=new F.eventPainter(I); 2589}else{switch(B){case"overview":E=new Timeline.OverviewEventPainter(I); 2590break; 2591case"detailed":E=new Timeline.DetailedEventPainter(I); 2592break; 2593default:E=new Timeline.OriginalEventPainter(I); 2594}}return{width:F.width,eventSource:D,timeZone:("timeZone" in F)?F.timeZone:0,ether:H,etherPainter:C,eventPainter:E,theme:G,zoomIndex:("zoomIndex" in F)?F.zoomIndex:0,zoomSteps:("zoomSteps" in F)?F.zoomSteps:null}; 2595}; 2596Timeline.getDefaultTheme=function(){if(Timeline._defaultTheme==null){Timeline._defaultTheme=Timeline.ClassicTheme.create(Timeline.getDefaultLocale()); 2597}return Timeline._defaultTheme; 2598}; 2599Timeline.setDefaultTheme=function(A){Timeline._defaultTheme=A; 2600}; 2601Timeline.loadXML=function(A,C){var D=function(G,F,E){alert("Failed to load data xml from "+A+"\n"+G); 2602}; 2603var B=function(F){var E=F.responseXML; 2604if(!E.documentElement&&F.responseStream){E.load(F.responseStream); 2605}C(E,A); 2606}; 2607SimileAjax.XmlHttp.get(A,D,B); 2608}; 2609Timeline.loadJSON=function(url,f){var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText); 2610}; 2611var fDone=function(xmlhttp){f(eval("("+xmlhttp.responseText+")"),url); 2612}; 2613SimileAjax.XmlHttp.get(url,fError,fDone); 2614}; 2615Timeline.getTimelineFromID=function(A){return Timeline.timelines[A]; 2616}; 2617Timeline.writeVersion=function(A){document.getElementById(A).innerHTML=this.display_version; 2618}; 2619Timeline._Impl=function(C,B,D,E,A){SimileAjax.WindowManager.initialize(); 2620this._containerDiv=C; 2621this._bandInfos=B; 2622this._orientation=D==null?Timeline.HORIZONTAL:D; 2623this._unit=(E!=null)?E:SimileAjax.NativeDateUnit; 2624this._starting=true; 2625this._autoResizing=false; 2626this.autoWidth=B&&B[0]&&B[0].theme&&B[0].theme.autoWidth; 2627this.autoWidthAnimationTime=B&&B[0]&&B[0].theme&&B[0].theme.autoWidthAnimationTime; 2628this.timelineID=A; 2629this.timeline_start=B&&B[0]&&B[0].theme&&B[0].theme.timeline_start; 2630this.timeline_stop=B&&B[0]&&B[0].theme&&B[0].theme.timeline_stop; 2631this.timeline_at_start=false; 2632this.timeline_at_stop=false; 2633this._initialize(); 2634}; 2635Timeline._Impl.prototype.dispose=function(){for(var A=0; 2636A<this._bands.length; 2637A++){this._bands[A].dispose(); 2638}this._bands=null; 2639this._bandInfos=null; 2640this._containerDiv.innerHTML=""; 2641Timeline.timelines[this.timelineID]=null; 2642}; 2643Timeline._Impl.prototype.getBandCount=function(){return this._bands.length; 2644}; 2645Timeline._Impl.prototype.getBand=function(A){return this._bands[A]; 2646}; 2647Timeline._Impl.prototype.finishedEventLoading=function(){this._autoWidthCheck(true); 2648this._starting=false; 2649}; 2650Timeline._Impl.prototype.layout=function(){this._autoWidthCheck(true); 2651this._distributeWidths(); 2652}; 2653Timeline._Impl.prototype.paint=function(){for(var A=0; 2654A<this._bands.length; 2655A++){this._bands[A].paint(); 2656}}; 2657Timeline._Impl.prototype.getDocument=function(){return this._containerDiv.ownerDocument; 2658}; 2659Timeline._Impl.prototype.addDiv=function(A){this._containerDiv.appendChild(A); 2660}; 2661Timeline._Impl.prototype.removeDiv=function(A){this._containerDiv.removeChild(A); 2662}; 2663Timeline._Impl.prototype.isHorizontal=function(){return this._orientation==Timeline.HORIZONTAL; 2664}; 2665Timeline._Impl.prototype.isVertical=function(){return this._orientation==Timeline.VERTICAL; 2666}; 2667Timeline._Impl.prototype.getPixelLength=function(){return this._orientation==Timeline.HORIZONTAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight; 2668}; 2669Timeline._Impl.prototype.getPixelWidth=function(){return this._orientation==Timeline.VERTICAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight; 2670}; 2671Timeline._Impl.prototype.getUnit=function(){return this._unit; 2672}; 2673Timeline._Impl.prototype.getWidthStyle=function(){return this._orientation==Timeline.HORIZONTAL?"height":"width"; 2674}; 2675Timeline._Impl.prototype.loadXML=function(B,D){var A=this; 2676var E=function(H,G,F){alert("Failed to load data xml from "+B+"\n"+H); 2677A.hideLoadingMessage(); 2678}; 2679var C=function(G){try{var F=G.responseXML; 2680if(!F.documentElement&&G.responseStream){F.load(G.responseStream); 2681}D(F,B); 2682}finally{A.hideLoadingMessage(); 2683}}; 2684this.showLoadingMessage(); 2685window.setTimeout(function(){SimileAjax.XmlHttp.get(B,E,C); 2686},0); 2687}; 2688Timeline._Impl.prototype.loadJSON=function(url,f){var tl=this; 2689var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText); 2690tl.hideLoadingMessage(); 2691}; 2692var fDone=function(xmlhttp){try{f(eval("("+xmlhttp.responseText+")"),url); 2693}finally{tl.hideLoadingMessage(); 2694}}; 2695this.showLoadingMessage(); 2696window.setTimeout(function(){SimileAjax.XmlHttp.get(url,fError,fDone); 2697},0); 2698}; 2699Timeline._Impl.prototype._autoWidthScrollListener=function(A){A.getTimeline()._autoWidthCheck(false); 2700}; 2701Timeline._Impl.prototype._autoWidthCheck=function(C){var A=this; 2702var B=A._starting; 2703var D=0; 2704function E(){var G=A.getWidthStyle(); 2705if(B){A._containerDiv.style[G]=D+"px"; 2706}else{A._autoResizing=true; 2707var H={}; 2708H[G]=D+"px"; 2709SimileAjax.jQuery(A._containerDiv).animate(H,A.autoWidthAnimationTime,"linear",function(){A._autoResizing=false; 2710}); 2711}}function F(){var H=0; 2712var G=A.getPixelWidth(); 2713if(A._autoResizing){return ; 2714}for(var I=0; 2715I<A._bands.length; 2716I++){A._bands[I].checkAutoWidth(); 2717H+=A._bandInfos[I].width; 2718}if(H>G||C){D=H; 2719E(); 2720A._distributeWidths(); 2721}}if(!A.autoWidth){return ; 2722}F(); 2723}; 2724Timeline._Impl.prototype._initialize=function(){var H=this._containerDiv; 2725var E=H.ownerDocument; 2726H.className=H.className.split(" ").concat("timeline-container").join(" "); 2727var C=(this.isHorizontal())?"horizontal":"vertical"; 2728H.className+=" timeline-"+C; 2729while(H.firstChild){H.removeChild(H.firstChild); 2730}var A=SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix+(this.isHorizontal()?"images/copyright-vertical.png":"images/copyright.png")); 2731A.className="timeline-copyright"; 2732A.title="Timeline copyright SIMILE - www.code.google.com/p/simile-widgets/"; 2733SimileAjax.DOM.registerEvent(A,"click",function(){window.location="http://code.google.com/p/simile-widgets/"; 2734}); 2735H.appendChild(A); 2736this._bands=[]; 2737for(var B=0; 2738B<this._bandInfos.length; 2739B++){var G=new Timeline._Band(this,this._bandInfos[B],B); 2740this._bands.push(G); 2741}this._distributeWidths(); 2742for(var B=0; 2743B<this._bandInfos.length; 2744B++){var F=this._bandInfos[B]; 2745if("syncWith" in F){this._bands[B].setSyncWithBand(this._bands[F.syncWith],("highlight" in F)?F.highlight:false); 2746}}if(this.autoWidth){for(var B=0; 2747B<this._bands.length; 2748B++){this._bands[B].addOnScrollListener(this._autoWidthScrollListener); 2749}}var D=SimileAjax.Graphics.createMessageBubble(E); 2750D.containerDiv.className="timeline-message-container"; 2751H.appendChild(D.containerDiv); 2752D.contentDiv.className="timeline-message"; 2753D.contentDiv.innerHTML="<img src='"+Timeline.urlPrefix+"images/progress-running.gif' /> Loading..."; 2754this.showLoadingMessage=function(){D.containerDiv.style.display="block"; 2755}; 2756this.hideLoadingMessage=function(){D.containerDiv.style.display="none"; 2757}; 2758}; 2759Timeline._Impl.prototype._distributeWidths=function(){var G=this.getPixelLength(); 2760var B=this.getPixelWidth(); 2761var C=0; 2762for(var F=0; 2763F<this._bands.length; 2764F++){var J=this._bands[F]; 2765var I=this._bandInfos[F]; 2766var E=I.width; 2767var D; 2768if(typeof E=="string"){var H=E.indexOf("%"); 2769if(H>0){var A=parseInt(E.substr(0,H)); 2770D=Math.round(A*B/100); 2771}else{D=parseInt(E); 2772}}else{D=E; 2773}J.setBandShiftAndWidth(C,D); 2774J.setViewLength(G); 2775C+=D; 2776}}; 2777Timeline._Impl.prototype.shiftOK=function(C,B){var F=B>0,A=B<0; 2778if((F&&this.timeline_start==null)||(A&&this.timeline_stop==null)||(B==0)){return(true); 2779}var H=false; 2780for(var E=0; 2781E<this._bands.length&&!H; 2782E++){H=this._bands[E].busy(); 2783}if(H){return(true); 2784}if((F&&this.timeline_at_start)||(A&&this.timeline_at_stop)){return(false); 2785}var D=false; 2786for(var E=0; 2787E<this._bands.length&&!D; 2788E++){var G=this._bands[E]; 2789if(F){D=(E==C?G.getMinVisibleDateAfterDelta(B):G.getMinVisibleDate())>=this.timeline_start; 2790}else{D=(E==C?G.getMaxVisibleDateAfterDelta(B):G.getMaxVisibleDate())<=this.timeline_stop; 2791}}if(F){this.timeline_at_start=!D; 2792this.timeline_at_stop=false; 2793}else{this.timeline_at_stop=!D; 2794this.timeline_at_start=false; 2795}return(D); 2796}; 2797Timeline._Impl.prototype.zoom=function(D,A,G,F){var C=new RegExp("^timeline-band-([0-9]+)$"); 2798var E=null; 2799var B=C.exec(F.id); 2800if(B){E=parseInt(B[1]); 2801}if(E!=null){this._bands[E].zoom(D,A,G,F); 2802}this.paint(); 2803}; 2804 2805 2806/* units.js */ 2807Timeline.NativeDateUnit=new Object(); 2808Timeline.NativeDateUnit.createLabeller=function(B,A){return new Timeline.GregorianDateLabeller(B,A); 2809}; 2810Timeline.NativeDateUnit.makeDefaultValue=function(){return new Date(); 2811}; 2812Timeline.NativeDateUnit.cloneValue=function(A){return new Date(A.getTime()); 2813}; 2814Timeline.NativeDateUnit.getParser=function(A){if(typeof A=="string"){A=A.toLowerCase(); 2815}return(A=="iso8601"||A=="iso 8601")?Timeline.DateTime.parseIso8601DateTime:Timeline.DateTime.parseGregorianDateTime; 2816}; 2817Timeline.NativeDateUnit.parseFromObject=function(A){return Timeline.DateTime.parseGregorianDateTime(A); 2818}; 2819Timeline.NativeDateUnit.toNumber=function(A){return A.getTime(); 2820}; 2821Timeline.NativeDateUnit.fromNumber=function(A){return new Date(A); 2822}; 2823Timeline.NativeDateUnit.compare=function(D,C){var B,A; 2824if(typeof D=="object"){B=D.getTime(); 2825}else{B=Number(D); 2826}if(typeof C=="object"){A=C.getTime(); 2827}else{A=Number(C); 2828}return B-A; 2829}; 2830Timeline.NativeDateUnit.earlier=function(B,A){return Timeline.NativeDateUnit.compare(B,A)<0?B:A; 2831}; 2832Timeline.NativeDateUnit.later=function(B,A){return Timeline.NativeDateUnit.compare(B,A)>0?B:A; 2833}; 2834Timeline.NativeDateUnit.change=function(A,B){return new Date(A.getTime()+B); 2835}; 2836