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