1 | | |
2 | | |
3 | | /* band.js */ |
4 | | Timeline._Band=function(B,G,C){if(B.autoWidth&&typeof G.width=="string"){G.width=G.width.indexOf("%")>-1?0:parseInt(G.width); |
5 | | }this._timeline=B; |
6 | | this._bandInfo=G; |
7 | | this._index=C; |
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 B.getUnit())?B.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 E=this._timeline.getDocument().createElement("div"); |
26 | | E.className="timeline-band-input"; |
27 | | this._timeline.addDiv(E); |
28 | | this._keyboardInput=document.createElement("input"); |
29 | | this._keyboardInput.type="text"; |
30 | | E.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-"+C; |
35 | | this._div.className="timeline-band timeline-band-"+C; |
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 F=this._theme!=null?this._theme.mouseWheel:"scroll"; |
43 | | if(F==="zoom"||F==="scroll"||this._zoomSteps){if(SimileAjax.Platform.browser.isFirefox){SimileAjax.DOM.registerEventWithObject(this._div,"DOMMouseScroll",this,"_onMouseScroll"); |
44 | | }else{SimileAjax.DOM.registerEventWithObject(this._div,"mousewheel",this,"_onMouseScroll"); |
45 | | }}this._innerDiv=this._timeline.getDocument().createElement("div"); |
46 | | this._innerDiv.className="timeline-band-inner"; |
47 | | this._div.appendChild(this._innerDiv); |
48 | | this._ether=G.ether; |
49 | | G.ether.initialize(this,B); |
50 | | this._etherPainter=G.etherPainter; |
51 | | G.etherPainter.initialize(this,B); |
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,B); |
61 | | this._decorators=("decorators" in G)?G.decorators:[]; |
62 | | for(var D=0; |
63 | | D<this._decorators.length; |
64 | | D++){this._decorators[D].initialize(this,B); |
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(A,B){this._eventTrackIncrement=B; |
117 | | if(A>this._eventTracksNeeded){this._eventTracksNeeded=A; |
118 | | }}; |
119 | | Timeline._Band.prototype.checkAutoWidth=function(){if(!this._timeline.autoWidth){return ; |
120 | | }var C=this._eventPainter.getType()=="overview"; |
121 | | var A=C?this._theme.event.overviewTrack.autoWidthMargin:this._theme.event.track.autoWidthMargin; |
122 | | var B=Math.ceil((this._eventTracksNeeded+A)*this._eventTrackIncrement); |
123 | | B+=C?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(){ |
| 1 | /* band.js */ |
| 2 | Timeline._Band = function (B, G, C) { |
| 3 | if (B.autoWidth && typeof G.width == "string") { |
| 4 | G.width = G.width.indexOf("%") > -1 ? 0 : parseInt(G.width); |
| 5 | } |
| 6 | this._timeline = B; |
| 7 | this._bandInfo = G; |
| 8 | this._index = C; |
| 9 | this._locale = ("locale" in G) ? G.locale : Timeline.getDefaultLocale(); |
| 10 | this._timeZone = ("timeZone" in G) ? G.timeZone : 0; |
| 11 | this._labeller = ("labeller" in G) ? G.labeller : (("createLabeller" in B.getUnit()) ? B.getUnit().createLabeller(this._locale, this._timeZone) : new Timeline.GregorianDateLabeller(this._locale, this._timeZone)); |
| 12 | this._theme = G.theme; |
| 13 | this._zoomIndex = ("zoomIndex" in G) ? G.zoomIndex : 0; |
| 14 | this._zoomSteps = ("zoomSteps" in G) ? G.zoomSteps : null; |
| 15 | this._dragging = false; |
| 16 | this._changing = false; |
| 17 | this._originalScrollSpeed = 5; |
| 18 | this._scrollSpeed = this._originalScrollSpeed; |
| 19 | this._onScrollListeners = []; |
| 20 | var A = this; |
| 21 | this._syncWithBand = null; |
| 22 | this._syncWithBandHandler = function (H) { |
| 23 | A._onHighlightBandScroll(); |
| 24 | }; |
| 25 | this._selectorListener = function (H) { |
| 26 | A._onHighlightBandScroll(); |
| 27 | }; |
| 28 | var E = this._timeline.getDocument().createElement("div"); |
| 29 | E.className = "timeline-band-input"; |
| 30 | this._timeline.addDiv(E); |
| 31 | this._keyboardInput = document.createElement("input"); |
| 32 | this._keyboardInput.type = "text"; |
| 33 | E.appendChild(this._keyboardInput); |
| 34 | SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keydown", this, "_onKeyDown"); |
| 35 | SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keyup", this, "_onKeyUp"); |
| 36 | this._div = this._timeline.getDocument().createElement("div"); |
| 37 | this._div.id = "timeline-band-" + C; |
| 38 | this._div.className = "timeline-band timeline-band-" + C; |
| 39 | this._timeline.addDiv(this._div); |
| 40 | SimileAjax.DOM.registerEventWithObject(this._div, "mousedown", this, "_onMouseDown"); |
| 41 | SimileAjax.DOM.registerEventWithObject(this._div, "mousemove", this, "_onMouseMove"); |
| 42 | SimileAjax.DOM.registerEventWithObject(this._div, "mouseup", this, "_onMouseUp"); |
| 43 | SimileAjax.DOM.registerEventWithObject(this._div, "mouseout", this, "_onMouseOut"); |
| 44 | SimileAjax.DOM.registerEventWithObject(this._div, "dblclick", this, "_onDblClick"); |
| 45 | var F = this._theme != null ? this._theme.mouseWheel : "scroll"; |
| 46 | if (F === "zoom" || F === "scroll" || this._zoomSteps) { |
| 47 | if (SimileAjax.Platform.browser.isFirefox) { |
| 48 | SimileAjax.DOM.registerEventWithObject(this._div, "DOMMouseScroll", this, "_onMouseScroll"); |
| 49 | } else { |
| 50 | SimileAjax.DOM.registerEventWithObject(this._div, "mousewheel", this, "_onMouseScroll"); |
| 51 | } |
| 52 | } |
| 53 | this._innerDiv = this._timeline.getDocument().createElement("div"); |
| 54 | this._innerDiv.className = "timeline-band-inner"; |
| 55 | this._div.appendChild(this._innerDiv); |
| 56 | this._ether = G.ether; |
| 57 | G.ether.initialize(this, B); |
| 58 | this._etherPainter = G.etherPainter; |
| 59 | G.etherPainter.initialize(this, B); |
| 60 | this._eventSource = G.eventSource; |
| 61 | if (this._eventSource) { |
| 62 | this._eventListener = { |
| 63 | onAddMany: function () { |
| 64 | A._onAddMany(); |
| 65 | }, |
| 66 | onClear: function () { |
| 67 | A._onClear(); |
| 68 | } |
| 69 | }; |
| 70 | this._eventSource.addListener(this._eventListener); |
| 71 | } |
| 72 | this._eventPainter = G.eventPainter; |
| 73 | this._eventTracksNeeded = 0; |
| 74 | this._eventTrackIncrement = 0; |
| 75 | G.eventPainter.initialize(this, B); |
| 76 | this._decorators = ("decorators" in G) ? G.decorators : []; |
| 77 | for (var D = 0; |
| 78 | D < this._decorators.length; |
| 79 | D++) { |
| 80 | this._decorators[D].initialize(this, B); |
| 81 | } |
| 82 | }; |
| 83 | Timeline._Band.SCROLL_MULTIPLES = 5; |
| 84 | Timeline._Band.prototype.dispose = function () { |
| 85 | this.closeBubble(); |
| 86 | if (this._eventSource) { |
| 87 | this._eventSource.removeListener(this._eventListener); |
| 88 | this._eventListener = null; |
| 89 | this._eventSource = null; |
| 90 | } |
| 91 | this._timeline = null; |
| 92 | this._bandInfo = null; |
| 93 | this._labeller = null; |
| 94 | this._ether = null; |
| 95 | this._etherPainter = null; |
| 96 | this._eventPainter = null; |
| 97 | this._decorators = null; |
| 98 | this._onScrollListeners = null; |
| 99 | this._syncWithBandHandler = null; |
| 100 | this._selectorListener = null; |
| 101 | this._div = null; |
| 102 | this._innerDiv = null; |
| 103 | this._keyboardInput = null; |
| 104 | }; |
| 105 | Timeline._Band.prototype.addOnScrollListener = function (A) { |
| 106 | this._onScrollListeners.push(A); |
| 107 | }; |
| 108 | Timeline._Band.prototype.removeOnScrollListener = function (B) { |
| 109 | for (var A = 0; |
| 110 | A < this._onScrollListeners.length; |
| 111 | A++) { |
| 112 | if (this._onScrollListeners[A] == B) { |
| 113 | this._onScrollListeners.splice(A, 1); |
| 114 | break; |
| 115 | } |
| 116 | } |
| 117 | }; |
| 118 | Timeline._Band.prototype.setSyncWithBand = function (B, A) { |
| 119 | if (this._syncWithBand) { |
| 120 | this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler); |
| 121 | } |
| 122 | this._syncWithBand = B; |
| 123 | this._syncWithBand.addOnScrollListener(this._syncWithBandHandler); |
| 124 | this._highlight = A; |
| 125 | this._positionHighlight(); |
| 126 | }; |
| 127 | Timeline._Band.prototype.getLocale = function () { |
| 128 | return this._locale; |
| 129 | }; |
| 130 | Timeline._Band.prototype.getTimeZone = function () { |
| 131 | return this._timeZone; |
| 132 | }; |
| 133 | Timeline._Band.prototype.getLabeller = function () { |
| 134 | return this._labeller; |
| 135 | }; |
| 136 | Timeline._Band.prototype.getIndex = function () { |
| 137 | return this._index; |
| 138 | }; |
| 139 | Timeline._Band.prototype.getEther = function () { |
| 140 | return this._ether; |
| 141 | }; |
| 142 | Timeline._Band.prototype.getEtherPainter = function () { |
| 143 | return this._etherPainter; |
| 144 | }; |
| 145 | Timeline._Band.prototype.getEventSource = function () { |
| 146 | return this._eventSource; |
| 147 | }; |
| 148 | Timeline._Band.prototype.getEventPainter = function () { |
| 149 | return this._eventPainter; |
| 150 | }; |
| 151 | Timeline._Band.prototype.getTimeline = function () { |
| 152 | return this._timeline; |
| 153 | }; |
| 154 | Timeline._Band.prototype.updateEventTrackInfo = function (A, B) { |
| 155 | this._eventTrackIncrement = B; |
| 156 | if (A > this._eventTracksNeeded) { |
| 157 | this._eventTracksNeeded = A; |
| 158 | } |
| 159 | }; |
| 160 | Timeline._Band.prototype.checkAutoWidth = function () { |
| 161 | if (!this._timeline.autoWidth) { |
| 162 | return; |
| 163 | } |
| 164 | var C = this._eventPainter.getType() == "overview"; |
| 165 | var A = C ? this._theme.event.overviewTrack.autoWidthMargin : this._theme.event.track.autoWidthMargin; |
| 166 | var B = Math.ceil((this._eventTracksNeeded + A) * this._eventTrackIncrement); |
| 167 | B += C ? this._theme.event.overviewTrack.offset : this._theme.event.track.offset; |
| 168 | var D = this._bandInfo; |
| 169 | if (B != D.width) { |
| 170 | D.width = B; |
| 171 | } |
| 172 | }; |
| 173 | Timeline._Band.prototype.layout = function () { |
135 | | Timeline._Band.prototype.softLayout=function(){this.softPaint(); |
136 | | }; |
137 | | Timeline._Band.prototype.softPaint=function(){this._etherPainter.softPaint(); |
138 | | this._softPaintDecorators(); |
139 | | this._softPaintEvents(); |
140 | | }; |
141 | | Timeline._Band.prototype.setBandShiftAndWidth=function(A,D){ |
142 | | var C=this._keyboardInput.parentNode; |
143 | | var B=A+Math.floor(D/2); |
144 | | if(this._timeline.isHorizontal()){ |
145 | | this._div.style.top=A+"px"; |
146 | | this._div.style.height=D+"px"; |
147 | | C.style.top=B+"px"; |
148 | | C.style.left="-1em"; |
149 | | }else{ |
150 | | this._div.style.left=A+"px"; |
151 | | this._div.style.width=D+"px"; |
152 | | C.style.left=B+"px"; |
153 | | C.style.top="-1em"; |
154 | | } |
155 | | }; |
156 | | Timeline._Band.prototype.getViewWidth=function(){if(this._timeline.isHorizontal()){return this._div.offsetHeight; |
157 | | }else{return this._div.offsetWidth; |
158 | | }}; |
159 | | Timeline._Band.prototype.setViewLength=function(A){this._viewLength=A; |
160 | | this._recenterDiv(); |
161 | | this._onChanging(); |
162 | | }; |
163 | | Timeline._Band.prototype.getViewLength=function(){return this._viewLength; |
164 | | }; |
165 | | Timeline._Band.prototype.getTotalViewLength=function(){return Timeline._Band.SCROLL_MULTIPLES*this._viewLength; |
166 | | }; |
167 | | Timeline._Band.prototype.getViewOffset=function(){return this._viewOffset; |
168 | | }; |
169 | | Timeline._Band.prototype.getMinDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset); |
170 | | }; |
171 | | Timeline._Band.prototype.getMaxDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset+Timeline._Band.SCROLL_MULTIPLES*this._viewLength); |
172 | | }; |
173 | | Timeline._Band.prototype.getMinVisibleDate=function(){return this._ether.pixelOffsetToDate(0); |
174 | | }; |
175 | | Timeline._Band.prototype.getMinVisibleDateAfterDelta=function(A){return this._ether.pixelOffsetToDate(A); |
176 | | }; |
177 | | Timeline._Band.prototype.getMaxVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength); |
178 | | }; |
179 | | Timeline._Band.prototype.getMaxVisibleDateAfterDelta=function(A){return this._ether.pixelOffsetToDate(this._viewLength+A); |
180 | | }; |
181 | | Timeline._Band.prototype.getCenterVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength/2); |
182 | | }; |
183 | | Timeline._Band.prototype.setMinVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(-this._ether.dateToPixelOffset(A))); |
184 | | }}; |
185 | | Timeline._Band.prototype.setMaxVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength-this._ether.dateToPixelOffset(A))); |
186 | | }}; |
187 | | Timeline._Band.prototype.setCenterVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A))); |
188 | | }}; |
189 | | Timeline._Band.prototype.dateToPixelOffset=function(A){return this._ether.dateToPixelOffset(A)-this._viewOffset; |
190 | | }; |
191 | | Timeline._Band.prototype.pixelOffsetToDate=function(A){return this._ether.pixelOffsetToDate(A+this._viewOffset); |
192 | | }; |
193 | | Timeline._Band.prototype.createLayerDiv=function(C,A){var D=this._timeline.getDocument().createElement("div"); |
194 | | D.className="timeline-band-layer"+(typeof A=="string"?(" "+A):""); |
195 | | D.style.zIndex=C; |
196 | | this._innerDiv.appendChild(D); |
197 | | var B=this._timeline.getDocument().createElement("div"); |
198 | | B.className="timeline-band-layer-inner"; |
199 | | if(SimileAjax.Platform.browser.isIE){B.style.cursor="move"; |
200 | | }else{B.style.cursor="-moz-grab"; |
201 | | }D.appendChild(B); |
202 | | return B; |
203 | | }; |
204 | | Timeline._Band.prototype.removeLayerDiv=function(A){this._innerDiv.removeChild(A.parentNode); |
205 | | }; |
206 | | Timeline._Band.prototype.scrollToCenter=function(A,C){var B=this._ether.dateToPixelOffset(A); |
207 | | if(B<-this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(B+this._viewLength)); |
208 | | }else{if(B>3*this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(B-this._viewLength)); |
209 | | }}this._autoScroll(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A)),C); |
210 | | }; |
211 | | Timeline._Band.prototype.showBubbleForEvent=function(C){var A=this.getEventSource().getEvent(C); |
212 | | if(A){var B=this; |
213 | | this.scrollToCenter(A.getStart(),function(){B._eventPainter.showBubble(A); |
214 | | }); |
215 | | }}; |
216 | | Timeline._Band.prototype.zoom=function(C,A,F,E){if(!this._zoomSteps){return ; |
217 | | }A+=this._viewOffset; |
218 | | var D=this._ether.pixelOffsetToDate(A); |
219 | | var B=this._ether.zoom(C); |
220 | | this._etherPainter.zoom(B); |
221 | | this._moveEther(Math.round(-this._ether.dateToPixelOffset(D))); |
222 | | this._moveEther(A); |
223 | | }; |
224 | | Timeline._Band.prototype._onMouseDown=function(B,A,C){this.closeBubble(); |
225 | | this._dragging=true; |
226 | | this._dragX=A.clientX; |
227 | | this._dragY=A.clientY; |
228 | | }; |
229 | | Timeline._Band.prototype._onMouseMove=function(D,A,E){if(this._dragging){var C=A.clientX-this._dragX; |
230 | | var B=A.clientY-this._dragY; |
231 | | this._dragX=A.clientX; |
232 | | this._dragY=A.clientY; |
233 | | this._moveEther(this._timeline.isHorizontal()?C:B); |
234 | | this._positionHighlight(); |
235 | | }}; |
236 | | Timeline._Band.prototype._onMouseUp=function(B,A,C){this._dragging=false; |
237 | | this._keyboardInput.focus(); |
238 | | }; |
239 | | Timeline._Band.prototype._onMouseOut=function(C,B,D){var A=SimileAjax.DOM.getEventRelativeCoordinates(B,C); |
240 | | A.x+=this._viewOffset; |
241 | | if(A.x<0||A.x>C.offsetWidth||A.y<0||A.y>C.offsetHeight){this._dragging=false; |
242 | | }}; |
243 | | Timeline._Band.prototype._onMouseScroll=function(G,H,B){var A=new Date(); |
244 | | A=A.getTime(); |
245 | | if(!this._lastScrollTime||((A-this._lastScrollTime)>50)){this._lastScrollTime=A; |
246 | | var I=0; |
247 | | if(H.wheelDelta){I=H.wheelDelta/120; |
248 | | }else{if(H.detail){I=-H.detail/3; |
249 | | }}var F=this._theme.mouseWheel; |
250 | | if(this._zoomSteps||F==="zoom"){var E=SimileAjax.DOM.getEventRelativeCoordinates(H,G); |
251 | | if(I!=0){var D; |
252 | | if(I>0){D=true; |
253 | | }if(I<0){D=false; |
254 | | }this._timeline.zoom(D,E.x,E.y,G); |
255 | | }}else{if(F==="scroll"){var C=50*(I<0?-1:1); |
256 | | this._moveEther(C); |
257 | | }}}if(H.stopPropagation){H.stopPropagation(); |
258 | | }H.cancelBubble=true; |
259 | | if(H.preventDefault){H.preventDefault(); |
260 | | }H.returnValue=false; |
261 | | }; |
262 | | Timeline._Band.prototype._onDblClick=function(C,B,E){var A=SimileAjax.DOM.getEventRelativeCoordinates(B,C); |
263 | | var D=A.x-(this._viewLength/2-this._viewOffset); |
264 | | this._autoScroll(-D); |
265 | | }; |
266 | | Timeline._Band.prototype._onKeyDown=function(B,A,C){if(!this._dragging){switch(A.keyCode){case 27:break; |
267 | | case 37:case 38:this._scrollSpeed=Math.min(50,Math.abs(this._scrollSpeed*1.05)); |
268 | | this._moveEther(this._scrollSpeed); |
269 | | break; |
270 | | case 39:case 40:this._scrollSpeed=-Math.min(50,Math.abs(this._scrollSpeed*1.05)); |
271 | | this._moveEther(this._scrollSpeed); |
272 | | break; |
273 | | default:return true; |
274 | | }this.closeBubble(); |
275 | | SimileAjax.DOM.cancelEvent(A); |
276 | | return false; |
277 | | }return true; |
278 | | }; |
279 | | Timeline._Band.prototype._onKeyUp=function(B,A,C){if(!this._dragging){this._scrollSpeed=this._originalScrollSpeed; |
280 | | switch(A.keyCode){case 35:this.setCenterVisibleDate(this._eventSource.getLatestDate()); |
281 | | break; |
282 | | case 36:this.setCenterVisibleDate(this._eventSource.getEarliestDate()); |
283 | | break; |
284 | | case 33:this._autoScroll(this._timeline.getPixelLength()); |
285 | | break; |
286 | | case 34:this._autoScroll(-this._timeline.getPixelLength()); |
287 | | break; |
288 | | default:return true; |
289 | | }this.closeBubble(); |
290 | | SimileAjax.DOM.cancelEvent(A); |
291 | | return false; |
292 | | }return true; |
293 | | }; |
294 | | Timeline._Band.prototype._autoScroll=function(D,C){var A=this; |
295 | | var B=SimileAjax.Graphics.createAnimation(function(E,F){A._moveEther(F); |
296 | | },0,D,1000,C); |
297 | | B.run(); |
298 | | }; |
299 | | Timeline._Band.prototype._moveEther=function(A){this.closeBubble(); |
300 | | if(!this._timeline.shiftOK(this._index,A)){return ; |
301 | | }this._viewOffset+=A; |
302 | | this._ether.shiftPixels(-A); |
303 | | if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px"; |
304 | | }else{this._div.style.top=this._viewOffset+"px"; |
305 | | }if(this._viewOffset>-this._viewLength*0.5||this._viewOffset<-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1.5)){this._recenterDiv(); |
306 | | }else{this.softLayout(); |
307 | | }this._onChanging(); |
308 | | }; |
309 | | Timeline._Band.prototype._onChanging=function(){this._changing=true; |
310 | | this._fireOnScroll(); |
311 | | this._setSyncWithBandDate(); |
312 | | this._changing=false; |
313 | | }; |
314 | | Timeline._Band.prototype.busy=function(){return(this._changing); |
315 | | }; |
316 | | Timeline._Band.prototype._fireOnScroll=function(){for(var A=0; |
317 | | A<this._onScrollListeners.length; |
318 | | A++){this._onScrollListeners[A](this); |
319 | | }}; |
320 | | Timeline._Band.prototype._setSyncWithBandDate=function(){if(this._syncWithBand){var A=this._ether.pixelOffsetToDate(this.getViewLength()/2); |
321 | | this._syncWithBand.setCenterVisibleDate(A); |
322 | | }}; |
323 | | Timeline._Band.prototype._onHighlightBandScroll=function(){if(this._syncWithBand){var A=this._syncWithBand.getCenterVisibleDate(); |
324 | | var B=this._ether.dateToPixelOffset(A); |
325 | | this._moveEther(Math.round(this._viewLength/2-B)); |
326 | | if(this._highlight){this._etherPainter.setHighlight(this._syncWithBand.getMinVisibleDate(),this._syncWithBand.getMaxVisibleDate()); |
327 | | }}}; |
328 | | Timeline._Band.prototype._onAddMany=function(){this._paintEvents(); |
329 | | }; |
330 | | Timeline._Band.prototype._onClear=function(){this._paintEvents(); |
331 | | }; |
332 | | Timeline._Band.prototype._positionHighlight=function(){if(this._syncWithBand){var A=this._syncWithBand.getMinVisibleDate(); |
333 | | var B=this._syncWithBand.getMaxVisibleDate(); |
334 | | if(this._highlight){this._etherPainter.setHighlight(A,B); |
335 | | }}}; |
336 | | Timeline._Band.prototype._recenterDiv=function(){this._viewOffset=-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1)/2; |
337 | | if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px"; |
338 | | this._div.style.width=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px"; |
339 | | }else{this._div.style.top=this._viewOffset+"px"; |
340 | | this._div.style.height=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px"; |
341 | | }this.layout(); |
342 | | }; |
343 | | Timeline._Band.prototype._paintEvents=function(){this._eventPainter.paint(); |
344 | | }; |
345 | | Timeline._Band.prototype._softPaintEvents=function(){this._eventPainter.softPaint(); |
346 | | }; |
347 | | Timeline._Band.prototype._paintDecorators=function(){for(var A=0; |
348 | | A<this._decorators.length; |
349 | | A++){this._decorators[A].paint(); |
350 | | }}; |
351 | | Timeline._Band.prototype._softPaintDecorators=function(){for(var A=0; |
352 | | A<this._decorators.length; |
353 | | A++){this._decorators[A].softPaint(); |
354 | | }}; |
355 | | Timeline._Band.prototype.closeBubble=function(){SimileAjax.WindowManager.cancelPopups(); |
| 181 | Timeline._Band.prototype.softLayout = function () { |
| 182 | this.softPaint(); |
| 183 | }; |
| 184 | Timeline._Band.prototype.softPaint = function () { |
| 185 | this._etherPainter.softPaint(); |
| 186 | this._softPaintDecorators(); |
| 187 | this._softPaintEvents(); |
| 188 | }; |
| 189 | Timeline._Band.prototype.setBandShiftAndWidth = function (A, D) { |
| 190 | var C = this._keyboardInput.parentNode; |
| 191 | var B = A + Math.floor(D / 2); |
| 192 | if (this._timeline.isHorizontal()) { |
| 193 | this._div.style.top = A + "px"; |
| 194 | this._div.style.height = D + "px"; |
| 195 | C.style.top = B + "px"; |
| 196 | C.style.left = "-1em"; |
| 197 | } else { |
| 198 | this._div.style.left = A + "px"; |
| 199 | this._div.style.width = D + "px"; |
| 200 | C.style.left = B + "px"; |
| 201 | C.style.top = "-1em"; |
| 202 | } |
| 203 | }; |
| 204 | Timeline._Band.prototype.getViewWidth = function () { |
| 205 | if (this._timeline.isHorizontal()) { |
| 206 | return this._div.offsetHeight; |
| 207 | } else { |
| 208 | return this._div.offsetWidth; |
| 209 | } |
| 210 | }; |
| 211 | Timeline._Band.prototype.setViewLength = function (A) { |
| 212 | this._viewLength = A; |
| 213 | this._recenterDiv(); |
| 214 | this._onChanging(); |
| 215 | }; |
| 216 | Timeline._Band.prototype.getViewLength = function () { |
| 217 | return this._viewLength; |
| 218 | }; |
| 219 | Timeline._Band.prototype.getTotalViewLength = function () { |
| 220 | return Timeline._Band.SCROLL_MULTIPLES * this._viewLength; |
| 221 | }; |
| 222 | Timeline._Band.prototype.getViewOffset = function () { |
| 223 | return this._viewOffset; |
| 224 | }; |
| 225 | Timeline._Band.prototype.getMinDate = function () { |
| 226 | return this._ether.pixelOffsetToDate(this._viewOffset); |
| 227 | }; |
| 228 | Timeline._Band.prototype.getMaxDate = function () { |
| 229 | return this._ether.pixelOffsetToDate(this._viewOffset + Timeline._Band.SCROLL_MULTIPLES * this._viewLength); |
| 230 | }; |
| 231 | Timeline._Band.prototype.getMinVisibleDate = function () { |
| 232 | return this._ether.pixelOffsetToDate(0); |
| 233 | }; |
| 234 | Timeline._Band.prototype.getMinVisibleDateAfterDelta = function (A) { |
| 235 | return this._ether.pixelOffsetToDate(A); |
| 236 | }; |
| 237 | Timeline._Band.prototype.getMaxVisibleDate = function () { |
| 238 | return this._ether.pixelOffsetToDate(this._viewLength); |
| 239 | }; |
| 240 | Timeline._Band.prototype.getMaxVisibleDateAfterDelta = function (A) { |
| 241 | return this._ether.pixelOffsetToDate(this._viewLength + A); |
| 242 | }; |
| 243 | Timeline._Band.prototype.getCenterVisibleDate = function () { |
| 244 | return this._ether.pixelOffsetToDate(this._viewLength / 2); |
| 245 | }; |
| 246 | Timeline._Band.prototype.setMinVisibleDate = function (A) { |
| 247 | if (!this._changing) { |
| 248 | this._moveEther(Math.round(-this._ether.dateToPixelOffset(A))); |
| 249 | } |
| 250 | }; |
| 251 | Timeline._Band.prototype.setMaxVisibleDate = function (A) { |
| 252 | if (!this._changing) { |
| 253 | this._moveEther(Math.round(this._viewLength - this._ether.dateToPixelOffset(A))); |
| 254 | } |
| 255 | }; |
| 256 | Timeline._Band.prototype.setCenterVisibleDate = function (A) { |
| 257 | if (!this._changing) { |
| 258 | this._moveEther(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(A))); |
| 259 | } |
| 260 | }; |
| 261 | Timeline._Band.prototype.dateToPixelOffset = function (A) { |
| 262 | return this._ether.dateToPixelOffset(A) - this._viewOffset; |
| 263 | }; |
| 264 | Timeline._Band.prototype.pixelOffsetToDate = function (A) { |
| 265 | return this._ether.pixelOffsetToDate(A + this._viewOffset); |
| 266 | }; |
| 267 | Timeline._Band.prototype.createLayerDiv = function (C, A) { |
| 268 | var D = this._timeline.getDocument().createElement("div"); |
| 269 | D.className = "timeline-band-layer" + (typeof A == "string" ? (" " + A) : ""); |
| 270 | D.style.zIndex = C; |
| 271 | this._innerDiv.appendChild(D); |
| 272 | var B = this._timeline.getDocument().createElement("div"); |
| 273 | B.className = "timeline-band-layer-inner"; |
| 274 | if (SimileAjax.Platform.browser.isIE) { |
| 275 | B.style.cursor = "move"; |
| 276 | } else { |
| 277 | B.style.cursor = "-moz-grab"; |
| 278 | } |
| 279 | D.appendChild(B); |
| 280 | return B; |
| 281 | }; |
| 282 | Timeline._Band.prototype.removeLayerDiv = function (A) { |
| 283 | this._innerDiv.removeChild(A.parentNode); |
| 284 | }; |
| 285 | Timeline._Band.prototype.scrollToCenter = function (A, C) { |
| 286 | var B = this._ether.dateToPixelOffset(A); |
| 287 | if (B < -this._viewLength / 2) { |
| 288 | this.setCenterVisibleDate(this.pixelOffsetToDate(B + this._viewLength)); |
| 289 | } else { |
| 290 | if (B > 3 * this._viewLength / 2) { |
| 291 | this.setCenterVisibleDate(this.pixelOffsetToDate(B - this._viewLength)); |
| 292 | } |
| 293 | } |
| 294 | this._autoScroll(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(A)), C); |
| 295 | }; |
| 296 | Timeline._Band.prototype.showBubbleForEvent = function (C) { |
| 297 | var A = this.getEventSource().getEvent(C); |
| 298 | if (A) { |
| 299 | var B = this; |
| 300 | this.scrollToCenter(A.getStart(), function () { |
| 301 | B._eventPainter.showBubble(A); |
| 302 | }); |
| 303 | } |
| 304 | }; |
| 305 | Timeline._Band.prototype.zoom = function (C, A, F, E) { |
| 306 | if (!this._zoomSteps) { |
| 307 | return; |
| 308 | } |
| 309 | A += this._viewOffset; |
| 310 | var D = this._ether.pixelOffsetToDate(A); |
| 311 | var B = this._ether.zoom(C); |
| 312 | this._etherPainter.zoom(B); |
| 313 | this._moveEther(Math.round(-this._ether.dateToPixelOffset(D))); |
| 314 | this._moveEther(A); |
| 315 | }; |
| 316 | Timeline._Band.prototype._onMouseDown = function (B, A, C) { |
| 317 | this.closeBubble(); |
| 318 | this._dragging = true; |
| 319 | this._dragX = A.clientX; |
| 320 | this._dragY = A.clientY; |
| 321 | }; |
| 322 | Timeline._Band.prototype._onMouseMove = function (D, A, E) { |
| 323 | if (this._dragging) { |
| 324 | var C = A.clientX - this._dragX; |
| 325 | var B = A.clientY - this._dragY; |
| 326 | this._dragX = A.clientX; |
| 327 | this._dragY = A.clientY; |
| 328 | this._moveEther(this._timeline.isHorizontal() ? C : B); |
| 329 | this._positionHighlight(); |
| 330 | } |
| 331 | }; |
| 332 | Timeline._Band.prototype._onMouseUp = function (B, A, C) { |
| 333 | this._dragging = false; |
| 334 | this._keyboardInput.focus(); |
| 335 | }; |
| 336 | Timeline._Band.prototype._onMouseOut = function (C, B, D) { |
| 337 | var A = SimileAjax.DOM.getEventRelativeCoordinates(B, C); |
| 338 | A.x += this._viewOffset; |
| 339 | if (A.x < 0 || A.x > C.offsetWidth || A.y < 0 || A.y > C.offsetHeight) { |
| 340 | this._dragging = false; |
| 341 | } |
| 342 | }; |
| 343 | Timeline._Band.prototype._onMouseScroll = function (G, H, B) { |
| 344 | var A = new Date(); |
| 345 | A = A.getTime(); |
| 346 | if (!this._lastScrollTime || ((A - this._lastScrollTime) > 50)) { |
| 347 | this._lastScrollTime = A; |
| 348 | var I = 0; |
| 349 | if (H.wheelDelta) { |
| 350 | I = H.wheelDelta / 120; |
| 351 | } else { |
| 352 | if (H.detail) { |
| 353 | I = -H.detail / 3; |
| 354 | } |
| 355 | } |
| 356 | var F = this._theme.mouseWheel; |
| 357 | if (this._zoomSteps || F === "zoom") { |
| 358 | var E = SimileAjax.DOM.getEventRelativeCoordinates(H, G); |
| 359 | if (I != 0) { |
| 360 | var D; |
| 361 | if (I > 0) { |
| 362 | D = true; |
| 363 | } |
| 364 | if (I < 0) { |
| 365 | D = false; |
| 366 | } |
| 367 | this._timeline.zoom(D, E.x, E.y, G); |
| 368 | } |
| 369 | } else { |
| 370 | if (F === "scroll") { |
| 371 | var C = 50 * (I < 0 ? -1 : 1); |
| 372 | this._moveEther(C); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | if (H.stopPropagation) { |
| 377 | H.stopPropagation(); |
| 378 | } |
| 379 | H.cancelBubble = true; |
| 380 | if (H.preventDefault) { |
| 381 | H.preventDefault(); |
| 382 | } |
| 383 | H.returnValue = false; |
| 384 | }; |
| 385 | Timeline._Band.prototype._onDblClick = function (C, B, E) { |
| 386 | var A = SimileAjax.DOM.getEventRelativeCoordinates(B, C); |
| 387 | var D = A.x - (this._viewLength / 2 - this._viewOffset); |
| 388 | this._autoScroll(-D); |
| 389 | }; |
| 390 | Timeline._Band.prototype._onKeyDown = function (B, A, C) { |
| 391 | if (!this._dragging) { |
| 392 | switch (A.keyCode) { |
| 393 | case 27: |
| 394 | break; |
| 395 | case 37: |
| 396 | case 38: |
| 397 | this._scrollSpeed = Math.min(50, Math.abs(this._scrollSpeed * 1.05)); |
| 398 | this._moveEther(this._scrollSpeed); |
| 399 | break; |
| 400 | case 39: |
| 401 | case 40: |
| 402 | this._scrollSpeed = -Math.min(50, Math.abs(this._scrollSpeed * 1.05)); |
| 403 | this._moveEther(this._scrollSpeed); |
| 404 | break; |
| 405 | default: |
| 406 | return true; |
| 407 | } |
| 408 | this.closeBubble(); |
| 409 | SimileAjax.DOM.cancelEvent(A); |
| 410 | return false; |
| 411 | } |
| 412 | return true; |
| 413 | }; |
| 414 | Timeline._Band.prototype._onKeyUp = function (B, A, C) { |
| 415 | if (!this._dragging) { |
| 416 | this._scrollSpeed = this._originalScrollSpeed; |
| 417 | switch (A.keyCode) { |
| 418 | case 35: |
| 419 | this.setCenterVisibleDate(this._eventSource.getLatestDate()); |
| 420 | break; |
| 421 | case 36: |
| 422 | this.setCenterVisibleDate(this._eventSource.getEarliestDate()); |
| 423 | break; |
| 424 | case 33: |
| 425 | this._autoScroll(this._timeline.getPixelLength()); |
| 426 | break; |
| 427 | case 34: |
| 428 | this._autoScroll(-this._timeline.getPixelLength()); |
| 429 | break; |
| 430 | default: |
| 431 | return true; |
| 432 | } |
| 433 | this.closeBubble(); |
| 434 | SimileAjax.DOM.cancelEvent(A); |
| 435 | return false; |
| 436 | } |
| 437 | return true; |
| 438 | }; |
| 439 | Timeline._Band.prototype._autoScroll = function (D, C) { |
| 440 | var A = this; |
| 441 | var B = SimileAjax.Graphics.createAnimation(function (E, F) { |
| 442 | A._moveEther(F); |
| 443 | }, 0, D, 1000, C); |
| 444 | B.run(); |
| 445 | }; |
| 446 | Timeline._Band.prototype._moveEther = function (A) { |
| 447 | this.closeBubble(); |
| 448 | if (!this._timeline.shiftOK(this._index, A)) { |
| 449 | return; |
| 450 | } |
| 451 | this._viewOffset += A; |
| 452 | this._ether.shiftPixels(-A); |
| 453 | if (this._timeline.isHorizontal()) { |
| 454 | this._div.style.left = this._viewOffset + "px"; |
| 455 | } else { |
| 456 | this._div.style.top = this._viewOffset + "px"; |
| 457 | } |
| 458 | if (this._viewOffset > -this._viewLength * 0.5 || this._viewOffset < -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1.5)) { |
| 459 | this._recenterDiv(); |
| 460 | } else { |
| 461 | this.softLayout(); |
| 462 | } |
| 463 | this._onChanging(); |
| 464 | }; |
| 465 | Timeline._Band.prototype._onChanging = function () { |
| 466 | this._changing = true; |
| 467 | this._fireOnScroll(); |
| 468 | this._setSyncWithBandDate(); |
| 469 | this._changing = false; |
| 470 | }; |
| 471 | Timeline._Band.prototype.busy = function () { |
| 472 | return (this._changing); |
| 473 | }; |
| 474 | Timeline._Band.prototype._fireOnScroll = function () { |
| 475 | for (var A = 0; |
| 476 | A < this._onScrollListeners.length; |
| 477 | A++) { |
| 478 | this._onScrollListeners[A](this); |
| 479 | } |
| 480 | }; |
| 481 | Timeline._Band.prototype._setSyncWithBandDate = function () { |
| 482 | if (this._syncWithBand) { |
| 483 | var A = this._ether.pixelOffsetToDate(this.getViewLength() / 2); |
| 484 | this._syncWithBand.setCenterVisibleDate(A); |
| 485 | } |
| 486 | }; |
| 487 | Timeline._Band.prototype._onHighlightBandScroll = function () { |
| 488 | if (this._syncWithBand) { |
| 489 | var A = this._syncWithBand.getCenterVisibleDate(); |
| 490 | var B = this._ether.dateToPixelOffset(A); |
| 491 | this._moveEther(Math.round(this._viewLength / 2 - B)); |
| 492 | if (this._highlight) { |
| 493 | this._etherPainter.setHighlight(this._syncWithBand.getMinVisibleDate(), this._syncWithBand.getMaxVisibleDate()); |
| 494 | } |
| 495 | } |
| 496 | }; |
| 497 | Timeline._Band.prototype._onAddMany = function () { |
| 498 | this._paintEvents(); |
| 499 | }; |
| 500 | Timeline._Band.prototype._onClear = function () { |
| 501 | this._paintEvents(); |
| 502 | }; |
| 503 | Timeline._Band.prototype._positionHighlight = function () { |
| 504 | if (this._syncWithBand) { |
| 505 | var A = this._syncWithBand.getMinVisibleDate(); |
| 506 | var B = this._syncWithBand.getMaxVisibleDate(); |
| 507 | if (this._highlight) { |
| 508 | this._etherPainter.setHighlight(A, B); |
| 509 | } |
| 510 | } |
| 511 | }; |
| 512 | Timeline._Band.prototype._recenterDiv = function () { |
| 513 | this._viewOffset = -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1) / 2; |
| 514 | if (this._timeline.isHorizontal()) { |
| 515 | this._div.style.left = this._viewOffset + "px"; |
| 516 | this._div.style.width = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px"; |
| 517 | } else { |
| 518 | this._div.style.top = this._viewOffset + "px"; |
| 519 | this._div.style.height = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px"; |
| 520 | } |
| 521 | this.layout(); |
| 522 | }; |
| 523 | Timeline._Band.prototype._paintEvents = function () { |
| 524 | this._eventPainter.paint(); |
| 525 | }; |
| 526 | Timeline._Band.prototype._softPaintEvents = function () { |
| 527 | this._eventPainter.softPaint(); |
| 528 | }; |
| 529 | Timeline._Band.prototype._paintDecorators = function () { |
| 530 | for (var A = 0; |
| 531 | A < this._decorators.length; |
| 532 | A++) { |
| 533 | this._decorators[A].paint(); |
| 534 | } |
| 535 | }; |
| 536 | Timeline._Band.prototype._softPaintDecorators = function () { |
| 537 | for (var A = 0; |
| 538 | A < this._decorators.length; |
| 539 | A++) { |
| 540 | this._decorators[A].softPaint(); |
| 541 | } |
| 542 | }; |
| 543 | Timeline._Band.prototype.closeBubble = function () { |
| 544 | SimileAjax.WindowManager.cancelPopups(); |
360 | | Timeline.CompactEventPainter=function(A){this._params=A; |
361 | | this._onSelectListeners=[]; |
362 | | this._filterMatcher=null; |
363 | | this._highlightMatcher=null; |
364 | | this._frc=null; |
365 | | this._eventIdToElmt={}; |
366 | | }; |
367 | | Timeline.CompactEventPainter.prototype.initialize=function(B,A){this._band=B; |
368 | | this._timeline=A; |
369 | | this._backLayer=null; |
370 | | this._eventLayer=null; |
371 | | this._lineLayer=null; |
372 | | this._highlightLayer=null; |
373 | | this._eventIdToElmt=null; |
374 | | }; |
375 | | Timeline.CompactEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); |
376 | | }; |
377 | | Timeline.CompactEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; |
378 | | A<this._onSelectListeners.length; |
379 | | A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); |
380 | | break; |
381 | | }}}; |
382 | | Timeline.CompactEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; |
383 | | }; |
384 | | Timeline.CompactEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; |
385 | | }; |
386 | | Timeline.CompactEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; |
387 | | }; |
388 | | Timeline.CompactEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; |
389 | | }; |
390 | | Timeline.CompactEventPainter.prototype.paint=function(){var N=this._band.getEventSource(); |
391 | | if(N==null){return ; |
392 | | }this._eventIdToElmt={}; |
393 | | this._prepareForPainting(); |
394 | | var O=this._params.theme; |
395 | | var L=O.event; |
396 | | var G={trackOffset:"trackOffset" in this._params?this._params.trackOffset:10,trackHeight:"trackHeight" in this._params?this._params.trackHeight:10,tapeHeight:O.event.tape.height,tapeBottomMargin:"tapeBottomMargin" in this._params?this._params.tapeBottomMargin:2,labelBottomMargin:"labelBottomMargin" in this._params?this._params.labelBottomMargin:5,labelRightMargin:"labelRightMargin" in this._params?this._params.labelRightMargin:5,defaultIcon:L.instant.icon,defaultIconWidth:L.instant.iconWidth,defaultIconHeight:L.instant.iconHeight,customIconWidth:"iconWidth" in this._params?this._params.iconWidth:L.instant.iconWidth,customIconHeight:"iconHeight" in this._params?this._params.iconHeight:L.instant.iconHeight,iconLabelGap:"iconLabelGap" in this._params?this._params.iconLabelGap:2,iconBottomMargin:"iconBottomMargin" in this._params?this._params.iconBottomMargin:2}; |
397 | | if("compositeIcon" in this._params){G.compositeIcon=this._params.compositeIcon; |
398 | | G.compositeIconWidth=this._params.compositeIconWidth||G.customIconWidth; |
399 | | G.compositeIconHeight=this._params.compositeIconHeight||G.customIconHeight; |
400 | | }else{G.compositeIcon=G.defaultIcon; |
401 | | G.compositeIconWidth=G.defaultIconWidth; |
402 | | G.compositeIconHeight=G.defaultIconHeight; |
403 | | }G.defaultStackIcon="icon" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.icon:G.defaultIcon; |
404 | | G.defaultStackIconWidth="iconWidth" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.iconWidth:G.defaultIconWidth; |
405 | | G.defaultStackIconHeight="iconHeight" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.iconHeight:G.defaultIconHeight; |
406 | | var B=this._band.getMinDate(); |
407 | | var D=this._band.getMaxDate(); |
408 | | var R=(this._filterMatcher!=null)?this._filterMatcher:function(S){return true; |
409 | | }; |
410 | | var Q=(this._highlightMatcher!=null)?this._highlightMatcher:function(S){return -1; |
411 | | }; |
412 | | var F=N.getEventIterator(B,D); |
413 | | var H="stackConcurrentPreciseInstantEvents" in this._params&&typeof this._params.stackConcurrentPreciseInstantEvents=="object"; |
414 | | var P="collapseConcurrentPreciseInstantEvents" in this._params&&this._params.collapseConcurrentPreciseInstantEvents; |
415 | | if(P||H){var M=[]; |
416 | | var A=null; |
417 | | while(F.hasNext()){var E=F.next(); |
418 | | if(R(E)){if(!E.isInstant()||E.isImprecise()){this.paintEvent(E,G,this._params.theme,Q(E)); |
419 | | }else{if(A!=null&&A.getStart().getTime()==E.getStart().getTime()){M[M.length-1].push(E); |
420 | | }else{M.push([E]); |
421 | | A=E; |
422 | | }}}}for(var J=0; |
423 | | J<M.length; |
424 | | J++){var K=M[J]; |
425 | | if(K.length==1){this.paintEvent(K[0],G,this._params.theme,Q(E)); |
426 | | }else{var C=-1; |
427 | | for(var I=0; |
428 | | C<0&&I<K.length; |
429 | | I++){C=Q(K[I]); |
430 | | }if(H){this.paintStackedPreciseInstantEvents(K,G,this._params.theme,C); |
431 | | }else{this.paintCompositePreciseInstantEvents(K,G,this._params.theme,C); |
432 | | }}}}else{while(F.hasNext()){var E=F.next(); |
433 | | if(R(E)){this.paintEvent(E,G,this._params.theme,Q(E)); |
434 | | }}}this._highlightLayer.style.display="block"; |
435 | | this._lineLayer.style.display="block"; |
436 | | this._eventLayer.style.display="block"; |
437 | | }; |
438 | | Timeline.CompactEventPainter.prototype.softPaint=function(){}; |
439 | | Timeline.CompactEventPainter.prototype._prepareForPainting=function(){var B=this._band; |
440 | | if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); |
441 | | this._backLayer.style.visibility="hidden"; |
442 | | var A=document.createElement("span"); |
443 | | A.className="timeline-event-label"; |
444 | | this._backLayer.appendChild(A); |
445 | | this._frc=SimileAjax.Graphics.getFontRenderingContext(A); |
446 | | }this._frc.update(); |
447 | | this._tracks=[]; |
448 | | if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); |
449 | | }this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); |
450 | | this._highlightLayer.style.display="none"; |
451 | | if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); |
452 | | }this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); |
453 | | this._lineLayer.style.display="none"; |
454 | | if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); |
455 | | }this._eventLayer=B.createLayerDiv(115,"timeline-band-events"); |
456 | | this._eventLayer.style.display="none"; |
457 | | }; |
458 | | Timeline.CompactEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); |
459 | | }else{this.paintDurationEvent(B,C,D,A); |
460 | | }}; |
461 | | Timeline.CompactEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); |
462 | | }else{this.paintPreciseInstantEvent(B,C,D,A); |
463 | | }}; |
464 | | Timeline.CompactEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); |
465 | | }else{this.paintPreciseDurationEvent(B,C,D,A); |
466 | | }}; |
467 | | Timeline.CompactEventPainter.prototype.paintPreciseInstantEvent=function(H,F,B,A){var C={tooltip:H.getProperty("tooltip")||H.getText()}; |
468 | | var E={url:H.getIcon()}; |
469 | | if(E.url==null){E.url=F.defaultIcon; |
470 | | E.width=F.defaultIconWidth; |
471 | | E.height=F.defaultIconHeight; |
472 | | E.className="timeline-event-icon-default"; |
473 | | }else{E.width=H.getProperty("iconWidth")||F.customIconWidth; |
474 | | E.height=H.getProperty("iconHeight")||F.customIconHeight; |
475 | | }var J={text:H.getText(),color:H.getTextColor()||H.getColor(),className:H.getClassName()}; |
476 | | var G=this.paintTapeIconLabel(H.getStart(),C,null,E,J,F,B,A); |
477 | | var I=this; |
478 | | var D=function(L,K,M){return I._onClickInstantEvent(G.iconElmtData.elmt,K,H); |
479 | | }; |
480 | | SimileAjax.DOM.registerEvent(G.iconElmtData.elmt,"mousedown",D); |
481 | | SimileAjax.DOM.registerEvent(G.labelElmtData.elmt,"mousedown",D); |
482 | | this._eventIdToElmt[H.getID()]=G.iconElmtData.elmt; |
483 | | }; |
484 | | Timeline.CompactEventPainter.prototype.paintCompositePreciseInstantEvents=function(J,H,D,B){var K=J[0]; |
485 | | var A=[]; |
486 | | for(var C=0; |
487 | | C<J.length; |
488 | | C++){A.push(J[C].getProperty("tooltip")||J[C].getText()); |
489 | | }var E={tooltip:A.join("; ")}; |
490 | | var G={url:H.compositeIcon,width:H.compositeIconWidth,height:H.compositeIconHeight,className:"timeline-event-icon-composite"}; |
491 | | var M={text:String.substitute(this._params.compositeEventLabelTemplate,[J.length])}; |
492 | | var I=this.paintTapeIconLabel(K.getStart(),E,null,G,M,H,D,B); |
493 | | var L=this; |
494 | | var F=function(O,N,P){return L._onClickMultiplePreciseInstantEvent(I.iconElmtData.elmt,N,J); |
495 | | }; |
496 | | SimileAjax.DOM.registerEvent(I.iconElmtData.elmt,"mousedown",F); |
497 | | SimileAjax.DOM.registerEvent(I.labelElmtData.elmt,"mousedown",F); |
498 | | for(var C=0; |
499 | | C<J.length; |
500 | | C++){this._eventIdToElmt[J[C].getID()]=I.iconElmtData.elmt; |
501 | | }}; |
502 | | Timeline.CompactEventPainter.prototype.paintStackedPreciseInstantEvents=function(T,j,c,E){var S="limit" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.limit:10; |
503 | | var G="moreMessageTemplate" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.moreMessageTemplate:"%0 More Events"; |
504 | | var Q=S<=T.length-2; |
505 | | var B=this._band; |
506 | | var L=function(i){return Math.round(B.dateToPixelOffset(i)); |
507 | | }; |
508 | | var O=function(i){var r={url:i.getIcon()}; |
509 | | if(r.url==null){r.url=j.defaultStackIcon; |
510 | | r.width=j.defaultStackIconWidth; |
511 | | r.height=j.defaultStackIconHeight; |
512 | | r.className="timeline-event-icon-stack timeline-event-icon-default"; |
513 | | }else{r.width=i.getProperty("iconWidth")||j.customIconWidth; |
514 | | r.height=i.getProperty("iconHeight")||j.customIconHeight; |
515 | | r.className="timeline-event-icon-stack"; |
516 | | }return r; |
517 | | }; |
518 | | var C=O(T[0]); |
519 | | var V=5; |
520 | | var D=0; |
521 | | var g=0; |
522 | | var p=0; |
523 | | var U=0; |
524 | | var l=[]; |
525 | | for(var n=0; |
526 | | n<T.length&&(!Q||n<S); |
527 | | n++){var b=T[n]; |
528 | | var a=b.getText(); |
529 | | var X=O(b); |
530 | | var W=this._frc.computeSize(a); |
531 | | var K={text:a,iconData:X,labelSize:W,iconLeft:C.width+n*V-X.width}; |
532 | | K.labelLeft=C.width+n*V+j.iconLabelGap; |
533 | | K.top=p; |
534 | | l.push(K); |
535 | | D=Math.min(D,K.iconLeft); |
536 | | p+=W.height; |
537 | | g=Math.max(g,K.labelLeft+W.width); |
538 | | U=Math.max(U,K.top+X.height); |
539 | | }if(Q){var e=String.substitute(G,[T.length-S]); |
540 | | var H=this._frc.computeSize(e); |
541 | | var J=C.width+(S-1)*V+j.iconLabelGap; |
542 | | var m=p; |
543 | | p+=H.height; |
544 | | g=Math.max(g,J+H.width); |
545 | | }g+=j.labelRightMargin; |
546 | | p+=j.labelBottomMargin; |
547 | | U+=j.iconBottomMargin; |
548 | | var F=L(T[0].getStart()); |
549 | | var Y=[]; |
550 | | var N=Math.ceil(Math.max(U,p)/j.trackHeight); |
551 | | var M=C.width+(T.length-1)*V; |
552 | | for(var n=0; |
553 | | n<N; |
554 | | n++){Y.push({start:D,end:M}); |
555 | | }var f=Math.ceil(p/j.trackHeight); |
556 | | for(var n=0; |
557 | | n<f; |
558 | | n++){var P=Y[n]; |
559 | | P.end=Math.max(P.end,g); |
560 | | }var k=this._fitTracks(F,Y); |
561 | | var Z=k*j.trackHeight+j.trackOffset; |
562 | | var q=this._timeline.getDocument().createElement("div"); |
563 | | q.className="timeline-event-icon-stack"; |
564 | | q.style.position="absolute"; |
565 | | q.style.overflow="visible"; |
566 | | q.style.left=F+"px"; |
567 | | q.style.top=Z+"px"; |
568 | | q.style.width=M+"px"; |
569 | | q.style.height=U+"px"; |
570 | | q.innerHTML="<div style='position: relative'></div>"; |
571 | | this._eventLayer.appendChild(q); |
572 | | var I=this; |
573 | | var R=function(r){try{var w=parseInt(this.getAttribute("index")); |
574 | | var u=q.firstChild.childNodes; |
575 | | for(var s=0; |
576 | | s<u.length; |
577 | | s++){var v=u[s]; |
578 | | if(s==w){v.style.zIndex=u.length; |
579 | | }else{v.style.zIndex=u.length-s; |
580 | | }}}catch(t){}}; |
581 | | var d=function(u){var w=l[u]; |
582 | | var r=T[u]; |
583 | | var i=r.getProperty("tooltip")||r.getText(); |
584 | | var v=I._paintEventLabel({tooltip:i},{text:w.text},F+w.labelLeft,Z+w.top,w.labelSize.width,w.labelSize.height,c); |
585 | | v.elmt.setAttribute("index",u); |
586 | | v.elmt.onmouseover=R; |
587 | | var t=SimileAjax.Graphics.createTranslucentImage(w.iconData.url); |
588 | | var s=I._timeline.getDocument().createElement("div"); |
589 | | s.className="timeline-event-icon"+("className" in w.iconData?(" "+w.iconData.className):""); |
590 | | s.style.left=w.iconLeft+"px"; |
591 | | s.style.top=w.top+"px"; |
592 | | s.style.zIndex=(l.length-u); |
593 | | s.appendChild(t); |
594 | | s.setAttribute("index",u); |
595 | | s.onmouseover=R; |
596 | | q.firstChild.appendChild(s); |
597 | | var x=function(z,y,AA){return I._onClickInstantEvent(v.elmt,y,r); |
598 | | }; |
599 | | SimileAjax.DOM.registerEvent(s,"mousedown",x); |
600 | | SimileAjax.DOM.registerEvent(v.elmt,"mousedown",x); |
601 | | I._eventIdToElmt[r.getID()]=s; |
602 | | }; |
603 | | for(var n=0; |
604 | | n<l.length; |
605 | | n++){d(n); |
606 | | }if(Q){var o=T.slice(S); |
607 | | var A=this._paintEventLabel({tooltip:e},{text:e},F+J,Z+m,H.width,H.height,c); |
608 | | var h=function(r,i,s){return I._onClickMultiplePreciseInstantEvent(A.elmt,i,o); |
609 | | }; |
610 | | SimileAjax.DOM.registerEvent(A.elmt,"mousedown",h); |
611 | | for(var n=0; |
612 | | n<o.length; |
613 | | n++){this._eventIdToElmt[o[n].getID()]=A.elmt; |
614 | | }}}; |
615 | | Timeline.CompactEventPainter.prototype.paintImpreciseInstantEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; |
616 | | var E={start:I.getStart(),end:I.getEnd(),latestStart:I.getLatestStart(),earliestEnd:I.getEarliestEnd(),isInstant:true}; |
617 | | var F={url:I.getIcon()}; |
618 | | if(F.url==null){F=null; |
619 | | }else{F.width=I.getProperty("iconWidth")||G.customIconWidth; |
620 | | F.height=I.getProperty("iconHeight")||G.customIconHeight; |
621 | | }var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; |
622 | | var H=this.paintTapeIconLabel(I.getStart(),C,E,F,K,G,B,A); |
623 | | var J=this; |
624 | | var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); |
625 | | }:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); |
626 | | }; |
627 | | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); |
628 | | SimileAjax.DOM.registerEvent(H.impreciseTapeElmtData.elmt,"mousedown",D); |
629 | | if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); |
630 | | this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; |
631 | | }else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; |
632 | | }}; |
633 | | Timeline.CompactEventPainter.prototype.paintPreciseDurationEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; |
634 | | var E={start:I.getStart(),end:I.getEnd(),isInstant:false}; |
635 | | var F={url:I.getIcon()}; |
636 | | if(F.url==null){F=null; |
637 | | }else{F.width=I.getProperty("iconWidth")||G.customIconWidth; |
638 | | F.height=I.getProperty("iconHeight")||G.customIconHeight; |
639 | | }var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; |
640 | | var H=this.paintTapeIconLabel(I.getLatestStart(),C,E,F,K,G,B,A); |
641 | | var J=this; |
642 | | var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); |
643 | | }:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); |
644 | | }; |
645 | | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); |
646 | | SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt,"mousedown",D); |
647 | | if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); |
648 | | this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; |
649 | | }else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; |
650 | | }}; |
651 | | Timeline.CompactEventPainter.prototype.paintImpreciseDurationEvent=function(I,G,B,A){var C={tooltip:I.getProperty("tooltip")||I.getText()}; |
652 | | var E={start:I.getStart(),end:I.getEnd(),latestStart:I.getLatestStart(),earliestEnd:I.getEarliestEnd(),isInstant:false}; |
653 | | var F={url:I.getIcon()}; |
654 | | if(F.url==null){F=null; |
655 | | }else{F.width=I.getProperty("iconWidth")||G.customIconWidth; |
656 | | F.height=I.getProperty("iconHeight")||G.customIconHeight; |
657 | | }var K={text:I.getText(),color:I.getTextColor()||I.getColor(),className:I.getClassName()}; |
658 | | var H=this.paintTapeIconLabel(I.getLatestStart(),C,E,F,K,G,B,A); |
659 | | var J=this; |
660 | | var D=F!=null?function(M,L,N){return J._onClickInstantEvent(H.iconElmtData.elmt,L,I); |
661 | | }:function(M,L,N){return J._onClickInstantEvent(H.labelElmtData.elmt,L,I); |
662 | | }; |
663 | | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt,"mousedown",D); |
664 | | SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt,"mousedown",D); |
665 | | if(F!=null){SimileAjax.DOM.registerEvent(H.iconElmtData.elmt,"mousedown",D); |
666 | | this._eventIdToElmt[I.getID()]=H.iconElmtData.elmt; |
667 | | }else{this._eventIdToElmt[I.getID()]=H.labelElmtData.elmt; |
668 | | }}; |
669 | | Timeline.CompactEventPainter.prototype.paintTapeIconLabel=function(V,O,S,I,a,X,c,Z){var R=this._band; |
670 | | var F=function(e){return Math.round(R.dateToPixelOffset(e)); |
671 | | }; |
672 | | var d=F(V); |
673 | | var W=[]; |
674 | | var b=0; |
675 | | var B=0; |
676 | | var C=0; |
677 | | if(S!=null){b=X.tapeHeight+X.tapeBottomMargin; |
678 | | B=Math.ceil(X.tapeHeight/X.trackHeight); |
679 | | var A=F(S.end)-d; |
680 | | var L=F(S.start)-d; |
681 | | for(var Q=0; |
682 | | Q<B; |
683 | | Q++){W.push({start:L,end:A}); |
684 | | }C=X.trackHeight-(b%X.tapeHeight); |
685 | | }var N=0; |
686 | | var U=0; |
687 | | if(I!=null){if("iconAlign" in I&&I.iconAlign=="center"){N=-Math.floor(I.width/2); |
688 | | }U=N+I.width+X.iconLabelGap; |
689 | | if(B>0){W[B-1].end=Math.max(W[B-1].end,U); |
690 | | }var E=I.height+X.iconBottomMargin+C; |
691 | | while(E>0){W.push({start:N,end:U}); |
692 | | E-=X.trackHeight; |
693 | | }}var P=a.text; |
694 | | var H=this._frc.computeSize(P); |
695 | | var M=H.height+X.labelBottomMargin+C; |
696 | | var J=U+H.width+X.labelRightMargin; |
697 | | if(B>0){W[B-1].end=Math.max(W[B-1].end,J); |
698 | | }for(var Y=0; |
699 | | M>0; |
700 | | Y++){if(B+Y<W.length){var T=W[B+Y]; |
701 | | T.end=J; |
702 | | }else{W.push({start:0,end:J}); |
703 | | }M-=X.trackHeight; |
704 | | }var G=this._fitTracks(d,W); |
705 | | var K=G*X.trackHeight+X.trackOffset; |
706 | | var D={}; |
707 | | D.labelElmtData=this._paintEventLabel(O,a,d+U,K+b,H.width,H.height,c); |
708 | | if(S!=null){if("latestStart" in S||"earliestEnd" in S){D.impreciseTapeElmtData=this._paintEventTape(O,S,X.tapeHeight,K,F(S.start),F(S.end),c.event.duration.impreciseColor,c.event.duration.impreciseOpacity,X,c); |
709 | | }if(!S.isInstant&&"start" in S&&"end" in S){D.tapeElmtData=this._paintEventTape(O,S,X.tapeHeight,K,d,F("earliestEnd" in S?S.earliestEnd:S.end),S.color,100,X,c); |
710 | | }}if(I!=null){D.iconElmtData=this._paintEventIcon(O,I,K+b,d+N,X,c); |
711 | | }return D; |
712 | | }; |
713 | | Timeline.CompactEventPainter.prototype._fitTracks=function(F,C){var H; |
714 | | for(H=0; |
715 | | H<this._tracks.length; |
716 | | H++){var E=true; |
717 | | for(var B=0; |
718 | | B<C.length&&(H+B)<this._tracks.length; |
719 | | B++){var G=this._tracks[H+B]; |
720 | | var A=C[B]; |
721 | | if(F+A.start<G){E=false; |
722 | | break; |
723 | | }}if(E){break; |
724 | | }}for(var D=0; |
725 | | D<C.length; |
726 | | D++){this._tracks[H+D]=F+C[D].end; |
727 | | }return H; |
728 | | }; |
729 | | Timeline.CompactEventPainter.prototype._paintEventIcon=function(C,D,H,G,E,F){var B=SimileAjax.Graphics.createTranslucentImage(D.url); |
730 | | var A=this._timeline.getDocument().createElement("div"); |
731 | | A.className="timeline-event-icon"+("className" in D?(" "+D.className):""); |
732 | | A.style.left=G+"px"; |
733 | | A.style.top=H+"px"; |
734 | | A.appendChild(B); |
735 | | if("tooltip" in C&&typeof C.tooltip=="string"){A.title=C.tooltip; |
736 | | }this._eventLayer.appendChild(A); |
737 | | return{left:G,top:H,width:E.iconWidth,height:E.iconHeight,elmt:A}; |
738 | | }; |
739 | | Timeline.CompactEventPainter.prototype._paintEventLabel=function(E,I,C,F,A,G,D){var H=this._timeline.getDocument(); |
740 | | var B=H.createElement("div"); |
741 | | B.className="timeline-event-label"; |
742 | | B.style.left=C+"px"; |
743 | | B.style.width=(A+1)+"px"; |
744 | | B.style.top=F+"px"; |
745 | | B.innerHTML=I.text; |
746 | | if("tooltip" in E&&typeof E.tooltip=="string"){B.title=E.tooltip; |
747 | | }if("color" in I&&typeof I.color=="string"){B.style.color=I.color; |
748 | | }if("className" in I&&typeof I.className=="string"){B.className+=" "+I.className; |
749 | | }this._eventLayer.appendChild(B); |
750 | | return{left:C,top:F,width:A,height:G,elmt:B}; |
751 | | }; |
752 | | Timeline.CompactEventPainter.prototype._paintEventTape=function(G,H,K,J,D,A,E,C,I,F){var B=A-D; |
753 | | var L=this._timeline.getDocument().createElement("div"); |
754 | | L.className="timeline-event-tape"; |
755 | | L.style.left=D+"px"; |
756 | | L.style.top=J+"px"; |
757 | | L.style.width=B+"px"; |
758 | | L.style.height=K+"px"; |
759 | | if("tooltip" in G&&typeof G.tooltip=="string"){L.title=G.tooltip; |
760 | | }if(E!=null&&typeof H.color=="string"){L.style.backgroundColor=E; |
761 | | }if("backgroundImage" in H&&typeof H.backgroundImage=="string"){L.style.backgroundImage="url("+backgroundImage+")"; |
762 | | L.style.backgroundRepeat=("backgroundRepeat" in H&&typeof H.backgroundRepeat=="string")?H.backgroundRepeat:"repeat"; |
763 | | }SimileAjax.Graphics.setOpacity(L,C); |
764 | | if("className" in H&&typeof H.className=="string"){L.className+=" "+H.className; |
765 | | }this._eventLayer.appendChild(L); |
766 | | return{left:D,top:J,width:B,height:K,elmt:L}; |
767 | | }; |
768 | | Timeline.CompactEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); |
769 | | var G=E.event; |
770 | | var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; |
771 | | var F=D.createElement("div"); |
772 | | F.style.position="absolute"; |
773 | | F.style.overflow="hidden"; |
774 | | F.style.left=(C.left-2)+"px"; |
775 | | F.style.width=(C.width+4)+"px"; |
776 | | F.style.top=(C.top-2)+"px"; |
777 | | F.style.height=(C.height+4)+"px"; |
778 | | this._highlightLayer.appendChild(F); |
779 | | }}; |
780 | | Timeline.CompactEventPainter.prototype._onClickMultiplePreciseInstantEvent=function(E,A,B){var F=SimileAjax.DOM.getPageCoordinates(E); |
781 | | this._showBubble(F.left+Math.ceil(E.offsetWidth/2),F.top+Math.ceil(E.offsetHeight/2),B); |
782 | | var D=[]; |
783 | | for(var C=0; |
784 | | C<B.length; |
785 | | C++){D.push(B[C].getID()); |
786 | | }this._fireOnSelect(D); |
787 | | A.cancelBubble=true; |
788 | | SimileAjax.DOM.cancelEvent(A); |
789 | | return false; |
790 | | }; |
791 | | Timeline.CompactEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); |
792 | | this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),[B]); |
793 | | this._fireOnSelect([B.getID()]); |
794 | | A.cancelBubble=true; |
795 | | SimileAjax.DOM.cancelEvent(A); |
796 | | return false; |
797 | | }; |
798 | | Timeline.CompactEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; |
799 | | var E=B.pageY; |
800 | | }else{var D=SimileAjax.DOM.getPageCoordinates(F); |
801 | | var A=B.offsetX+D.left; |
802 | | var E=B.offsetY+D.top; |
803 | | }this._showBubble(A,E,[C]); |
804 | | this._fireOnSelect([C.getID()]); |
805 | | B.cancelBubble=true; |
806 | | SimileAjax.DOM.cancelEvent(B); |
807 | | return false; |
808 | | }; |
809 | | Timeline.CompactEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; |
810 | | if(B){var C=SimileAjax.DOM.getPageCoordinates(B); |
811 | | this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,[A]); |
812 | | }}; |
813 | | Timeline.CompactEventPainter.prototype._showBubble=function(A,F,B){var E=document.createElement("div"); |
814 | | B=("fillInfoBubble" in B)?[B]:B; |
815 | | for(var D=0; |
816 | | D<B.length; |
817 | | D++){var C=document.createElement("div"); |
818 | | E.appendChild(C); |
819 | | B[D].fillInfoBubble(C,this._params.theme,this._band.getLabeller()); |
820 | | }SimileAjax.WindowManager.cancelPopups(); |
821 | | SimileAjax.Graphics.createBubbleForContentAndPoint(E,A,F,this._params.theme.event.bubble.width); |
822 | | }; |
823 | | Timeline.CompactEventPainter.prototype._fireOnSelect=function(B){for(var A=0; |
824 | | A<this._onSelectListeners.length; |
825 | | A++){this._onSelectListeners[A](B); |
826 | | }}; |
| 549 | Timeline.CompactEventPainter = function (A) { |
| 550 | this._params = A; |
| 551 | this._onSelectListeners = []; |
| 552 | this._filterMatcher = null; |
| 553 | this._highlightMatcher = null; |
| 554 | this._frc = null; |
| 555 | this._eventIdToElmt = {}; |
| 556 | }; |
| 557 | Timeline.CompactEventPainter.prototype.initialize = function (B, A) { |
| 558 | this._band = B; |
| 559 | this._timeline = A; |
| 560 | this._backLayer = null; |
| 561 | this._eventLayer = null; |
| 562 | this._lineLayer = null; |
| 563 | this._highlightLayer = null; |
| 564 | this._eventIdToElmt = null; |
| 565 | }; |
| 566 | Timeline.CompactEventPainter.prototype.addOnSelectListener = function (A) { |
| 567 | this._onSelectListeners.push(A); |
| 568 | }; |
| 569 | Timeline.CompactEventPainter.prototype.removeOnSelectListener = function (B) { |
| 570 | for (var A = 0; |
| 571 | A < this._onSelectListeners.length; |
| 572 | A++) { |
| 573 | if (this._onSelectListeners[A] == B) { |
| 574 | this._onSelectListeners.splice(A, 1); |
| 575 | break; |
| 576 | } |
| 577 | } |
| 578 | }; |
| 579 | Timeline.CompactEventPainter.prototype.getFilterMatcher = function () { |
| 580 | return this._filterMatcher; |
| 581 | }; |
| 582 | Timeline.CompactEventPainter.prototype.setFilterMatcher = function (A) { |
| 583 | this._filterMatcher = A; |
| 584 | }; |
| 585 | Timeline.CompactEventPainter.prototype.getHighlightMatcher = function () { |
| 586 | return this._highlightMatcher; |
| 587 | }; |
| 588 | Timeline.CompactEventPainter.prototype.setHighlightMatcher = function (A) { |
| 589 | this._highlightMatcher = A; |
| 590 | }; |
| 591 | Timeline.CompactEventPainter.prototype.paint = function () { |
| 592 | var N = this._band.getEventSource(); |
| 593 | if (N == null) { |
| 594 | return; |
| 595 | } |
| 596 | this._eventIdToElmt = {}; |
| 597 | this._prepareForPainting(); |
| 598 | var O = this._params.theme; |
| 599 | var L = O.event; |
| 600 | var G = { |
| 601 | trackOffset: "trackOffset" in this._params ? this._params.trackOffset : 10, |
| 602 | trackHeight: "trackHeight" in this._params ? this._params.trackHeight : 10, |
| 603 | tapeHeight: O.event.tape.height, |
| 604 | tapeBottomMargin: "tapeBottomMargin" in this._params ? this._params.tapeBottomMargin : 2, |
| 605 | labelBottomMargin: "labelBottomMargin" in this._params ? this._params.labelBottomMargin : 5, |
| 606 | labelRightMargin: "labelRightMargin" in this._params ? this._params.labelRightMargin : 5, |
| 607 | defaultIcon: L.instant.icon, |
| 608 | defaultIconWidth: L.instant.iconWidth, |
| 609 | defaultIconHeight: L.instant.iconHeight, |
| 610 | customIconWidth: "iconWidth" in this._params ? this._params.iconWidth : L.instant.iconWidth, |
| 611 | customIconHeight: "iconHeight" in this._params ? this._params.iconHeight : L.instant.iconHeight, |
| 612 | iconLabelGap: "iconLabelGap" in this._params ? this._params.iconLabelGap : 2, |
| 613 | iconBottomMargin: "iconBottomMargin" in this._params ? this._params.iconBottomMargin : 2 |
| 614 | }; |
| 615 | if ("compositeIcon" in this._params) { |
| 616 | G.compositeIcon = this._params.compositeIcon; |
| 617 | G.compositeIconWidth = this._params.compositeIconWidth || G.customIconWidth; |
| 618 | G.compositeIconHeight = this._params.compositeIconHeight || G.customIconHeight; |
| 619 | } else { |
| 620 | G.compositeIcon = G.defaultIcon; |
| 621 | G.compositeIconWidth = G.defaultIconWidth; |
| 622 | G.compositeIconHeight = G.defaultIconHeight; |
| 623 | } |
| 624 | G.defaultStackIcon = "icon" in this._params.stackConcurrentPreciseInstantEvents ? this._params.stackConcurrentPreciseInstantEvents.icon : G.defaultIcon; |
| 625 | G.defaultStackIconWidth = "iconWidth" in this._params.stackConcurrentPreciseInstantEvents ? this._params.stackConcurrentPreciseInstantEvents.iconWidth : G.defaultIconWidth; |
| 626 | G.defaultStackIconHeight = "iconHeight" in this._params.stackConcurrentPreciseInstantEvents ? this._params.stackConcurrentPreciseInstantEvents.iconHeight : G.defaultIconHeight; |
| 627 | var B = this._band.getMinDate(); |
| 628 | var D = this._band.getMaxDate(); |
| 629 | var R = (this._filterMatcher != null) ? this._filterMatcher : function (S) { |
| 630 | return true; |
| 631 | }; |
| 632 | var Q = (this._highlightMatcher != null) ? this._highlightMatcher : function (S) { |
| 633 | return -1; |
| 634 | }; |
| 635 | var F = N.getEventIterator(B, D); |
| 636 | var H = "stackConcurrentPreciseInstantEvents" in this._params && typeof this._params.stackConcurrentPreciseInstantEvents == "object"; |
| 637 | var P = "collapseConcurrentPreciseInstantEvents" in this._params && this._params.collapseConcurrentPreciseInstantEvents; |
| 638 | if (P || H) { |
| 639 | var M = []; |
| 640 | var A = null; |
| 641 | while (F.hasNext()) { |
| 642 | var E = F.next(); |
| 643 | if (R(E)) { |
| 644 | if (!E.isInstant() || E.isImprecise()) { |
| 645 | this.paintEvent(E, G, this._params.theme, Q(E)); |
| 646 | } else { |
| 647 | if (A != null && A.getStart().getTime() == E.getStart().getTime()) { |
| 648 | M[M.length - 1].push(E); |
| 649 | } else { |
| 650 | M.push([E]); |
| 651 | A = E; |
| 652 | } |
| 653 | } |
| 654 | } |
| 655 | } |
| 656 | for (var J = 0; |
| 657 | J < M.length; |
| 658 | J++) { |
| 659 | var K = M[J]; |
| 660 | if (K.length == 1) { |
| 661 | this.paintEvent(K[0], G, this._params.theme, Q(E)); |
| 662 | } else { |
| 663 | var C = -1; |
| 664 | for (var I = 0; |
| 665 | C < 0 && I < K.length; |
| 666 | I++) { |
| 667 | C = Q(K[I]); |
| 668 | } |
| 669 | if (H) { |
| 670 | this.paintStackedPreciseInstantEvents(K, G, this._params.theme, C); |
| 671 | } else { |
| 672 | this.paintCompositePreciseInstantEvents(K, G, this._params.theme, C); |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | } else { |
| 677 | while (F.hasNext()) { |
| 678 | var E = F.next(); |
| 679 | if (R(E)) { |
| 680 | this.paintEvent(E, G, this._params.theme, Q(E)); |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | this._highlightLayer.style.display = "block"; |
| 685 | this._lineLayer.style.display = "block"; |
| 686 | this._eventLayer.style.display = "block"; |
| 687 | }; |
| 688 | Timeline.CompactEventPainter.prototype.softPaint = function () {}; |
| 689 | Timeline.CompactEventPainter.prototype._prepareForPainting = function () { |
| 690 | var B = this._band; |
| 691 | if (this._backLayer == null) { |
| 692 | this._backLayer = this._band.createLayerDiv(0, "timeline-band-events"); |
| 693 | this._backLayer.style.visibility = "hidden"; |
| 694 | var A = document.createElement("span"); |
| 695 | A.className = "timeline-event-label"; |
| 696 | this._backLayer.appendChild(A); |
| 697 | this._frc = SimileAjax.Graphics.getFontRenderingContext(A); |
| 698 | } |
| 699 | this._frc.update(); |
| 700 | this._tracks = []; |
| 701 | if (this._highlightLayer != null) { |
| 702 | B.removeLayerDiv(this._highlightLayer); |
| 703 | } |
| 704 | this._highlightLayer = B.createLayerDiv(105, "timeline-band-highlights"); |
| 705 | this._highlightLayer.style.display = "none"; |
| 706 | if (this._lineLayer != null) { |
| 707 | B.removeLayerDiv(this._lineLayer); |
| 708 | } |
| 709 | this._lineLayer = B.createLayerDiv(110, "timeline-band-lines"); |
| 710 | this._lineLayer.style.display = "none"; |
| 711 | if (this._eventLayer != null) { |
| 712 | B.removeLayerDiv(this._eventLayer); |
| 713 | } |
| 714 | this._eventLayer = B.createLayerDiv(115, "timeline-band-events"); |
| 715 | this._eventLayer.style.display = "none"; |
| 716 | }; |
| 717 | Timeline.CompactEventPainter.prototype.paintEvent = function (B, C, D, A) { |
| 718 | if (B.isInstant()) { |
| 719 | this.paintInstantEvent(B, C, D, A); |
| 720 | } else { |
| 721 | this.paintDurationEvent(B, C, D, A); |
| 722 | } |
| 723 | }; |
| 724 | Timeline.CompactEventPainter.prototype.paintInstantEvent = function (B, C, D, A) { |
| 725 | if (B.isImprecise()) { |
| 726 | this.paintImpreciseInstantEvent(B, C, D, A); |
| 727 | } else { |
| 728 | this.paintPreciseInstantEvent(B, C, D, A); |
| 729 | } |
| 730 | }; |
| 731 | Timeline.CompactEventPainter.prototype.paintDurationEvent = function (B, C, D, A) { |
| 732 | if (B.isImprecise()) { |
| 733 | this.paintImpreciseDurationEvent(B, C, D, A); |
| 734 | } else { |
| 735 | this.paintPreciseDurationEvent(B, C, D, A); |
| 736 | } |
| 737 | }; |
| 738 | Timeline.CompactEventPainter.prototype.paintPreciseInstantEvent = function (H, F, B, A) { |
| 739 | var C = { |
| 740 | tooltip: H.getProperty("tooltip") || H.getText() |
| 741 | }; |
| 742 | var E = { |
| 743 | url: H.getIcon() |
| 744 | }; |
| 745 | if (E.url == null) { |
| 746 | E.url = F.defaultIcon; |
| 747 | E.width = F.defaultIconWidth; |
| 748 | E.height = F.defaultIconHeight; |
| 749 | E.className = "timeline-event-icon-default"; |
| 750 | } else { |
| 751 | E.width = H.getProperty("iconWidth") || F.customIconWidth; |
| 752 | E.height = H.getProperty("iconHeight") || F.customIconHeight; |
| 753 | } |
| 754 | var J = { |
| 755 | text: H.getText(), |
| 756 | color: H.getTextColor() || H.getColor(), |
| 757 | className: H.getClassName() |
| 758 | }; |
| 759 | var G = this.paintTapeIconLabel(H.getStart(), C, null, E, J, F, B, A); |
| 760 | var I = this; |
| 761 | var D = function (L, K, M) { |
| 762 | return I._onClickInstantEvent(G.iconElmtData.elmt, K, H); |
| 763 | }; |
| 764 | SimileAjax.DOM.registerEvent(G.iconElmtData.elmt, "mousedown", D); |
| 765 | SimileAjax.DOM.registerEvent(G.labelElmtData.elmt, "mousedown", D); |
| 766 | this._eventIdToElmt[H.getID()] = G.iconElmtData.elmt; |
| 767 | }; |
| 768 | Timeline.CompactEventPainter.prototype.paintCompositePreciseInstantEvents = function (J, H, D, B) { |
| 769 | var K = J[0]; |
| 770 | var A = []; |
| 771 | for (var C = 0; |
| 772 | C < J.length; |
| 773 | C++) { |
| 774 | A.push(J[C].getProperty("tooltip") || J[C].getText()); |
| 775 | } |
| 776 | var E = { |
| 777 | tooltip: A.join("; ") |
| 778 | }; |
| 779 | var G = { |
| 780 | url: H.compositeIcon, |
| 781 | width: H.compositeIconWidth, |
| 782 | height: H.compositeIconHeight, |
| 783 | className: "timeline-event-icon-composite" |
| 784 | }; |
| 785 | var M = { |
| 786 | text: String.substitute(this._params.compositeEventLabelTemplate, [J.length]) |
| 787 | }; |
| 788 | var I = this.paintTapeIconLabel(K.getStart(), E, null, G, M, H, D, B); |
| 789 | var L = this; |
| 790 | var F = function (O, N, P) { |
| 791 | return L._onClickMultiplePreciseInstantEvent(I.iconElmtData.elmt, N, J); |
| 792 | }; |
| 793 | SimileAjax.DOM.registerEvent(I.iconElmtData.elmt, "mousedown", F); |
| 794 | SimileAjax.DOM.registerEvent(I.labelElmtData.elmt, "mousedown", F); |
| 795 | for (var C = 0; |
| 796 | C < J.length; |
| 797 | C++) { |
| 798 | this._eventIdToElmt[J[C].getID()] = I.iconElmtData.elmt; |
| 799 | } |
| 800 | }; |
| 801 | Timeline.CompactEventPainter.prototype.paintStackedPreciseInstantEvents = function (T, j, c, E) { |
| 802 | var S = "limit" in this._params.stackConcurrentPreciseInstantEvents ? this._params.stackConcurrentPreciseInstantEvents.limit : 10; |
| 803 | var G = "moreMessageTemplate" in this._params.stackConcurrentPreciseInstantEvents ? this._params.stackConcurrentPreciseInstantEvents.moreMessageTemplate : "%0 More Events"; |
| 804 | var Q = S <= T.length - 2; |
| 805 | var B = this._band; |
| 806 | var L = function (i) { |
| 807 | return Math.round(B.dateToPixelOffset(i)); |
| 808 | }; |
| 809 | var O = function (i) { |
| 810 | var r = { |
| 811 | url: i.getIcon() |
| 812 | }; |
| 813 | if (r.url == null) { |
| 814 | r.url = j.defaultStackIcon; |
| 815 | r.width = j.defaultStackIconWidth; |
| 816 | r.height = j.defaultStackIconHeight; |
| 817 | r.className = "timeline-event-icon-stack timeline-event-icon-default"; |
| 818 | } else { |
| 819 | r.width = i.getProperty("iconWidth") || j.customIconWidth; |
| 820 | r.height = i.getProperty("iconHeight") || j.customIconHeight; |
| 821 | r.className = "timeline-event-icon-stack"; |
| 822 | } |
| 823 | return r; |
| 824 | }; |
| 825 | var C = O(T[0]); |
| 826 | var V = 5; |
| 827 | var D = 0; |
| 828 | var g = 0; |
| 829 | var p = 0; |
| 830 | var U = 0; |
| 831 | var l = []; |
| 832 | for (var n = 0; |
| 833 | n < T.length && (!Q || n < S); |
| 834 | n++) { |
| 835 | var b = T[n]; |
| 836 | var a = b.getText(); |
| 837 | var X = O(b); |
| 838 | var W = this._frc.computeSize(a); |
| 839 | var K = { |
| 840 | text: a, |
| 841 | iconData: X, |
| 842 | labelSize: W, |
| 843 | iconLeft: C.width + n * V - X.width |
| 844 | }; |
| 845 | K.labelLeft = C.width + n * V + j.iconLabelGap; |
| 846 | K.top = p; |
| 847 | l.push(K); |
| 848 | D = Math.min(D, K.iconLeft); |
| 849 | p += W.height; |
| 850 | g = Math.max(g, K.labelLeft + W.width); |
| 851 | U = Math.max(U, K.top + X.height); |
| 852 | } |
| 853 | if (Q) { |
| 854 | var e = String.substitute(G, [T.length - S]); |
| 855 | var H = this._frc.computeSize(e); |
| 856 | var J = C.width + (S - 1) * V + j.iconLabelGap; |
| 857 | var m = p; |
| 858 | p += H.height; |
| 859 | g = Math.max(g, J + H.width); |
| 860 | } |
| 861 | g += j.labelRightMargin; |
| 862 | p += j.labelBottomMargin; |
| 863 | U += j.iconBottomMargin; |
| 864 | var F = L(T[0].getStart()); |
| 865 | var Y = []; |
| 866 | var N = Math.ceil(Math.max(U, p) / j.trackHeight); |
| 867 | var M = C.width + (T.length - 1) * V; |
| 868 | for (var n = 0; |
| 869 | n < N; |
| 870 | n++) { |
| 871 | Y.push({ |
| 872 | start: D, |
| 873 | end: M |
| 874 | }); |
| 875 | } |
| 876 | var f = Math.ceil(p / j.trackHeight); |
| 877 | for (var n = 0; |
| 878 | n < f; |
| 879 | n++) { |
| 880 | var P = Y[n]; |
| 881 | P.end = Math.max(P.end, g); |
| 882 | } |
| 883 | var k = this._fitTracks(F, Y); |
| 884 | var Z = k * j.trackHeight + j.trackOffset; |
| 885 | var q = this._timeline.getDocument().createElement("div"); |
| 886 | q.className = "timeline-event-icon-stack"; |
| 887 | q.style.position = "absolute"; |
| 888 | q.style.overflow = "visible"; |
| 889 | q.style.left = F + "px"; |
| 890 | q.style.top = Z + "px"; |
| 891 | q.style.width = M + "px"; |
| 892 | q.style.height = U + "px"; |
| 893 | q.innerHTML = "<div style='position: relative'></div>"; |
| 894 | this._eventLayer.appendChild(q); |
| 895 | var I = this; |
| 896 | var R = function (r) { |
| 897 | try { |
| 898 | var w = parseInt(this.getAttribute("index")); |
| 899 | var u = q.firstChild.childNodes; |
| 900 | for (var s = 0; |
| 901 | s < u.length; |
| 902 | s++) { |
| 903 | var v = u[s]; |
| 904 | if (s == w) { |
| 905 | v.style.zIndex = u.length; |
| 906 | } else { |
| 907 | v.style.zIndex = u.length - s; |
| 908 | } |
| 909 | } |
| 910 | } catch (t) {} |
| 911 | }; |
| 912 | var d = function (u) { |
| 913 | var w = l[u]; |
| 914 | var r = T[u]; |
| 915 | var i = r.getProperty("tooltip") || r.getText(); |
| 916 | var v = I._paintEventLabel({ |
| 917 | tooltip: i |
| 918 | }, { |
| 919 | text: w.text |
| 920 | }, F + w.labelLeft, Z + w.top, w.labelSize.width, w.labelSize.height, c); |
| 921 | v.elmt.setAttribute("index", u); |
| 922 | v.elmt.onmouseover = R; |
| 923 | var t = SimileAjax.Graphics.createTranslucentImage(w.iconData.url); |
| 924 | var s = I._timeline.getDocument().createElement("div"); |
| 925 | s.className = "timeline-event-icon" + ("className" in w.iconData ? (" " + w.iconData.className) : ""); |
| 926 | s.style.left = w.iconLeft + "px"; |
| 927 | s.style.top = w.top + "px"; |
| 928 | s.style.zIndex = (l.length - u); |
| 929 | s.appendChild(t); |
| 930 | s.setAttribute("index", u); |
| 931 | s.onmouseover = R; |
| 932 | q.firstChild.appendChild(s); |
| 933 | var x = function (z, y, AA) { |
| 934 | return I._onClickInstantEvent(v.elmt, y, r); |
| 935 | }; |
| 936 | SimileAjax.DOM.registerEvent(s, "mousedown", x); |
| 937 | SimileAjax.DOM.registerEvent(v.elmt, "mousedown", x); |
| 938 | I._eventIdToElmt[r.getID()] = s; |
| 939 | }; |
| 940 | for (var n = 0; |
| 941 | n < l.length; |
| 942 | n++) { |
| 943 | d(n); |
| 944 | } |
| 945 | if (Q) { |
| 946 | var o = T.slice(S); |
| 947 | var A = this._paintEventLabel({ |
| 948 | tooltip: e |
| 949 | }, { |
| 950 | text: e |
| 951 | }, F + J, Z + m, H.width, H.height, c); |
| 952 | var h = function (r, i, s) { |
| 953 | return I._onClickMultiplePreciseInstantEvent(A.elmt, i, o); |
| 954 | }; |
| 955 | SimileAjax.DOM.registerEvent(A.elmt, "mousedown", h); |
| 956 | for (var n = 0; |
| 957 | n < o.length; |
| 958 | n++) { |
| 959 | this._eventIdToElmt[o[n].getID()] = A.elmt; |
| 960 | } |
| 961 | } |
| 962 | }; |
| 963 | Timeline.CompactEventPainter.prototype.paintImpreciseInstantEvent = function (I, G, B, A) { |
| 964 | var C = { |
| 965 | tooltip: I.getProperty("tooltip") || I.getText() |
| 966 | }; |
| 967 | var E = { |
| 968 | start: I.getStart(), |
| 969 | end: I.getEnd(), |
| 970 | latestStart: I.getLatestStart(), |
| 971 | earliestEnd: I.getEarliestEnd(), |
| 972 | isInstant: true |
| 973 | }; |
| 974 | var F = { |
| 975 | url: I.getIcon() |
| 976 | }; |
| 977 | if (F.url == null) { |
| 978 | F = null; |
| 979 | } else { |
| 980 | F.width = I.getProperty("iconWidth") || G.customIconWidth; |
| 981 | F.height = I.getProperty("iconHeight") || G.customIconHeight; |
| 982 | } |
| 983 | var K = { |
| 984 | text: I.getText(), |
| 985 | color: I.getTextColor() || I.getColor(), |
| 986 | className: I.getClassName() |
| 987 | }; |
| 988 | var H = this.paintTapeIconLabel(I.getStart(), C, E, F, K, G, B, A); |
| 989 | var J = this; |
| 990 | var D = F != null ? |
| 991 | function (M, L, N) { |
| 992 | return J._onClickInstantEvent(H.iconElmtData.elmt, L, I); |
| 993 | } : function (M, L, N) { |
| 994 | return J._onClickInstantEvent(H.labelElmtData.elmt, L, I); |
| 995 | }; |
| 996 | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt, "mousedown", D); |
| 997 | SimileAjax.DOM.registerEvent(H.impreciseTapeElmtData.elmt, "mousedown", D); |
| 998 | if (F != null) { |
| 999 | SimileAjax.DOM.registerEvent(H.iconElmtData.elmt, "mousedown", D); |
| 1000 | this._eventIdToElmt[I.getID()] = H.iconElmtData.elmt; |
| 1001 | } else { |
| 1002 | this._eventIdToElmt[I.getID()] = H.labelElmtData.elmt; |
| 1003 | } |
| 1004 | }; |
| 1005 | Timeline.CompactEventPainter.prototype.paintPreciseDurationEvent = function (I, G, B, A) { |
| 1006 | var C = { |
| 1007 | tooltip: I.getProperty("tooltip") || I.getText() |
| 1008 | }; |
| 1009 | var E = { |
| 1010 | start: I.getStart(), |
| 1011 | end: I.getEnd(), |
| 1012 | isInstant: false |
| 1013 | }; |
| 1014 | var F = { |
| 1015 | url: I.getIcon() |
| 1016 | }; |
| 1017 | if (F.url == null) { |
| 1018 | F = null; |
| 1019 | } else { |
| 1020 | F.width = I.getProperty("iconWidth") || G.customIconWidth; |
| 1021 | F.height = I.getProperty("iconHeight") || G.customIconHeight; |
| 1022 | } |
| 1023 | var K = { |
| 1024 | text: I.getText(), |
| 1025 | color: I.getTextColor() || I.getColor(), |
| 1026 | className: I.getClassName() |
| 1027 | }; |
| 1028 | var H = this.paintTapeIconLabel(I.getLatestStart(), C, E, F, K, G, B, A); |
| 1029 | var J = this; |
| 1030 | var D = F != null ? |
| 1031 | function (M, L, N) { |
| 1032 | return J._onClickInstantEvent(H.iconElmtData.elmt, L, I); |
| 1033 | } : function (M, L, N) { |
| 1034 | return J._onClickInstantEvent(H.labelElmtData.elmt, L, I); |
| 1035 | }; |
| 1036 | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt, "mousedown", D); |
| 1037 | SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt, "mousedown", D); |
| 1038 | if (F != null) { |
| 1039 | SimileAjax.DOM.registerEvent(H.iconElmtData.elmt, "mousedown", D); |
| 1040 | this._eventIdToElmt[I.getID()] = H.iconElmtData.elmt; |
| 1041 | } else { |
| 1042 | this._eventIdToElmt[I.getID()] = H.labelElmtData.elmt; |
| 1043 | } |
| 1044 | }; |
| 1045 | Timeline.CompactEventPainter.prototype.paintImpreciseDurationEvent = function (I, G, B, A) { |
| 1046 | var C = { |
| 1047 | tooltip: I.getProperty("tooltip") || I.getText() |
| 1048 | }; |
| 1049 | var E = { |
| 1050 | start: I.getStart(), |
| 1051 | end: I.getEnd(), |
| 1052 | latestStart: I.getLatestStart(), |
| 1053 | earliestEnd: I.getEarliestEnd(), |
| 1054 | isInstant: false |
| 1055 | }; |
| 1056 | var F = { |
| 1057 | url: I.getIcon() |
| 1058 | }; |
| 1059 | if (F.url == null) { |
| 1060 | F = null; |
| 1061 | } else { |
| 1062 | F.width = I.getProperty("iconWidth") || G.customIconWidth; |
| 1063 | F.height = I.getProperty("iconHeight") || G.customIconHeight; |
| 1064 | } |
| 1065 | var K = { |
| 1066 | text: I.getText(), |
| 1067 | color: I.getTextColor() || I.getColor(), |
| 1068 | className: I.getClassName() |
| 1069 | }; |
| 1070 | var H = this.paintTapeIconLabel(I.getLatestStart(), C, E, F, K, G, B, A); |
| 1071 | var J = this; |
| 1072 | var D = F != null ? |
| 1073 | function (M, L, N) { |
| 1074 | return J._onClickInstantEvent(H.iconElmtData.elmt, L, I); |
| 1075 | } : function (M, L, N) { |
| 1076 | return J._onClickInstantEvent(H.labelElmtData.elmt, L, I); |
| 1077 | }; |
| 1078 | SimileAjax.DOM.registerEvent(H.labelElmtData.elmt, "mousedown", D); |
| 1079 | SimileAjax.DOM.registerEvent(H.tapeElmtData.elmt, "mousedown", D); |
| 1080 | if (F != null) { |
| 1081 | SimileAjax.DOM.registerEvent(H.iconElmtData.elmt, "mousedown", D); |
| 1082 | this._eventIdToElmt[I.getID()] = H.iconElmtData.elmt; |
| 1083 | } else { |
| 1084 | this._eventIdToElmt[I.getID()] = H.labelElmtData.elmt; |
| 1085 | } |
| 1086 | }; |
| 1087 | Timeline.CompactEventPainter.prototype.paintTapeIconLabel = function (V, O, S, I, a, X, c, Z) { |
| 1088 | var R = this._band; |
| 1089 | var F = function (e) { |
| 1090 | return Math.round(R.dateToPixelOffset(e)); |
| 1091 | }; |
| 1092 | var d = F(V); |
| 1093 | var W = []; |
| 1094 | var b = 0; |
| 1095 | var B = 0; |
| 1096 | var C = 0; |
| 1097 | if (S != null) { |
| 1098 | b = X.tapeHeight + X.tapeBottomMargin; |
| 1099 | B = Math.ceil(X.tapeHeight / X.trackHeight); |
| 1100 | var A = F(S.end) - d; |
| 1101 | var L = F(S.start) - d; |
| 1102 | for (var Q = 0; |
| 1103 | Q < B; |
| 1104 | Q++) { |
| 1105 | W.push({ |
| 1106 | start: L, |
| 1107 | end: A |
| 1108 | }); |
| 1109 | } |
| 1110 | C = X.trackHeight - (b % X.tapeHeight); |
| 1111 | } |
| 1112 | var N = 0; |
| 1113 | var U = 0; |
| 1114 | if (I != null) { |
| 1115 | if ("iconAlign" in I && I.iconAlign == "center") { |
| 1116 | N = -Math.floor(I.width / 2); |
| 1117 | } |
| 1118 | U = N + I.width + X.iconLabelGap; |
| 1119 | if (B > 0) { |
| 1120 | W[B - 1].end = Math.max(W[B - 1].end, U); |
| 1121 | } |
| 1122 | var E = I.height + X.iconBottomMargin + C; |
| 1123 | while (E > 0) { |
| 1124 | W.push({ |
| 1125 | start: N, |
| 1126 | end: U |
| 1127 | }); |
| 1128 | E -= X.trackHeight; |
| 1129 | } |
| 1130 | } |
| 1131 | var P = a.text; |
| 1132 | var H = this._frc.computeSize(P); |
| 1133 | var M = H.height + X.labelBottomMargin + C; |
| 1134 | var J = U + H.width + X.labelRightMargin; |
| 1135 | if (B > 0) { |
| 1136 | W[B - 1].end = Math.max(W[B - 1].end, J); |
| 1137 | } |
| 1138 | for (var Y = 0; |
| 1139 | M > 0; |
| 1140 | Y++) { |
| 1141 | if (B + Y < W.length) { |
| 1142 | var T = W[B + Y]; |
| 1143 | T.end = J; |
| 1144 | } else { |
| 1145 | W.push({ |
| 1146 | start: 0, |
| 1147 | end: J |
| 1148 | }); |
| 1149 | } |
| 1150 | M -= X.trackHeight; |
| 1151 | } |
| 1152 | var G = this._fitTracks(d, W); |
| 1153 | var K = G * X.trackHeight + X.trackOffset; |
| 1154 | var D = {}; |
| 1155 | D.labelElmtData = this._paintEventLabel(O, a, d + U, K + b, H.width, H.height, c); |
| 1156 | if (S != null) { |
| 1157 | if ("latestStart" in S || "earliestEnd" in S) { |
| 1158 | D.impreciseTapeElmtData = this._paintEventTape(O, S, X.tapeHeight, K, F(S.start), F(S.end), c.event.duration.impreciseColor, c.event.duration.impreciseOpacity, X, c); |
| 1159 | } |
| 1160 | if (!S.isInstant && "start" in S && "end" in S) { |
| 1161 | D.tapeElmtData = this._paintEventTape(O, S, X.tapeHeight, K, d, F("earliestEnd" in S ? S.earliestEnd : S.end), S.color, 100, X, c); |
| 1162 | } |
| 1163 | } |
| 1164 | if (I != null) { |
| 1165 | D.iconElmtData = this._paintEventIcon(O, I, K + b, d + N, X, c); |
| 1166 | } |
| 1167 | return D; |
| 1168 | }; |
| 1169 | Timeline.CompactEventPainter.prototype._fitTracks = function (F, C) { |
| 1170 | var H; |
| 1171 | for (H = 0; |
| 1172 | H < this._tracks.length; |
| 1173 | H++) { |
| 1174 | var E = true; |
| 1175 | for (var B = 0; |
| 1176 | B < C.length && (H + B) < this._tracks.length; |
| 1177 | B++) { |
| 1178 | var G = this._tracks[H + B]; |
| 1179 | var A = C[B]; |
| 1180 | if (F + A.start < G) { |
| 1181 | E = false; |
| 1182 | break; |
| 1183 | } |
| 1184 | } |
| 1185 | if (E) { |
| 1186 | break; |
| 1187 | } |
| 1188 | } |
| 1189 | for (var D = 0; |
| 1190 | D < C.length; |
| 1191 | D++) { |
| 1192 | this._tracks[H + D] = F + C[D].end; |
| 1193 | } |
| 1194 | return H; |
| 1195 | }; |
| 1196 | Timeline.CompactEventPainter.prototype._paintEventIcon = function (C, D, H, G, E, F) { |
| 1197 | var B = SimileAjax.Graphics.createTranslucentImage(D.url); |
| 1198 | var A = this._timeline.getDocument().createElement("div"); |
| 1199 | A.className = "timeline-event-icon" + ("className" in D ? (" " + D.className) : ""); |
| 1200 | A.style.left = G + "px"; |
| 1201 | A.style.top = H + "px"; |
| 1202 | A.appendChild(B); |
| 1203 | if ("tooltip" in C && typeof C.tooltip == "string") { |
| 1204 | A.title = C.tooltip; |
| 1205 | } |
| 1206 | this._eventLayer.appendChild(A); |
| 1207 | return { |
| 1208 | left: G, |
| 1209 | top: H, |
| 1210 | width: E.iconWidth, |
| 1211 | height: E.iconHeight, |
| 1212 | elmt: A |
| 1213 | }; |
| 1214 | }; |
| 1215 | Timeline.CompactEventPainter.prototype._paintEventLabel = function (E, I, C, F, A, G, D) { |
| 1216 | var H = this._timeline.getDocument(); |
| 1217 | var B = H.createElement("div"); |
| 1218 | B.className = "timeline-event-label"; |
| 1219 | B.style.left = C + "px"; |
| 1220 | B.style.width = (A + 1) + "px"; |
| 1221 | B.style.top = F + "px"; |
| 1222 | B.innerHTML = I.text; |
| 1223 | if ("tooltip" in E && typeof E.tooltip == "string") { |
| 1224 | B.title = E.tooltip; |
| 1225 | } |
| 1226 | if ("color" in I && typeof I.color == "string") { |
| 1227 | B.style.color = I.color; |
| 1228 | } |
| 1229 | if ("className" in I && typeof I.className == "string") { |
| 1230 | B.className += " " + I.className; |
| 1231 | } |
| 1232 | this._eventLayer.appendChild(B); |
| 1233 | return { |
| 1234 | left: C, |
| 1235 | top: F, |
| 1236 | width: A, |
| 1237 | height: G, |
| 1238 | elmt: B |
| 1239 | }; |
| 1240 | }; |
| 1241 | Timeline.CompactEventPainter.prototype._paintEventTape = function (G, H, K, J, D, A, E, C, I, F) { |
| 1242 | var B = A - D; |
| 1243 | var L = this._timeline.getDocument().createElement("div"); |
| 1244 | L.className = "timeline-event-tape"; |
| 1245 | L.style.left = D + "px"; |
| 1246 | L.style.top = J + "px"; |
| 1247 | L.style.width = B + "px"; |
| 1248 | L.style.height = K + "px"; |
| 1249 | if ("tooltip" in G && typeof G.tooltip == "string") { |
| 1250 | L.title = G.tooltip; |
| 1251 | } |
| 1252 | if (E != null && typeof H.color == "string") { |
| 1253 | L.style.backgroundColor = E; |
| 1254 | } |
| 1255 | if ("backgroundImage" in H && typeof H.backgroundImage == "string") { |
| 1256 | L.style.backgroundImage = "url(" + backgroundImage + ")"; |
| 1257 | L.style.backgroundRepeat = ("backgroundRepeat" in H && typeof H.backgroundRepeat == "string") ? H.backgroundRepeat : "repeat"; |
| 1258 | } |
| 1259 | SimileAjax.Graphics.setOpacity(L, C); |
| 1260 | if ("className" in H && typeof H.className == "string") { |
| 1261 | L.className += " " + H.className; |
| 1262 | } |
| 1263 | this._eventLayer.appendChild(L); |
| 1264 | return { |
| 1265 | left: D, |
| 1266 | top: J, |
| 1267 | width: B, |
| 1268 | height: K, |
| 1269 | elmt: L |
| 1270 | }; |
| 1271 | }; |
| 1272 | Timeline.CompactEventPainter.prototype._createHighlightDiv = function (A, C, E) { |
| 1273 | if (A >= 0) { |
| 1274 | var D = this._timeline.getDocument(); |
| 1275 | var G = E.event; |
| 1276 | var B = G.highlightColors[Math.min(A, G.highlightColors.length - 1)]; |
| 1277 | var F = D.createElement("div"); |
| 1278 | F.style.position = "absolute"; |
| 1279 | F.style.overflow = "hidden"; |
| 1280 | F.style.left = (C.left - 2) + "px"; |
| 1281 | F.style.width = (C.width + 4) + "px"; |
| 1282 | F.style.top = (C.top - 2) + "px"; |
| 1283 | F.style.height = (C.height + 4) + "px"; |
| 1284 | this._highlightLayer.appendChild(F); |
| 1285 | } |
| 1286 | }; |
| 1287 | Timeline.CompactEventPainter.prototype._onClickMultiplePreciseInstantEvent = function (E, A, B) { |
| 1288 | var F = SimileAjax.DOM.getPageCoordinates(E); |
| 1289 | this._showBubble(F.left + Math.ceil(E.offsetWidth / 2), F.top + Math.ceil(E.offsetHeight / 2), B); |
| 1290 | var D = []; |
| 1291 | for (var C = 0; |
| 1292 | C < B.length; |
| 1293 | C++) { |
| 1294 | D.push(B[C].getID()); |
| 1295 | } |
| 1296 | this._fireOnSelect(D); |
| 1297 | A.cancelBubble = true; |
| 1298 | SimileAjax.DOM.cancelEvent(A); |
| 1299 | return false; |
| 1300 | }; |
| 1301 | Timeline.CompactEventPainter.prototype._onClickInstantEvent = function (C, A, B) { |
| 1302 | var D = SimileAjax.DOM.getPageCoordinates(C); |
| 1303 | this._showBubble(D.left + Math.ceil(C.offsetWidth / 2), D.top + Math.ceil(C.offsetHeight / 2), [B]); |
| 1304 | this._fireOnSelect([B.getID()]); |
| 1305 | A.cancelBubble = true; |
| 1306 | SimileAjax.DOM.cancelEvent(A); |
| 1307 | return false; |
| 1308 | }; |
| 1309 | Timeline.CompactEventPainter.prototype._onClickDurationEvent = function (F, B, C) { |
| 1310 | if ("pageX" in B) { |
| 1311 | var A = B.pageX; |
| 1312 | var E = B.pageY; |
| 1313 | } else { |
| 1314 | var D = SimileAjax.DOM.getPageCoordinates(F); |
| 1315 | var A = B.offsetX + D.left; |
| 1316 | var E = B.offsetY + D.top; |
| 1317 | } |
| 1318 | this._showBubble(A, E, [C]); |
| 1319 | this._fireOnSelect([C.getID()]); |
| 1320 | B.cancelBubble = true; |
| 1321 | SimileAjax.DOM.cancelEvent(B); |
| 1322 | return false; |
| 1323 | }; |
| 1324 | Timeline.CompactEventPainter.prototype.showBubble = function (A) { |
| 1325 | var B = this._eventIdToElmt[A.getID()]; |
| 1326 | if (B) { |
| 1327 | var C = SimileAjax.DOM.getPageCoordinates(B); |
| 1328 | this._showBubble(C.left + B.offsetWidth / 2, C.top + B.offsetHeight / 2, [A]); |
| 1329 | } |
| 1330 | }; |
| 1331 | Timeline.CompactEventPainter.prototype._showBubble = function (A, F, B) { |
| 1332 | var E = document.createElement("div"); |
| 1333 | B = ("fillInfoBubble" in B) ? [B] : B; |
| 1334 | for (var D = 0; |
| 1335 | D < B.length; |
| 1336 | D++) { |
| 1337 | var C = document.createElement("div"); |
| 1338 | E.appendChild(C); |
| 1339 | B[D].fillInfoBubble(C, this._params.theme, this._band.getLabeller()); |
| 1340 | } |
| 1341 | SimileAjax.WindowManager.cancelPopups(); |
| 1342 | SimileAjax.Graphics.createBubbleForContentAndPoint(E, A, F, this._params.theme.event.bubble.width); |
| 1343 | }; |
| 1344 | Timeline.CompactEventPainter.prototype._fireOnSelect = function (B) { |
| 1345 | for (var A = 0; |
| 1346 | A < this._onSelectListeners.length; |
| 1347 | A++) { |
| 1348 | this._onSelectListeners[A](B); |
| 1349 | } |
| 1350 | }; |
928 | | Timeline.DetailedEventPainter=function(A){this._params=A; |
929 | | this._onSelectListeners=[]; |
930 | | this._filterMatcher=null; |
931 | | this._highlightMatcher=null; |
932 | | this._frc=null; |
933 | | this._eventIdToElmt={}; |
934 | | }; |
935 | | Timeline.DetailedEventPainter.prototype.initialize=function(B,A){this._band=B; |
936 | | this._timeline=A; |
937 | | this._backLayer=null; |
938 | | this._eventLayer=null; |
939 | | this._lineLayer=null; |
940 | | this._highlightLayer=null; |
941 | | this._eventIdToElmt=null; |
942 | | }; |
943 | | Timeline.DetailedEventPainter.prototype.getType=function(){return"detailed"; |
944 | | }; |
945 | | Timeline.DetailedEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); |
946 | | }; |
947 | | Timeline.DetailedEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; |
948 | | A<this._onSelectListeners.length; |
949 | | A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); |
950 | | break; |
951 | | }}}; |
952 | | Timeline.DetailedEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; |
953 | | }; |
954 | | Timeline.DetailedEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; |
955 | | }; |
956 | | Timeline.DetailedEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; |
957 | | }; |
958 | | Timeline.DetailedEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; |
959 | | }; |
960 | | Timeline.DetailedEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); |
961 | | if(C==null){return ; |
962 | | }this._eventIdToElmt={}; |
963 | | this._prepareForPainting(); |
964 | | var I=this._params.theme.event; |
965 | | var G=Math.max(I.track.height,this._frc.getLineHeight()); |
966 | | 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}; |
967 | | var D=this._band.getMinDate(); |
968 | | var B=this._band.getMaxDate(); |
969 | | var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true; |
970 | | }; |
971 | | var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1; |
972 | | }; |
973 | | var E=C.getEventReverseIterator(D,B); |
974 | | while(E.hasNext()){var H=E.next(); |
975 | | if(J(H)){this.paintEvent(H,F,this._params.theme,A(H)); |
976 | | }}this._highlightLayer.style.display="block"; |
977 | | this._lineLayer.style.display="block"; |
978 | | this._eventLayer.style.display="block"; |
979 | | this._band.updateEventTrackInfo(this._lowerTracks.length+this._upperTracks.length,F.trackIncrement); |
980 | | }; |
981 | | Timeline.DetailedEventPainter.prototype.softPaint=function(){}; |
982 | | Timeline.DetailedEventPainter.prototype._prepareForPainting=function(){var B=this._band; |
983 | | if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); |
984 | | this._backLayer.style.visibility="hidden"; |
985 | | var A=document.createElement("span"); |
986 | | A.className="timeline-event-label"; |
987 | | this._backLayer.appendChild(A); |
988 | | this._frc=SimileAjax.Graphics.getFontRenderingContext(A); |
989 | | }this._frc.update(); |
990 | | this._lowerTracks=[]; |
991 | | this._upperTracks=[]; |
992 | | if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); |
993 | | }this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); |
994 | | this._highlightLayer.style.display="none"; |
995 | | if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); |
996 | | }this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); |
997 | | this._lineLayer.style.display="none"; |
998 | | if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); |
999 | | }this._eventLayer=B.createLayerDiv(110,"timeline-band-events"); |
1000 | | this._eventLayer.style.display="none"; |
1001 | | }; |
1002 | | Timeline.DetailedEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); |
1003 | | }else{this.paintDurationEvent(B,C,D,A); |
1004 | | }}; |
1005 | | Timeline.DetailedEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); |
1006 | | }else{this.paintPreciseInstantEvent(B,C,D,A); |
1007 | | }}; |
1008 | | Timeline.DetailedEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); |
1009 | | }else{this.paintPreciseDurationEvent(B,C,D,A); |
1010 | | }}; |
1011 | | Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent=function(L,P,S,Q){var T=this._timeline.getDocument(); |
1012 | | var J=L.getText(); |
1013 | | var G=L.getStart(); |
1014 | | var H=Math.round(this._band.dateToPixelOffset(G)); |
1015 | | var A=Math.round(H+P.iconWidth/2); |
1016 | | var C=Math.round(H-P.iconWidth/2); |
1017 | | var E=this._frc.computeSize(J); |
1018 | | var F=this._findFreeTrackForSolid(A,H); |
1019 | | var B=this._paintEventIcon(L,F,C,P,S); |
1020 | | var K=A+S.event.label.offsetFromLine; |
1021 | | var O=F; |
1022 | | var D=this._getTrackData(F); |
1023 | | if(Math.min(D.solid,D.text)>=K+E.width){D.solid=C; |
1024 | | D.text=K; |
1025 | | }else{D.solid=C; |
1026 | | K=H+S.event.label.offsetFromLine; |
1027 | | O=this._findFreeTrackForText(F,K+E.width,function(U){U.line=H-2; |
1028 | | }); |
1029 | | this._getTrackData(O).text=C; |
1030 | | this._paintEventLine(L,H,F,O,P,S); |
1031 | | }var N=Math.round(P.trackOffset+O*P.trackIncrement+P.trackHeight/2-E.height/2); |
1032 | | var R=this._paintEventLabel(L,J,K,N,E.width,E.height,S); |
1033 | | var M=this; |
1034 | | var I=function(V,U,W){return M._onClickInstantEvent(B.elmt,U,L); |
1035 | | }; |
1036 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",I); |
1037 | | SimileAjax.DOM.registerEvent(R.elmt,"mousedown",I); |
1038 | | this._createHighlightDiv(Q,B,S); |
1039 | | this._eventIdToElmt[L.getID()]=B.elmt; |
1040 | | }; |
1041 | | Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent=function(O,S,W,T){var X=this._timeline.getDocument(); |
1042 | | var M=O.getText(); |
1043 | | var I=O.getStart(); |
1044 | | var U=O.getEnd(); |
1045 | | var K=Math.round(this._band.dateToPixelOffset(I)); |
1046 | | var B=Math.round(this._band.dateToPixelOffset(U)); |
1047 | | var A=Math.round(K+S.iconWidth/2); |
1048 | | var D=Math.round(K-S.iconWidth/2); |
1049 | | var G=this._frc.computeSize(M); |
1050 | | var H=this._findFreeTrackForSolid(B,K); |
1051 | | var E=this._paintEventTape(O,H,K,B,W.event.instant.impreciseColor,W.event.instant.impreciseOpacity,S,W); |
1052 | | var C=this._paintEventIcon(O,H,D,S,W); |
1053 | | var F=this._getTrackData(H); |
1054 | | F.solid=D; |
1055 | | var N=A+W.event.label.offsetFromLine; |
1056 | | var J=N+G.width; |
1057 | | var R; |
1058 | | if(J<B){R=H; |
1059 | | }else{N=K+W.event.label.offsetFromLine; |
1060 | | J=N+G.width; |
1061 | | R=this._findFreeTrackForText(H,J,function(Y){Y.line=K-2; |
1062 | | }); |
1063 | | this._getTrackData(R).text=D; |
1064 | | this._paintEventLine(O,K,H,R,S,W); |
1065 | | }var Q=Math.round(S.trackOffset+R*S.trackIncrement+S.trackHeight/2-G.height/2); |
1066 | | var V=this._paintEventLabel(O,M,N,Q,G.width,G.height,W); |
1067 | | var P=this; |
1068 | | var L=function(Z,Y,a){return P._onClickInstantEvent(C.elmt,Y,O); |
1069 | | }; |
1070 | | SimileAjax.DOM.registerEvent(C.elmt,"mousedown",L); |
1071 | | SimileAjax.DOM.registerEvent(E.elmt,"mousedown",L); |
1072 | | SimileAjax.DOM.registerEvent(V.elmt,"mousedown",L); |
1073 | | this._createHighlightDiv(T,C,W); |
1074 | | this._eventIdToElmt[O.getID()]=C.elmt; |
1075 | | }; |
1076 | | Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent=function(K,O,T,Q){var U=this._timeline.getDocument(); |
1077 | | var I=K.getText(); |
1078 | | var E=K.getStart(); |
1079 | | var R=K.getEnd(); |
1080 | | var F=Math.round(this._band.dateToPixelOffset(E)); |
1081 | | var A=Math.round(this._band.dateToPixelOffset(R)); |
1082 | | var C=this._frc.computeSize(I); |
1083 | | var D=this._findFreeTrackForSolid(A); |
1084 | | var P=K.getColor(); |
1085 | | P=P!=null?P:T.event.duration.color; |
1086 | | var B=this._paintEventTape(K,D,F,A,P,100,O,T); |
1087 | | var H=this._getTrackData(D); |
1088 | | H.solid=F; |
1089 | | var J=F+T.event.label.offsetFromLine; |
1090 | | var N=this._findFreeTrackForText(D,J+C.width,function(V){V.line=F-2; |
1091 | | }); |
1092 | | this._getTrackData(N).text=F-2; |
1093 | | this._paintEventLine(K,F,D,N,O,T); |
1094 | | var M=Math.round(O.trackOffset+N*O.trackIncrement+O.trackHeight/2-C.height/2); |
1095 | | var S=this._paintEventLabel(K,I,J,M,C.width,C.height,T); |
1096 | | var L=this; |
1097 | | var G=function(W,V,X){return L._onClickDurationEvent(B.elmt,V,K); |
1098 | | }; |
1099 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",G); |
1100 | | SimileAjax.DOM.registerEvent(S.elmt,"mousedown",G); |
1101 | | this._createHighlightDiv(Q,B,T); |
1102 | | this._eventIdToElmt[K.getID()]=B.elmt; |
1103 | | }; |
1104 | | Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent=function(M,T,Y,V){var Z=this._timeline.getDocument(); |
1105 | | var K=M.getText(); |
1106 | | var G=M.getStart(); |
1107 | | var S=M.getLatestStart(); |
1108 | | var W=M.getEnd(); |
1109 | | var O=M.getEarliestEnd(); |
1110 | | var H=Math.round(this._band.dateToPixelOffset(G)); |
1111 | | var E=Math.round(this._band.dateToPixelOffset(S)); |
1112 | | var A=Math.round(this._band.dateToPixelOffset(W)); |
1113 | | var F=Math.round(this._band.dateToPixelOffset(O)); |
1114 | | var C=this._frc.computeSize(K); |
1115 | | var D=this._findFreeTrackForSolid(A); |
1116 | | var U=M.getColor(); |
1117 | | U=U!=null?U:Y.event.duration.color; |
1118 | | var R=this._paintEventTape(M,D,H,A,Y.event.duration.impreciseColor,Y.event.duration.impreciseOpacity,T,Y); |
1119 | | var B=this._paintEventTape(M,D,E,F,U,100,T,Y); |
1120 | | var J=this._getTrackData(D); |
1121 | | J.solid=H; |
1122 | | var L=E+Y.event.label.offsetFromLine; |
1123 | | var Q=this._findFreeTrackForText(D,L+C.width,function(a){a.line=E-2; |
1124 | | }); |
1125 | | this._getTrackData(Q).text=E-2; |
1126 | | this._paintEventLine(M,E,D,Q,T,Y); |
1127 | | var P=Math.round(T.trackOffset+Q*T.trackIncrement+T.trackHeight/2-C.height/2); |
1128 | | var X=this._paintEventLabel(M,K,L,P,C.width,C.height,Y); |
1129 | | var N=this; |
1130 | | var I=function(b,a,c){return N._onClickDurationEvent(B.elmt,a,M); |
1131 | | }; |
1132 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",I); |
1133 | | SimileAjax.DOM.registerEvent(X.elmt,"mousedown",I); |
1134 | | this._createHighlightDiv(V,B,Y); |
1135 | | this._eventIdToElmt[M.getID()]=B.elmt; |
1136 | | }; |
1137 | | Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid=function(D,A){for(var C=0; |
1138 | | true; |
1139 | | C++){if(C<this._lowerTracks.length){var B=this._lowerTracks[C]; |
1140 | | if(Math.min(B.solid,B.text)>D&&(!(A)||B.line>A)){return C; |
1141 | | }}else{this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); |
1142 | | return C; |
1143 | | }if(C<this._upperTracks.length){var B=this._upperTracks[C]; |
1144 | | if(Math.min(B.solid,B.text)>D&&(!(A)||B.line>A)){return -1-C; |
1145 | | }}else{this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); |
1146 | | return -1-C; |
1147 | | }}}; |
1148 | | Timeline.DetailedEventPainter.prototype._findFreeTrackForText=function(C,A,I){var B; |
1149 | | var E; |
1150 | | var F; |
1151 | | var H; |
1152 | | if(C<0){B=true; |
1153 | | F=-C; |
1154 | | E=this._findFreeUpperTrackForText(F,A); |
1155 | | H=-1-E; |
1156 | | }else{if(C>0){B=false; |
1157 | | F=C+1; |
1158 | | E=this._findFreeLowerTrackForText(F,A); |
1159 | | H=E; |
1160 | | }else{var G=this._findFreeUpperTrackForText(0,A); |
1161 | | var J=this._findFreeLowerTrackForText(1,A); |
1162 | | if(J-1<=G){B=false; |
1163 | | F=1; |
1164 | | E=J; |
1165 | | H=E; |
1166 | | }else{B=true; |
1167 | | F=0; |
1168 | | E=G; |
1169 | | H=-1-E; |
1170 | | }}}if(B){if(E==this._upperTracks.length){this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); |
1171 | | }for(var D=F; |
1172 | | D<E; |
1173 | | D++){I(this._upperTracks[D]); |
1174 | | }}else{if(E==this._lowerTracks.length){this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY}); |
1175 | | }for(var D=F; |
1176 | | D<E; |
1177 | | D++){I(this._lowerTracks[D]); |
1178 | | }}return H; |
1179 | | }; |
1180 | | Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText=function(A,C){for(; |
1181 | | A<this._lowerTracks.length; |
1182 | | A++){var B=this._lowerTracks[A]; |
1183 | | if(Math.min(B.solid,B.text)>=C){break; |
1184 | | }}return A; |
1185 | | }; |
1186 | | Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText=function(A,C){for(; |
1187 | | A<this._upperTracks.length; |
1188 | | A++){var B=this._upperTracks[A]; |
1189 | | if(Math.min(B.solid,B.text)>=C){break; |
1190 | | }}return A; |
1191 | | }; |
1192 | | Timeline.DetailedEventPainter.prototype._getTrackData=function(A){return(A<0)?this._upperTracks[-A-1]:this._lowerTracks[A]; |
1193 | | }; |
1194 | | Timeline.DetailedEventPainter.prototype._paintEventLine=function(J,E,D,A,G,F){var H=Math.round(G.trackOffset+D*G.trackIncrement+G.trackHeight/2); |
1195 | | var I=Math.round(Math.abs(A-D)*G.trackIncrement); |
1196 | | var C="1px solid "+F.event.label.lineColor; |
1197 | | var B=this._timeline.getDocument().createElement("div"); |
1198 | | B.style.position="absolute"; |
1199 | | B.style.left=E+"px"; |
1200 | | B.style.width=F.event.label.offsetFromLine+"px"; |
1201 | | B.style.height=I+"px"; |
1202 | | if(D>A){B.style.top=(H-I)+"px"; |
1203 | | B.style.borderTop=C; |
1204 | | }else{B.style.top=H+"px"; |
1205 | | B.style.borderBottom=C; |
1206 | | }B.style.borderLeft=C; |
1207 | | this._lineLayer.appendChild(B); |
1208 | | }; |
1209 | | Timeline.DetailedEventPainter.prototype._paintEventIcon=function(J,B,C,F,E){var H=J.getIcon(); |
1210 | | H=H!=null?H:F.icon; |
1211 | | var G=F.trackOffset+B*F.trackIncrement+F.trackHeight/2; |
1212 | | var I=Math.round(G-F.iconHeight/2); |
1213 | | var D=SimileAjax.Graphics.createTranslucentImage(H); |
1214 | | var A=this._timeline.getDocument().createElement("div"); |
1215 | | A.style.position="absolute"; |
1216 | | A.style.left=C+"px"; |
1217 | | A.style.top=I+"px"; |
1218 | | A.appendChild(D); |
1219 | | A.style.cursor="pointer"; |
1220 | | if(J._title!=null){A.title=J._title; |
1221 | | }this._eventLayer.appendChild(A); |
1222 | | return{left:C,top:I,width:F.iconWidth,height:F.iconHeight,elmt:A}; |
1223 | | }; |
1224 | | Timeline.DetailedEventPainter.prototype._paintEventLabel=function(I,J,C,F,A,G,E){var H=this._timeline.getDocument(); |
1225 | | var K=H.createElement("div"); |
1226 | | K.style.position="absolute"; |
1227 | | K.style.left=C+"px"; |
1228 | | K.style.width=A+"px"; |
1229 | | K.style.top=F+"px"; |
1230 | | K.style.height=G+"px"; |
1231 | | K.style.backgroundColor=E.event.label.backgroundColor; |
1232 | | SimileAjax.Graphics.setOpacity(K,E.event.label.backgroundOpacity); |
1233 | | this._eventLayer.appendChild(K); |
1234 | | var B=H.createElement("div"); |
1235 | | B.style.position="absolute"; |
1236 | | B.style.left=C+"px"; |
1237 | | B.style.width=A+"px"; |
1238 | | B.style.top=F+"px"; |
1239 | | B.innerHTML=J; |
1240 | | B.style.cursor="pointer"; |
1241 | | if(I._title!=null){B.title=I._title; |
1242 | | }var D=I.getTextColor(); |
1243 | | if(D==null){D=I.getColor(); |
1244 | | }if(D!=null){B.style.color=D; |
1245 | | }this._eventLayer.appendChild(B); |
1246 | | return{left:C,top:F,width:A,height:G,elmt:B}; |
1247 | | }; |
1248 | | Timeline.DetailedEventPainter.prototype._paintEventTape=function(L,B,D,A,G,C,I,H){var F=A-D; |
1249 | | var E=H.event.tape.height; |
1250 | | var K=I.trackOffset+B*I.trackIncrement+I.trackHeight/2; |
1251 | | var J=Math.round(K-E/2); |
1252 | | var M=this._timeline.getDocument().createElement("div"); |
1253 | | M.style.position="absolute"; |
1254 | | M.style.left=D+"px"; |
1255 | | M.style.width=F+"px"; |
1256 | | M.style.top=J+"px"; |
1257 | | M.style.height=E+"px"; |
1258 | | M.style.backgroundColor=G; |
1259 | | M.style.overflow="hidden"; |
1260 | | M.style.cursor="pointer"; |
1261 | | if(L._title!=null){M.title=L._title; |
1262 | | }SimileAjax.Graphics.setOpacity(M,C); |
1263 | | this._eventLayer.appendChild(M); |
1264 | | return{left:D,top:J,width:F,height:E,elmt:M}; |
1265 | | }; |
1266 | | Timeline.DetailedEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); |
1267 | | var G=E.event; |
1268 | | var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; |
1269 | | var F=D.createElement("div"); |
1270 | | F.style.position="absolute"; |
1271 | | F.style.overflow="hidden"; |
1272 | | F.style.left=(C.left-2)+"px"; |
1273 | | F.style.width=(C.width+4)+"px"; |
1274 | | F.style.top=(C.top-2)+"px"; |
1275 | | F.style.height=(C.height+4)+"px"; |
1276 | | F.style.background=B; |
1277 | | this._highlightLayer.appendChild(F); |
1278 | | }}; |
1279 | | Timeline.DetailedEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); |
1280 | | this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),B); |
1281 | | this._fireOnSelect(B.getID()); |
1282 | | A.cancelBubble=true; |
1283 | | SimileAjax.DOM.cancelEvent(A); |
1284 | | return false; |
1285 | | }; |
1286 | | Timeline.DetailedEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; |
1287 | | var E=B.pageY; |
1288 | | }else{var D=SimileAjax.DOM.getPageCoordinates(F); |
1289 | | var A=B.offsetX+D.left; |
1290 | | var E=B.offsetY+D.top; |
1291 | | }this._showBubble(A,E,C); |
1292 | | this._fireOnSelect(C.getID()); |
1293 | | B.cancelBubble=true; |
1294 | | SimileAjax.DOM.cancelEvent(B); |
1295 | | return false; |
1296 | | }; |
1297 | | Timeline.DetailedEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; |
1298 | | if(B){var C=SimileAjax.DOM.getPageCoordinates(B); |
1299 | | this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A); |
1300 | | }}; |
1301 | | Timeline.DetailedEventPainter.prototype._showBubble=function(B,E,C){var D=document.createElement("div"); |
1302 | | var A=this._params.theme.event.bubble; |
1303 | | C.fillInfoBubble(D,this._params.theme,this._band.getLabeller()); |
1304 | | SimileAjax.WindowManager.cancelPopups(); |
1305 | | SimileAjax.Graphics.createBubbleForContentAndPoint(D,B,E,A.width,null,A.maxHeight); |
1306 | | }; |
1307 | | Timeline.DetailedEventPainter.prototype._fireOnSelect=function(A){for(var B=0; |
1308 | | B<this._onSelectListeners.length; |
1309 | | B++){this._onSelectListeners[B](A); |
1310 | | }}; |
| 1487 | Timeline.DetailedEventPainter = function (A) { |
| 1488 | this._params = A; |
| 1489 | this._onSelectListeners = []; |
| 1490 | this._filterMatcher = null; |
| 1491 | this._highlightMatcher = null; |
| 1492 | this._frc = null; |
| 1493 | this._eventIdToElmt = {}; |
| 1494 | }; |
| 1495 | Timeline.DetailedEventPainter.prototype.initialize = function (B, A) { |
| 1496 | this._band = B; |
| 1497 | this._timeline = A; |
| 1498 | this._backLayer = null; |
| 1499 | this._eventLayer = null; |
| 1500 | this._lineLayer = null; |
| 1501 | this._highlightLayer = null; |
| 1502 | this._eventIdToElmt = null; |
| 1503 | }; |
| 1504 | Timeline.DetailedEventPainter.prototype.getType = function () { |
| 1505 | return "detailed"; |
| 1506 | }; |
| 1507 | Timeline.DetailedEventPainter.prototype.addOnSelectListener = function (A) { |
| 1508 | this._onSelectListeners.push(A); |
| 1509 | }; |
| 1510 | Timeline.DetailedEventPainter.prototype.removeOnSelectListener = function (B) { |
| 1511 | for (var A = 0; |
| 1512 | A < this._onSelectListeners.length; |
| 1513 | A++) { |
| 1514 | if (this._onSelectListeners[A] == B) { |
| 1515 | this._onSelectListeners.splice(A, 1); |
| 1516 | break; |
| 1517 | } |
| 1518 | } |
| 1519 | }; |
| 1520 | Timeline.DetailedEventPainter.prototype.getFilterMatcher = function () { |
| 1521 | return this._filterMatcher; |
| 1522 | }; |
| 1523 | Timeline.DetailedEventPainter.prototype.setFilterMatcher = function (A) { |
| 1524 | this._filterMatcher = A; |
| 1525 | }; |
| 1526 | Timeline.DetailedEventPainter.prototype.getHighlightMatcher = function () { |
| 1527 | return this._highlightMatcher; |
| 1528 | }; |
| 1529 | Timeline.DetailedEventPainter.prototype.setHighlightMatcher = function (A) { |
| 1530 | this._highlightMatcher = A; |
| 1531 | }; |
| 1532 | Timeline.DetailedEventPainter.prototype.paint = function () { |
| 1533 | var C = this._band.getEventSource(); |
| 1534 | if (C == null) { |
| 1535 | return; |
| 1536 | } |
| 1537 | this._eventIdToElmt = {}; |
| 1538 | this._prepareForPainting(); |
| 1539 | var I = this._params.theme.event; |
| 1540 | var G = Math.max(I.track.height, this._frc.getLineHeight()); |
| 1541 | var F = { |
| 1542 | trackOffset: Math.round(this._band.getViewWidth() / 2 - G / 2), |
| 1543 | trackHeight: G, |
| 1544 | trackGap: I.track.gap, |
| 1545 | trackIncrement: G + I.track.gap, |
| 1546 | icon: I.instant.icon, |
| 1547 | iconWidth: I.instant.iconWidth, |
| 1548 | iconHeight: I.instant.iconHeight, |
| 1549 | labelWidth: I.label.width |
| 1550 | }; |
| 1551 | var D = this._band.getMinDate(); |
| 1552 | var B = this._band.getMaxDate(); |
| 1553 | var J = (this._filterMatcher != null) ? this._filterMatcher : function (K) { |
| 1554 | return true; |
| 1555 | }; |
| 1556 | var A = (this._highlightMatcher != null) ? this._highlightMatcher : function (K) { |
| 1557 | return -1; |
| 1558 | }; |
| 1559 | var E = C.getEventReverseIterator(D, B); |
| 1560 | while (E.hasNext()) { |
| 1561 | var H = E.next(); |
| 1562 | if (J(H)) { |
| 1563 | this.paintEvent(H, F, this._params.theme, A(H)); |
| 1564 | } |
| 1565 | } |
| 1566 | this._highlightLayer.style.display = "block"; |
| 1567 | this._lineLayer.style.display = "block"; |
| 1568 | this._eventLayer.style.display = "block"; |
| 1569 | this._band.updateEventTrackInfo(this._lowerTracks.length + this._upperTracks.length, F.trackIncrement); |
| 1570 | }; |
| 1571 | Timeline.DetailedEventPainter.prototype.softPaint = function () {}; |
| 1572 | Timeline.DetailedEventPainter.prototype._prepareForPainting = function () { |
| 1573 | var B = this._band; |
| 1574 | if (this._backLayer == null) { |
| 1575 | this._backLayer = this._band.createLayerDiv(0, "timeline-band-events"); |
| 1576 | this._backLayer.style.visibility = "hidden"; |
| 1577 | var A = document.createElement("span"); |
| 1578 | A.className = "timeline-event-label"; |
| 1579 | this._backLayer.appendChild(A); |
| 1580 | this._frc = SimileAjax.Graphics.getFontRenderingContext(A); |
| 1581 | } |
| 1582 | this._frc.update(); |
| 1583 | this._lowerTracks = []; |
| 1584 | this._upperTracks = []; |
| 1585 | if (this._highlightLayer != null) { |
| 1586 | B.removeLayerDiv(this._highlightLayer); |
| 1587 | } |
| 1588 | this._highlightLayer = B.createLayerDiv(105, "timeline-band-highlights"); |
| 1589 | this._highlightLayer.style.display = "none"; |
| 1590 | if (this._lineLayer != null) { |
| 1591 | B.removeLayerDiv(this._lineLayer); |
| 1592 | } |
| 1593 | this._lineLayer = B.createLayerDiv(110, "timeline-band-lines"); |
| 1594 | this._lineLayer.style.display = "none"; |
| 1595 | if (this._eventLayer != null) { |
| 1596 | B.removeLayerDiv(this._eventLayer); |
| 1597 | } |
| 1598 | this._eventLayer = B.createLayerDiv(110, "timeline-band-events"); |
| 1599 | this._eventLayer.style.display = "none"; |
| 1600 | }; |
| 1601 | Timeline.DetailedEventPainter.prototype.paintEvent = function (B, C, D, A) { |
| 1602 | if (B.isInstant()) { |
| 1603 | this.paintInstantEvent(B, C, D, A); |
| 1604 | } else { |
| 1605 | this.paintDurationEvent(B, C, D, A); |
| 1606 | } |
| 1607 | }; |
| 1608 | Timeline.DetailedEventPainter.prototype.paintInstantEvent = function (B, C, D, A) { |
| 1609 | if (B.isImprecise()) { |
| 1610 | this.paintImpreciseInstantEvent(B, C, D, A); |
| 1611 | } else { |
| 1612 | this.paintPreciseInstantEvent(B, C, D, A); |
| 1613 | } |
| 1614 | }; |
| 1615 | Timeline.DetailedEventPainter.prototype.paintDurationEvent = function (B, C, D, A) { |
| 1616 | if (B.isImprecise()) { |
| 1617 | this.paintImpreciseDurationEvent(B, C, D, A); |
| 1618 | } else { |
| 1619 | this.paintPreciseDurationEvent(B, C, D, A); |
| 1620 | } |
| 1621 | }; |
| 1622 | Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent = function (L, P, S, Q) { |
| 1623 | var T = this._timeline.getDocument(); |
| 1624 | var J = L.getText(); |
| 1625 | var G = L.getStart(); |
| 1626 | var H = Math.round(this._band.dateToPixelOffset(G)); |
| 1627 | var A = Math.round(H + P.iconWidth / 2); |
| 1628 | var C = Math.round(H - P.iconWidth / 2); |
| 1629 | var E = this._frc.computeSize(J); |
| 1630 | var F = this._findFreeTrackForSolid(A, H); |
| 1631 | var B = this._paintEventIcon(L, F, C, P, S); |
| 1632 | var K = A + S.event.label.offsetFromLine; |
| 1633 | var O = F; |
| 1634 | var D = this._getTrackData(F); |
| 1635 | if (Math.min(D.solid, D.text) >= K + E.width) { |
| 1636 | D.solid = C; |
| 1637 | D.text = K; |
| 1638 | } else { |
| 1639 | D.solid = C; |
| 1640 | K = H + S.event.label.offsetFromLine; |
| 1641 | O = this._findFreeTrackForText(F, K + E.width, function (U) { |
| 1642 | U.line = H - 2; |
| 1643 | }); |
| 1644 | this._getTrackData(O).text = C; |
| 1645 | this._paintEventLine(L, H, F, O, P, S); |
| 1646 | } |
| 1647 | var N = Math.round(P.trackOffset + O * P.trackIncrement + P.trackHeight / 2 - E.height / 2); |
| 1648 | var R = this._paintEventLabel(L, J, K, N, E.width, E.height, S); |
| 1649 | var M = this; |
| 1650 | var I = function (V, U, W) { |
| 1651 | return M._onClickInstantEvent(B.elmt, U, L); |
| 1652 | }; |
| 1653 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", I); |
| 1654 | SimileAjax.DOM.registerEvent(R.elmt, "mousedown", I); |
| 1655 | this._createHighlightDiv(Q, B, S); |
| 1656 | this._eventIdToElmt[L.getID()] = B.elmt; |
| 1657 | }; |
| 1658 | Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent = function (O, S, W, T) { |
| 1659 | var X = this._timeline.getDocument(); |
| 1660 | var M = O.getText(); |
| 1661 | var I = O.getStart(); |
| 1662 | var U = O.getEnd(); |
| 1663 | var K = Math.round(this._band.dateToPixelOffset(I)); |
| 1664 | var B = Math.round(this._band.dateToPixelOffset(U)); |
| 1665 | var A = Math.round(K + S.iconWidth / 2); |
| 1666 | var D = Math.round(K - S.iconWidth / 2); |
| 1667 | var G = this._frc.computeSize(M); |
| 1668 | var H = this._findFreeTrackForSolid(B, K); |
| 1669 | var E = this._paintEventTape(O, H, K, B, W.event.instant.impreciseColor, W.event.instant.impreciseOpacity, S, W); |
| 1670 | var C = this._paintEventIcon(O, H, D, S, W); |
| 1671 | var F = this._getTrackData(H); |
| 1672 | F.solid = D; |
| 1673 | var N = A + W.event.label.offsetFromLine; |
| 1674 | var J = N + G.width; |
| 1675 | var R; |
| 1676 | if (J < B) { |
| 1677 | R = H; |
| 1678 | } else { |
| 1679 | N = K + W.event.label.offsetFromLine; |
| 1680 | J = N + G.width; |
| 1681 | R = this._findFreeTrackForText(H, J, function (Y) { |
| 1682 | Y.line = K - 2; |
| 1683 | }); |
| 1684 | this._getTrackData(R).text = D; |
| 1685 | this._paintEventLine(O, K, H, R, S, W); |
| 1686 | } |
| 1687 | var Q = Math.round(S.trackOffset + R * S.trackIncrement + S.trackHeight / 2 - G.height / 2); |
| 1688 | var V = this._paintEventLabel(O, M, N, Q, G.width, G.height, W); |
| 1689 | var P = this; |
| 1690 | var L = function (Z, Y, a) { |
| 1691 | return P._onClickInstantEvent(C.elmt, Y, O); |
| 1692 | }; |
| 1693 | SimileAjax.DOM.registerEvent(C.elmt, "mousedown", L); |
| 1694 | SimileAjax.DOM.registerEvent(E.elmt, "mousedown", L); |
| 1695 | SimileAjax.DOM.registerEvent(V.elmt, "mousedown", L); |
| 1696 | this._createHighlightDiv(T, C, W); |
| 1697 | this._eventIdToElmt[O.getID()] = C.elmt; |
| 1698 | }; |
| 1699 | Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent = function (K, O, T, Q) { |
| 1700 | var U = this._timeline.getDocument(); |
| 1701 | var I = K.getText(); |
| 1702 | var E = K.getStart(); |
| 1703 | var R = K.getEnd(); |
| 1704 | var F = Math.round(this._band.dateToPixelOffset(E)); |
| 1705 | var A = Math.round(this._band.dateToPixelOffset(R)); |
| 1706 | var C = this._frc.computeSize(I); |
| 1707 | var D = this._findFreeTrackForSolid(A); |
| 1708 | var P = K.getColor(); |
| 1709 | P = P != null ? P : T.event.duration.color; |
| 1710 | var B = this._paintEventTape(K, D, F, A, P, 100, O, T); |
| 1711 | var H = this._getTrackData(D); |
| 1712 | H.solid = F; |
| 1713 | var J = F + T.event.label.offsetFromLine; |
| 1714 | var N = this._findFreeTrackForText(D, J + C.width, function (V) { |
| 1715 | V.line = F - 2; |
| 1716 | }); |
| 1717 | this._getTrackData(N).text = F - 2; |
| 1718 | this._paintEventLine(K, F, D, N, O, T); |
| 1719 | var M = Math.round(O.trackOffset + N * O.trackIncrement + O.trackHeight / 2 - C.height / 2); |
| 1720 | var S = this._paintEventLabel(K, I, J, M, C.width, C.height, T); |
| 1721 | var L = this; |
| 1722 | var G = function (W, V, X) { |
| 1723 | return L._onClickDurationEvent(B.elmt, V, K); |
| 1724 | }; |
| 1725 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", G); |
| 1726 | SimileAjax.DOM.registerEvent(S.elmt, "mousedown", G); |
| 1727 | this._createHighlightDiv(Q, B, T); |
| 1728 | this._eventIdToElmt[K.getID()] = B.elmt; |
| 1729 | }; |
| 1730 | Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent = function (M, T, Y, V) { |
| 1731 | var Z = this._timeline.getDocument(); |
| 1732 | var K = M.getText(); |
| 1733 | var G = M.getStart(); |
| 1734 | var S = M.getLatestStart(); |
| 1735 | var W = M.getEnd(); |
| 1736 | var O = M.getEarliestEnd(); |
| 1737 | var H = Math.round(this._band.dateToPixelOffset(G)); |
| 1738 | var E = Math.round(this._band.dateToPixelOffset(S)); |
| 1739 | var A = Math.round(this._band.dateToPixelOffset(W)); |
| 1740 | var F = Math.round(this._band.dateToPixelOffset(O)); |
| 1741 | var C = this._frc.computeSize(K); |
| 1742 | var D = this._findFreeTrackForSolid(A); |
| 1743 | var U = M.getColor(); |
| 1744 | U = U != null ? U : Y.event.duration.color; |
| 1745 | var R = this._paintEventTape(M, D, H, A, Y.event.duration.impreciseColor, Y.event.duration.impreciseOpacity, T, Y); |
| 1746 | var B = this._paintEventTape(M, D, E, F, U, 100, T, Y); |
| 1747 | var J = this._getTrackData(D); |
| 1748 | J.solid = H; |
| 1749 | var L = E + Y.event.label.offsetFromLine; |
| 1750 | var Q = this._findFreeTrackForText(D, L + C.width, function (a) { |
| 1751 | a.line = E - 2; |
| 1752 | }); |
| 1753 | this._getTrackData(Q).text = E - 2; |
| 1754 | this._paintEventLine(M, E, D, Q, T, Y); |
| 1755 | var P = Math.round(T.trackOffset + Q * T.trackIncrement + T.trackHeight / 2 - C.height / 2); |
| 1756 | var X = this._paintEventLabel(M, K, L, P, C.width, C.height, Y); |
| 1757 | var N = this; |
| 1758 | var I = function (b, a, c) { |
| 1759 | return N._onClickDurationEvent(B.elmt, a, M); |
| 1760 | }; |
| 1761 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", I); |
| 1762 | SimileAjax.DOM.registerEvent(X.elmt, "mousedown", I); |
| 1763 | this._createHighlightDiv(V, B, Y); |
| 1764 | this._eventIdToElmt[M.getID()] = B.elmt; |
| 1765 | }; |
| 1766 | Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid = function (D, A) { |
| 1767 | for (var C = 0; |
| 1768 | true; |
| 1769 | C++) { |
| 1770 | if (C < this._lowerTracks.length) { |
| 1771 | var B = this._lowerTracks[C]; |
| 1772 | if (Math.min(B.solid, B.text) > D && (!(A) || B.line > A)) { |
| 1773 | return C; |
| 1774 | } |
| 1775 | } else { |
| 1776 | this._lowerTracks.push({ |
| 1777 | solid: Number.POSITIVE_INFINITY, |
| 1778 | text: Number.POSITIVE_INFINITY, |
| 1779 | line: Number.POSITIVE_INFINITY |
| 1780 | }); |
| 1781 | return C; |
| 1782 | } |
| 1783 | if (C < this._upperTracks.length) { |
| 1784 | var B = this._upperTracks[C]; |
| 1785 | if (Math.min(B.solid, B.text) > D && (!(A) || B.line > A)) { |
| 1786 | return -1 - C; |
| 1787 | } |
| 1788 | } else { |
| 1789 | this._upperTracks.push({ |
| 1790 | solid: Number.POSITIVE_INFINITY, |
| 1791 | text: Number.POSITIVE_INFINITY, |
| 1792 | line: Number.POSITIVE_INFINITY |
| 1793 | }); |
| 1794 | return -1 - C; |
| 1795 | } |
| 1796 | } |
| 1797 | }; |
| 1798 | Timeline.DetailedEventPainter.prototype._findFreeTrackForText = function (C, A, I) { |
| 1799 | var B; |
| 1800 | var E; |
| 1801 | var F; |
| 1802 | var H; |
| 1803 | if (C < 0) { |
| 1804 | B = true; |
| 1805 | F = -C; |
| 1806 | E = this._findFreeUpperTrackForText(F, A); |
| 1807 | H = -1 - E; |
| 1808 | } else { |
| 1809 | if (C > 0) { |
| 1810 | B = false; |
| 1811 | F = C + 1; |
| 1812 | E = this._findFreeLowerTrackForText(F, A); |
| 1813 | H = E; |
| 1814 | } else { |
| 1815 | var G = this._findFreeUpperTrackForText(0, A); |
| 1816 | var J = this._findFreeLowerTrackForText(1, A); |
| 1817 | if (J - 1 <= G) { |
| 1818 | B = false; |
| 1819 | F = 1; |
| 1820 | E = J; |
| 1821 | H = E; |
| 1822 | } else { |
| 1823 | B = true; |
| 1824 | F = 0; |
| 1825 | E = G; |
| 1826 | H = -1 - E; |
| 1827 | } |
| 1828 | } |
| 1829 | } |
| 1830 | if (B) { |
| 1831 | if (E == this._upperTracks.length) { |
| 1832 | this._upperTracks.push({ |
| 1833 | solid: Number.POSITIVE_INFINITY, |
| 1834 | text: Number.POSITIVE_INFINITY, |
| 1835 | line: Number.POSITIVE_INFINITY |
| 1836 | }); |
| 1837 | } |
| 1838 | for (var D = F; |
| 1839 | D < E; |
| 1840 | D++) { |
| 1841 | I(this._upperTracks[D]); |
| 1842 | } |
| 1843 | } else { |
| 1844 | if (E == this._lowerTracks.length) { |
| 1845 | this._lowerTracks.push({ |
| 1846 | solid: Number.POSITIVE_INFINITY, |
| 1847 | text: Number.POSITIVE_INFINITY, |
| 1848 | line: Number.POSITIVE_INFINITY |
| 1849 | }); |
| 1850 | } |
| 1851 | for (var D = F; |
| 1852 | D < E; |
| 1853 | D++) { |
| 1854 | I(this._lowerTracks[D]); |
| 1855 | } |
| 1856 | } |
| 1857 | return H; |
| 1858 | }; |
| 1859 | Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText = function (A, C) { |
| 1860 | for (; |
| 1861 | A < this._lowerTracks.length; |
| 1862 | A++) { |
| 1863 | var B = this._lowerTracks[A]; |
| 1864 | if (Math.min(B.solid, B.text) >= C) { |
| 1865 | break; |
| 1866 | } |
| 1867 | } |
| 1868 | return A; |
| 1869 | }; |
| 1870 | Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText = function (A, C) { |
| 1871 | for (; |
| 1872 | A < this._upperTracks.length; |
| 1873 | A++) { |
| 1874 | var B = this._upperTracks[A]; |
| 1875 | if (Math.min(B.solid, B.text) >= C) { |
| 1876 | break; |
| 1877 | } |
| 1878 | } |
| 1879 | return A; |
| 1880 | }; |
| 1881 | Timeline.DetailedEventPainter.prototype._getTrackData = function (A) { |
| 1882 | return (A < 0) ? this._upperTracks[-A - 1] : this._lowerTracks[A]; |
| 1883 | }; |
| 1884 | Timeline.DetailedEventPainter.prototype._paintEventLine = function (J, E, D, A, G, F) { |
| 1885 | var H = Math.round(G.trackOffset + D * G.trackIncrement + G.trackHeight / 2); |
| 1886 | var I = Math.round(Math.abs(A - D) * G.trackIncrement); |
| 1887 | var C = "1px solid " + F.event.label.lineColor; |
| 1888 | var B = this._timeline.getDocument().createElement("div"); |
| 1889 | B.style.position = "absolute"; |
| 1890 | B.style.left = E + "px"; |
| 1891 | B.style.width = F.event.label.offsetFromLine + "px"; |
| 1892 | B.style.height = I + "px"; |
| 1893 | if (D > A) { |
| 1894 | B.style.top = (H - I) + "px"; |
| 1895 | B.style.borderTop = C; |
| 1896 | } else { |
| 1897 | B.style.top = H + "px"; |
| 1898 | B.style.borderBottom = C; |
| 1899 | } |
| 1900 | B.style.borderLeft = C; |
| 1901 | this._lineLayer.appendChild(B); |
| 1902 | }; |
| 1903 | Timeline.DetailedEventPainter.prototype._paintEventIcon = function (J, B, C, F, E) { |
| 1904 | var H = J.getIcon(); |
| 1905 | H = H != null ? H : F.icon; |
| 1906 | var G = F.trackOffset + B * F.trackIncrement + F.trackHeight / 2; |
| 1907 | var I = Math.round(G - F.iconHeight / 2); |
| 1908 | var D = SimileAjax.Graphics.createTranslucentImage(H); |
| 1909 | var A = this._timeline.getDocument().createElement("div"); |
| 1910 | A.style.position = "absolute"; |
| 1911 | A.style.left = C + "px"; |
| 1912 | A.style.top = I + "px"; |
| 1913 | A.appendChild(D); |
| 1914 | A.style.cursor = "pointer"; |
| 1915 | if (J._title != null) { |
| 1916 | A.title = J._title; |
| 1917 | } |
| 1918 | this._eventLayer.appendChild(A); |
| 1919 | return { |
| 1920 | left: C, |
| 1921 | top: I, |
| 1922 | width: F.iconWidth, |
| 1923 | height: F.iconHeight, |
| 1924 | elmt: A |
| 1925 | }; |
| 1926 | }; |
| 1927 | Timeline.DetailedEventPainter.prototype._paintEventLabel = function (I, J, C, F, A, G, E) { |
| 1928 | var H = this._timeline.getDocument(); |
| 1929 | var K = H.createElement("div"); |
| 1930 | K.style.position = "absolute"; |
| 1931 | K.style.left = C + "px"; |
| 1932 | K.style.width = A + "px"; |
| 1933 | K.style.top = F + "px"; |
| 1934 | K.style.height = G + "px"; |
| 1935 | K.style.backgroundColor = E.event.label.backgroundColor; |
| 1936 | SimileAjax.Graphics.setOpacity(K, E.event.label.backgroundOpacity); |
| 1937 | this._eventLayer.appendChild(K); |
| 1938 | var B = H.createElement("div"); |
| 1939 | B.style.position = "absolute"; |
| 1940 | B.style.left = C + "px"; |
| 1941 | B.style.width = A + "px"; |
| 1942 | B.style.top = F + "px"; |
| 1943 | B.innerHTML = J; |
| 1944 | B.style.cursor = "pointer"; |
| 1945 | if (I._title != null) { |
| 1946 | B.title = I._title; |
| 1947 | } |
| 1948 | var D = I.getTextColor(); |
| 1949 | if (D == null) { |
| 1950 | D = I.getColor(); |
| 1951 | } |
| 1952 | if (D != null) { |
| 1953 | B.style.color = D; |
| 1954 | } |
| 1955 | this._eventLayer.appendChild(B); |
| 1956 | return { |
| 1957 | left: C, |
| 1958 | top: F, |
| 1959 | width: A, |
| 1960 | height: G, |
| 1961 | elmt: B |
| 1962 | }; |
| 1963 | }; |
| 1964 | Timeline.DetailedEventPainter.prototype._paintEventTape = function (L, B, D, A, G, C, I, H) { |
| 1965 | var F = A - D; |
| 1966 | var E = H.event.tape.height; |
| 1967 | var K = I.trackOffset + B * I.trackIncrement + I.trackHeight / 2; |
| 1968 | var J = Math.round(K - E / 2); |
| 1969 | var M = this._timeline.getDocument().createElement("div"); |
| 1970 | M.style.position = "absolute"; |
| 1971 | M.style.left = D + "px"; |
| 1972 | M.style.width = F + "px"; |
| 1973 | M.style.top = J + "px"; |
| 1974 | M.style.height = E + "px"; |
| 1975 | M.style.backgroundColor = G; |
| 1976 | M.style.overflow = "hidden"; |
| 1977 | M.style.cursor = "pointer"; |
| 1978 | if (L._title != null) { |
| 1979 | M.title = L._title; |
| 1980 | } |
| 1981 | SimileAjax.Graphics.setOpacity(M, C); |
| 1982 | this._eventLayer.appendChild(M); |
| 1983 | return { |
| 1984 | left: D, |
| 1985 | top: J, |
| 1986 | width: F, |
| 1987 | height: E, |
| 1988 | elmt: M |
| 1989 | }; |
| 1990 | }; |
| 1991 | Timeline.DetailedEventPainter.prototype._createHighlightDiv = function (A, C, E) { |
| 1992 | if (A >= 0) { |
| 1993 | var D = this._timeline.getDocument(); |
| 1994 | var G = E.event; |
| 1995 | var B = G.highlightColors[Math.min(A, G.highlightColors.length - 1)]; |
| 1996 | var F = D.createElement("div"); |
| 1997 | F.style.position = "absolute"; |
| 1998 | F.style.overflow = "hidden"; |
| 1999 | F.style.left = (C.left - 2) + "px"; |
| 2000 | F.style.width = (C.width + 4) + "px"; |
| 2001 | F.style.top = (C.top - 2) + "px"; |
| 2002 | F.style.height = (C.height + 4) + "px"; |
| 2003 | F.style.background = B; |
| 2004 | this._highlightLayer.appendChild(F); |
| 2005 | } |
| 2006 | }; |
| 2007 | Timeline.DetailedEventPainter.prototype._onClickInstantEvent = function (C, A, B) { |
| 2008 | var D = SimileAjax.DOM.getPageCoordinates(C); |
| 2009 | this._showBubble(D.left + Math.ceil(C.offsetWidth / 2), D.top + Math.ceil(C.offsetHeight / 2), B); |
| 2010 | this._fireOnSelect(B.getID()); |
| 2011 | A.cancelBubble = true; |
| 2012 | SimileAjax.DOM.cancelEvent(A); |
| 2013 | return false; |
| 2014 | }; |
| 2015 | Timeline.DetailedEventPainter.prototype._onClickDurationEvent = function (F, B, C) { |
| 2016 | if ("pageX" in B) { |
| 2017 | var A = B.pageX; |
| 2018 | var E = B.pageY; |
| 2019 | } else { |
| 2020 | var D = SimileAjax.DOM.getPageCoordinates(F); |
| 2021 | var A = B.offsetX + D.left; |
| 2022 | var E = B.offsetY + D.top; |
| 2023 | } |
| 2024 | this._showBubble(A, E, C); |
| 2025 | this._fireOnSelect(C.getID()); |
| 2026 | B.cancelBubble = true; |
| 2027 | SimileAjax.DOM.cancelEvent(B); |
| 2028 | return false; |
| 2029 | }; |
| 2030 | Timeline.DetailedEventPainter.prototype.showBubble = function (A) { |
| 2031 | var B = this._eventIdToElmt[A.getID()]; |
| 2032 | if (B) { |
| 2033 | var C = SimileAjax.DOM.getPageCoordinates(B); |
| 2034 | this._showBubble(C.left + B.offsetWidth / 2, C.top + B.offsetHeight / 2, A); |
| 2035 | } |
| 2036 | }; |
| 2037 | Timeline.DetailedEventPainter.prototype._showBubble = function (B, E, C) { |
| 2038 | var D = document.createElement("div"); |
| 2039 | var A = this._params.theme.event.bubble; |
| 2040 | C.fillInfoBubble(D, this._params.theme, this._band.getLabeller()); |
| 2041 | SimileAjax.WindowManager.cancelPopups(); |
| 2042 | SimileAjax.Graphics.createBubbleForContentAndPoint(D, B, E, A.width, null, A.maxHeight); |
| 2043 | }; |
| 2044 | Timeline.DetailedEventPainter.prototype._fireOnSelect = function (A) { |
| 2045 | for (var B = 0; |
| 2046 | B < this._onSelectListeners.length; |
| 2047 | B++) { |
| 2048 | this._onSelectListeners[B](A); |
| 2049 | } |
| 2050 | }; |
1314 | | Timeline.GregorianEtherPainter=function(A){this._params=A; |
1315 | | this._theme=A.theme; |
1316 | | this._unit=A.unit; |
1317 | | this._multiple=("multiple" in A)?A.multiple:1; |
1318 | | }; |
1319 | | Timeline.GregorianEtherPainter.prototype.initialize=function(C,B){this._band=C; |
1320 | | this._timeline=B; |
1321 | | this._backgroundLayer=C.createLayerDiv(0); |
1322 | | this._backgroundLayer.setAttribute("name","ether-background"); |
1323 | | this._backgroundLayer.className="timeline-ether-bg"; |
1324 | | this._markerLayer=null; |
1325 | | this._lineLayer=null; |
1326 | | var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; |
1327 | | var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; |
1328 | | this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); |
1329 | | this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); |
1330 | | }; |
1331 | | Timeline.GregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); |
1332 | | }; |
1333 | | Timeline.GregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); |
1334 | | }this._markerLayer=this._band.createLayerDiv(100); |
1335 | | this._markerLayer.setAttribute("name","ether-markers"); |
1336 | | this._markerLayer.style.display="none"; |
1337 | | if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); |
1338 | | }this._lineLayer=this._band.createLayerDiv(1); |
1339 | | this._lineLayer.setAttribute("name","ether-lines"); |
1340 | | this._lineLayer.style.display="none"; |
1341 | | var C=this._band.getMinDate(); |
1342 | | var F=this._band.getMaxDate(); |
1343 | | var A=this._band.getTimeZone(); |
1344 | | var E=this._band.getLabeller(); |
1345 | | SimileAjax.DateTime.roundDownToInterval(C,this._unit,A,this._multiple,this._theme.firstDayOfWeek); |
1346 | | var D=this; |
1347 | | var B=function(G){for(var H=0; |
1348 | | H<D._multiple; |
1349 | | H++){SimileAjax.DateTime.incrementByInterval(G,D._unit); |
1350 | | }}; |
1351 | | while(C.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(C,E,this._unit,this._markerLayer,this._lineLayer); |
1352 | | B(C); |
1353 | | }this._markerLayer.style.display="block"; |
1354 | | this._lineLayer.style.display="block"; |
1355 | | }; |
1356 | | Timeline.GregorianEtherPainter.prototype.softPaint=function(){}; |
1357 | | Timeline.GregorianEtherPainter.prototype.zoom=function(A){if(A!=0){this._unit+=A; |
1358 | | }}; |
1359 | | Timeline.HotZoneGregorianEtherPainter=function(G){this._params=G; |
1360 | | this._theme=G.theme; |
1361 | | this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,unit:G.unit,multiple:1}]; |
1362 | | for(var F=0; |
1363 | | F<G.zones.length; |
1364 | | F++){var C=G.zones[F]; |
1365 | | var E=SimileAjax.DateTime.parseGregorianDateTime(C.start).getTime(); |
1366 | | var B=SimileAjax.DateTime.parseGregorianDateTime(C.end).getTime(); |
1367 | | for(var D=0; |
1368 | | D<this._zones.length&&B>E; |
1369 | | D++){var A=this._zones[D]; |
1370 | | if(E<A.endTime){if(E>A.startTime){this._zones.splice(D,0,{startTime:A.startTime,endTime:E,unit:A.unit,multiple:A.multiple}); |
1371 | | D++; |
1372 | | A.startTime=E; |
1373 | | }if(B<A.endTime){this._zones.splice(D,0,{startTime:E,endTime:B,unit:C.unit,multiple:(C.multiple)?C.multiple:1}); |
1374 | | D++; |
1375 | | A.startTime=B; |
1376 | | E=B; |
1377 | | }else{A.multiple=C.multiple; |
1378 | | A.unit=C.unit; |
1379 | | E=A.endTime; |
1380 | | }}}}}; |
1381 | | Timeline.HotZoneGregorianEtherPainter.prototype.initialize=function(C,B){this._band=C; |
1382 | | this._timeline=B; |
1383 | | this._backgroundLayer=C.createLayerDiv(0); |
1384 | | this._backgroundLayer.setAttribute("name","ether-background"); |
1385 | | this._backgroundLayer.className="timeline-ether-bg"; |
1386 | | this._markerLayer=null; |
1387 | | this._lineLayer=null; |
1388 | | var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; |
1389 | | var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; |
1390 | | this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); |
1391 | | this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); |
1392 | | }; |
1393 | | Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); |
1394 | | }; |
1395 | | Timeline.HotZoneGregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); |
1396 | | }this._markerLayer=this._band.createLayerDiv(100); |
1397 | | this._markerLayer.setAttribute("name","ether-markers"); |
1398 | | this._markerLayer.style.display="none"; |
1399 | | if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); |
1400 | | }this._lineLayer=this._band.createLayerDiv(1); |
1401 | | this._lineLayer.setAttribute("name","ether-lines"); |
1402 | | this._lineLayer.style.display="none"; |
1403 | | var C=this._band.getMinDate(); |
1404 | | var A=this._band.getMaxDate(); |
1405 | | var I=this._band.getTimeZone(); |
1406 | | var L=this._band.getLabeller(); |
1407 | | var B=this; |
1408 | | var J=function(N,M){for(var O=0; |
1409 | | O<M.multiple; |
1410 | | O++){SimileAjax.DateTime.incrementByInterval(N,M.unit); |
1411 | | }}; |
1412 | | var D=0; |
1413 | | while(D<this._zones.length){if(C.getTime()<this._zones[D].endTime){break; |
1414 | | }D++; |
1415 | | }var E=this._zones.length-1; |
1416 | | while(E>=0){if(A.getTime()>this._zones[E].startTime){break; |
1417 | | }E--; |
1418 | | }for(var H=D; |
1419 | | H<=E; |
1420 | | H++){var G=this._zones[H]; |
1421 | | var K=new Date(Math.max(C.getTime(),G.startTime)); |
1422 | | var F=new Date(Math.min(A.getTime(),G.endTime)); |
1423 | | SimileAjax.DateTime.roundDownToInterval(K,G.unit,I,G.multiple,this._theme.firstDayOfWeek); |
1424 | | SimileAjax.DateTime.roundUpToInterval(F,G.unit,I,G.multiple,this._theme.firstDayOfWeek); |
1425 | | while(K.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(K,L,G.unit,this._markerLayer,this._lineLayer); |
1426 | | J(K,G); |
1427 | | }}this._markerLayer.style.display="block"; |
1428 | | this._lineLayer.style.display="block"; |
1429 | | }; |
1430 | | Timeline.HotZoneGregorianEtherPainter.prototype.softPaint=function(){}; |
1431 | | Timeline.HotZoneGregorianEtherPainter.prototype.zoom=function(A){if(A!=0){for(var B=0; |
1432 | | B<this._zones.length; |
1433 | | ++B){if(this._zones[B]){this._zones[B].unit+=A; |
1434 | | }}}}; |
1435 | | Timeline.YearCountEtherPainter=function(A){this._params=A; |
1436 | | this._theme=A.theme; |
1437 | | this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate); |
1438 | | this._multiple=("multiple" in A)?A.multiple:1; |
1439 | | }; |
1440 | | Timeline.YearCountEtherPainter.prototype.initialize=function(C,B){this._band=C; |
1441 | | this._timeline=B; |
1442 | | this._backgroundLayer=C.createLayerDiv(0); |
1443 | | this._backgroundLayer.setAttribute("name","ether-background"); |
1444 | | this._backgroundLayer.className="timeline-ether-bg"; |
1445 | | this._markerLayer=null; |
1446 | | this._lineLayer=null; |
1447 | | var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; |
1448 | | var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; |
1449 | | this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); |
1450 | | this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); |
1451 | | }; |
1452 | | Timeline.YearCountEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); |
1453 | | }; |
1454 | | Timeline.YearCountEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); |
1455 | | }this._markerLayer=this._band.createLayerDiv(100); |
1456 | | this._markerLayer.setAttribute("name","ether-markers"); |
1457 | | this._markerLayer.style.display="none"; |
1458 | | if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); |
1459 | | }this._lineLayer=this._band.createLayerDiv(1); |
1460 | | this._lineLayer.setAttribute("name","ether-lines"); |
1461 | | this._lineLayer.style.display="none"; |
1462 | | var B=new Date(this._startDate.getTime()); |
1463 | | var F=this._band.getMaxDate(); |
1464 | | var E=this._band.getMinDate().getUTCFullYear()-this._startDate.getUTCFullYear(); |
1465 | | B.setUTCFullYear(this._band.getMinDate().getUTCFullYear()-E%this._multiple); |
1466 | | var C=this; |
1467 | | var A=function(G){for(var H=0; |
1468 | | H<C._multiple; |
1469 | | H++){SimileAjax.DateTime.incrementByInterval(G,SimileAjax.DateTime.YEAR); |
1470 | | }}; |
1471 | | var D={labelInterval:function(G,I){var H=G.getUTCFullYear()-C._startDate.getUTCFullYear(); |
1472 | | return{text:H,emphasized:H==0}; |
1473 | | }}; |
1474 | | while(B.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer); |
1475 | | A(B); |
1476 | | }this._markerLayer.style.display="block"; |
1477 | | this._lineLayer.style.display="block"; |
1478 | | }; |
1479 | | Timeline.YearCountEtherPainter.prototype.softPaint=function(){}; |
1480 | | Timeline.QuarterlyEtherPainter=function(A){this._params=A; |
1481 | | this._theme=A.theme; |
1482 | | this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate); |
1483 | | }; |
1484 | | Timeline.QuarterlyEtherPainter.prototype.initialize=function(C,B){this._band=C; |
1485 | | this._timeline=B; |
1486 | | this._backgroundLayer=C.createLayerDiv(0); |
1487 | | this._backgroundLayer.setAttribute("name","ether-background"); |
1488 | | this._backgroundLayer.className="timeline-ether-bg"; |
1489 | | this._markerLayer=null; |
1490 | | this._lineLayer=null; |
1491 | | var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"]; |
1492 | | var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show; |
1493 | | this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A); |
1494 | | this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer); |
1495 | | }; |
1496 | | Timeline.QuarterlyEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B); |
1497 | | }; |
1498 | | Timeline.QuarterlyEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer); |
1499 | | }this._markerLayer=this._band.createLayerDiv(100); |
1500 | | this._markerLayer.setAttribute("name","ether-markers"); |
1501 | | this._markerLayer.style.display="none"; |
1502 | | if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer); |
1503 | | }this._lineLayer=this._band.createLayerDiv(1); |
1504 | | this._lineLayer.setAttribute("name","ether-lines"); |
1505 | | this._lineLayer.style.display="none"; |
1506 | | var B=new Date(0); |
1507 | | var E=this._band.getMaxDate(); |
1508 | | B.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(),this._band.getMinDate().getUTCFullYear())); |
1509 | | B.setUTCMonth(this._startDate.getUTCMonth()); |
1510 | | var C=this; |
1511 | | var A=function(F){F.setUTCMonth(F.getUTCMonth()+3); |
1512 | | }; |
1513 | | var D={labelInterval:function(G,H){var F=(4+(G.getUTCMonth()-C._startDate.getUTCMonth())/3)%4; |
1514 | | if(F!=0){return{text:"Q"+(F+1),emphasized:false}; |
1515 | | }else{return{text:"Y"+(G.getUTCFullYear()-C._startDate.getUTCFullYear()+1),emphasized:true}; |
1516 | | }}}; |
1517 | | while(B.getTime()<E.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer); |
1518 | | A(B); |
1519 | | }this._markerLayer.style.display="block"; |
1520 | | this._lineLayer.style.display="block"; |
1521 | | }; |
1522 | | Timeline.QuarterlyEtherPainter.prototype.softPaint=function(){}; |
1523 | | Timeline.EtherIntervalMarkerLayout=function(I,L,C,E,M){var A=I.isHorizontal(); |
1524 | | if(A){if(E=="Top"){this.positionDiv=function(O,N){O.style.left=N+"px"; |
1525 | | O.style.top="0px"; |
1526 | | }; |
1527 | | }else{this.positionDiv=function(O,N){O.style.left=N+"px"; |
1528 | | O.style.bottom="0px"; |
1529 | | }; |
1530 | | }}else{if(E=="Left"){this.positionDiv=function(O,N){O.style.top=N+"px"; |
1531 | | O.style.left="0px"; |
1532 | | }; |
1533 | | }else{this.positionDiv=function(O,N){O.style.top=N+"px"; |
1534 | | O.style.right="0px"; |
1535 | | }; |
1536 | | }}var D=C.ether.interval.marker; |
1537 | | var K=C.ether.interval.line; |
1538 | | var B=C.ether.interval.weekend; |
1539 | | var H=(A?"h":"v")+E; |
1540 | | var G=D[H+"Styler"]; |
1541 | | var J=D[H+"EmphasizedStyler"]; |
1542 | | var F=SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]; |
1543 | | this.createIntervalMarker=function(T,c,a,Y,P){var U=Math.round(L.dateToPixelOffset(T)); |
1544 | | if(M&&a!=SimileAjax.DateTime.WEEK){var V=I.getDocument().createElement("div"); |
1545 | | V.className="timeline-ether-lines"; |
1546 | | if(K.opacity<100){SimileAjax.Graphics.setOpacity(V,K.opacity); |
1547 | | }if(A){V.style.left=U+"px"; |
1548 | | }else{V.style.top=U+"px"; |
1549 | | }P.appendChild(V); |
1550 | | }if(a==SimileAjax.DateTime.WEEK){var N=C.firstDayOfWeek; |
1551 | | var R=new Date(T.getTime()+(6-N-7)*F); |
1552 | | var b=new Date(R.getTime()+2*F); |
1553 | | var Q=Math.round(L.dateToPixelOffset(R)); |
1554 | | var S=Math.round(L.dateToPixelOffset(b)); |
1555 | | var W=Math.max(1,S-Q); |
1556 | | var X=I.getDocument().createElement("div"); |
1557 | | X.className="timeline-ether-weekends"; |
1558 | | if(B.opacity<100){SimileAjax.Graphics.setOpacity(X,B.opacity); |
1559 | | }if(A){X.style.left=Q+"px"; |
1560 | | X.style.width=W+"px"; |
1561 | | }else{X.style.top=Q+"px"; |
1562 | | X.style.height=W+"px"; |
1563 | | }P.appendChild(X); |
1564 | | }var Z=c.labelInterval(T,a); |
1565 | | var O=I.getDocument().createElement("div"); |
1566 | | O.innerHTML=Z.text; |
1567 | | O.className="timeline-date-label"; |
1568 | | if(Z.emphasized){O.className+=" timeline-date-label-em"; |
1569 | | }this.positionDiv(O,U); |
1570 | | Y.appendChild(O); |
1571 | | return O; |
1572 | | }; |
1573 | | }; |
1574 | | Timeline.EtherHighlight=function(B,E,D,C){var A=B.isHorizontal(); |
1575 | | this._highlightDiv=null; |
1576 | | this._createHighlightDiv=function(){if(this._highlightDiv==null){this._highlightDiv=B.getDocument().createElement("div"); |
1577 | | this._highlightDiv.setAttribute("name","ether-highlight"); |
1578 | | this._highlightDiv.className="timeline-ether-highlight"; |
1579 | | var F=D.ether.highlightOpacity; |
1580 | | if(F<100){SimileAjax.Graphics.setOpacity(this._highlightDiv,F); |
1581 | | }C.appendChild(this._highlightDiv); |
1582 | | }}; |
1583 | | this.position=function(H,J){this._createHighlightDiv(); |
1584 | | var I=Math.round(E.dateToPixelOffset(H)); |
1585 | | var G=Math.round(E.dateToPixelOffset(J)); |
1586 | | var F=Math.max(G-I,3); |
1587 | | if(A){this._highlightDiv.style.left=I+"px"; |
1588 | | this._highlightDiv.style.width=F+"px"; |
1589 | | this._highlightDiv.style.height=(E.getViewWidth()-4)+"px"; |
1590 | | }else{this._highlightDiv.style.top=I+"px"; |
1591 | | this._highlightDiv.style.height=F+"px"; |
1592 | | this._highlightDiv.style.width=(E.getViewWidth()-4)+"px"; |
1593 | | }}; |
| 2054 | Timeline.GregorianEtherPainter = function (A) { |
| 2055 | this._params = A; |
| 2056 | this._theme = A.theme; |
| 2057 | this._unit = A.unit; |
| 2058 | this._multiple = ("multiple" in A) ? A.multiple : 1; |
| 2059 | }; |
| 2060 | Timeline.GregorianEtherPainter.prototype.initialize = function (C, B) { |
| 2061 | this._band = C; |
| 2062 | this._timeline = B; |
| 2063 | this._backgroundLayer = C.createLayerDiv(0); |
| 2064 | this._backgroundLayer.setAttribute("name", "ether-background"); |
| 2065 | this._backgroundLayer.className = "timeline-ether-bg"; |
| 2066 | this._markerLayer = null; |
| 2067 | this._lineLayer = null; |
| 2068 | var D = ("align" in this._params && this._params.align != undefined) ? this._params.align : this._theme.ether.interval.marker[B.isHorizontal() ? "hAlign" : "vAlign"]; |
| 2069 | var A = ("showLine" in this._params) ? this._params.showLine : this._theme.ether.interval.line.show; |
| 2070 | this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(this._timeline, this._band, this._theme, D, A); |
| 2071 | this._highlight = new Timeline.EtherHighlight(this._timeline, this._band, this._theme, this._backgroundLayer); |
| 2072 | }; |
| 2073 | Timeline.GregorianEtherPainter.prototype.setHighlight = function (A, B) { |
| 2074 | this._highlight.position(A, B); |
| 2075 | }; |
| 2076 | Timeline.GregorianEtherPainter.prototype.paint = function () { |
| 2077 | if (this._markerLayer) { |
| 2078 | this._band.removeLayerDiv(this._markerLayer); |
| 2079 | } |
| 2080 | this._markerLayer = this._band.createLayerDiv(100); |
| 2081 | this._markerLayer.setAttribute("name", "ether-markers"); |
| 2082 | this._markerLayer.style.display = "none"; |
| 2083 | if (this._lineLayer) { |
| 2084 | this._band.removeLayerDiv(this._lineLayer); |
| 2085 | } |
| 2086 | this._lineLayer = this._band.createLayerDiv(1); |
| 2087 | this._lineLayer.setAttribute("name", "ether-lines"); |
| 2088 | this._lineLayer.style.display = "none"; |
| 2089 | var C = this._band.getMinDate(); |
| 2090 | var F = this._band.getMaxDate(); |
| 2091 | var A = this._band.getTimeZone(); |
| 2092 | var E = this._band.getLabeller(); |
| 2093 | SimileAjax.DateTime.roundDownToInterval(C, this._unit, A, this._multiple, this._theme.firstDayOfWeek); |
| 2094 | var D = this; |
| 2095 | var B = function (G) { |
| 2096 | for (var H = 0; |
| 2097 | H < D._multiple; |
| 2098 | H++) { |
| 2099 | SimileAjax.DateTime.incrementByInterval(G, D._unit); |
| 2100 | } |
| 2101 | }; |
| 2102 | while (C.getTime() < F.getTime()) { |
| 2103 | this._intervalMarkerLayout.createIntervalMarker(C, E, this._unit, this._markerLayer, this._lineLayer); |
| 2104 | B(C); |
| 2105 | } |
| 2106 | this._markerLayer.style.display = "block"; |
| 2107 | this._lineLayer.style.display = "block"; |
| 2108 | }; |
| 2109 | Timeline.GregorianEtherPainter.prototype.softPaint = function () {}; |
| 2110 | Timeline.GregorianEtherPainter.prototype.zoom = function (A) { |
| 2111 | if (A != 0) { |
| 2112 | this._unit += A; |
| 2113 | } |
| 2114 | }; |
| 2115 | Timeline.HotZoneGregorianEtherPainter = function (G) { |
| 2116 | this._params = G; |
| 2117 | this._theme = G.theme; |
| 2118 | this._zones = [{ |
| 2119 | startTime: Number.NEGATIVE_INFINITY, |
| 2120 | endTime: Number.POSITIVE_INFINITY, |
| 2121 | unit: G.unit, |
| 2122 | multiple: 1 |
| 2123 | }]; |
| 2124 | for (var F = 0; |
| 2125 | F < G.zones.length; |
| 2126 | F++) { |
| 2127 | var C = G.zones[F]; |
| 2128 | var E = SimileAjax.DateTime.parseGregorianDateTime(C.start).getTime(); |
| 2129 | var B = SimileAjax.DateTime.parseGregorianDateTime(C.end).getTime(); |
| 2130 | for (var D = 0; |
| 2131 | D < this._zones.length && B > E; |
| 2132 | D++) { |
| 2133 | var A = this._zones[D]; |
| 2134 | if (E < A.endTime) { |
| 2135 | if (E > A.startTime) { |
| 2136 | this._zones.splice(D, 0, { |
| 2137 | startTime: A.startTime, |
| 2138 | endTime: E, |
| 2139 | unit: A.unit, |
| 2140 | multiple: A.multiple |
| 2141 | }); |
| 2142 | D++; |
| 2143 | A.startTime = E; |
| 2144 | } |
| 2145 | if (B < A.endTime) { |
| 2146 | this._zones.splice(D, 0, { |
| 2147 | startTime: E, |
| 2148 | endTime: B, |
| 2149 | unit: C.unit, |
| 2150 | multiple: (C.multiple) ? C.multiple : 1 |
| 2151 | }); |
| 2152 | D++; |
| 2153 | A.startTime = B; |
| 2154 | E = B; |
| 2155 | } else { |
| 2156 | A.multiple = C.multiple; |
| 2157 | A.unit = C.unit; |
| 2158 | E = A.endTime; |
| 2159 | } |
| 2160 | } |
| 2161 | } |
| 2162 | } |
| 2163 | }; |
| 2164 | Timeline.HotZoneGregorianEtherPainter.prototype.initialize = function (C, B) { |
| 2165 | this._band = C; |
| 2166 | this._timeline = B; |
| 2167 | this._backgroundLayer = C.createLayerDiv(0); |
| 2168 | this._backgroundLayer.setAttribute("name", "ether-background"); |
| 2169 | this._backgroundLayer.className = "timeline-ether-bg"; |
| 2170 | this._markerLayer = null; |
| 2171 | this._lineLayer = null; |
| 2172 | var D = ("align" in this._params && this._params.align != undefined) ? this._params.align : this._theme.ether.interval.marker[B.isHorizontal() ? "hAlign" : "vAlign"]; |
| 2173 | var A = ("showLine" in this._params) ? this._params.showLine : this._theme.ether.interval.line.show; |
| 2174 | this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(this._timeline, this._band, this._theme, D, A); |
| 2175 | this._highlight = new Timeline.EtherHighlight(this._timeline, this._band, this._theme, this._backgroundLayer); |
| 2176 | }; |
| 2177 | Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight = function (A, B) { |
| 2178 | this._highlight.position(A, B); |
| 2179 | }; |
| 2180 | Timeline.HotZoneGregorianEtherPainter.prototype.paint = function () { |
| 2181 | if (this._markerLayer) { |
| 2182 | this._band.removeLayerDiv(this._markerLayer); |
| 2183 | } |
| 2184 | this._markerLayer = this._band.createLayerDiv(100); |
| 2185 | this._markerLayer.setAttribute("name", "ether-markers"); |
| 2186 | this._markerLayer.style.display = "none"; |
| 2187 | if (this._lineLayer) { |
| 2188 | this._band.removeLayerDiv(this._lineLayer); |
| 2189 | } |
| 2190 | this._lineLayer = this._band.createLayerDiv(1); |
| 2191 | this._lineLayer.setAttribute("name", "ether-lines"); |
| 2192 | this._lineLayer.style.display = "none"; |
| 2193 | var C = this._band.getMinDate(); |
| 2194 | var A = this._band.getMaxDate(); |
| 2195 | var I = this._band.getTimeZone(); |
| 2196 | var L = this._band.getLabeller(); |
| 2197 | var B = this; |
| 2198 | var J = function (N, M) { |
| 2199 | for (var O = 0; |
| 2200 | O < M.multiple; |
| 2201 | O++) { |
| 2202 | SimileAjax.DateTime.incrementByInterval(N, M.unit); |
| 2203 | } |
| 2204 | }; |
| 2205 | var D = 0; |
| 2206 | while (D < this._zones.length) { |
| 2207 | if (C.getTime() < this._zones[D].endTime) { |
| 2208 | break; |
| 2209 | } |
| 2210 | D++; |
| 2211 | } |
| 2212 | var E = this._zones.length - 1; |
| 2213 | while (E >= 0) { |
| 2214 | if (A.getTime() > this._zones[E].startTime) { |
| 2215 | break; |
| 2216 | } |
| 2217 | E--; |
| 2218 | } |
| 2219 | for (var H = D; |
| 2220 | H <= E; |
| 2221 | H++) { |
| 2222 | var G = this._zones[H]; |
| 2223 | var K = new Date(Math.max(C.getTime(), G.startTime)); |
| 2224 | var F = new Date(Math.min(A.getTime(), G.endTime)); |
| 2225 | SimileAjax.DateTime.roundDownToInterval(K, G.unit, I, G.multiple, this._theme.firstDayOfWeek); |
| 2226 | SimileAjax.DateTime.roundUpToInterval(F, G.unit, I, G.multiple, this._theme.firstDayOfWeek); |
| 2227 | while (K.getTime() < F.getTime()) { |
| 2228 | this._intervalMarkerLayout.createIntervalMarker(K, L, G.unit, this._markerLayer, this._lineLayer); |
| 2229 | J(K, G); |
| 2230 | } |
| 2231 | } |
| 2232 | this._markerLayer.style.display = "block"; |
| 2233 | this._lineLayer.style.display = "block"; |
| 2234 | }; |
| 2235 | Timeline.HotZoneGregorianEtherPainter.prototype.softPaint = function () {}; |
| 2236 | Timeline.HotZoneGregorianEtherPainter.prototype.zoom = function (A) { |
| 2237 | if (A != 0) { |
| 2238 | for (var B = 0; |
| 2239 | B < this._zones.length; ++B) { |
| 2240 | if (this._zones[B]) { |
| 2241 | this._zones[B].unit += A; |
| 2242 | } |
| 2243 | } |
| 2244 | } |
| 2245 | }; |
| 2246 | Timeline.YearCountEtherPainter = function (A) { |
| 2247 | this._params = A; |
| 2248 | this._theme = A.theme; |
| 2249 | this._startDate = SimileAjax.DateTime.parseGregorianDateTime(A.startDate); |
| 2250 | this._multiple = ("multiple" in A) ? A.multiple : 1; |
| 2251 | }; |
| 2252 | Timeline.YearCountEtherPainter.prototype.initialize = function (C, B) { |
| 2253 | this._band = C; |
| 2254 | this._timeline = B; |
| 2255 | this._backgroundLayer = C.createLayerDiv(0); |
| 2256 | this._backgroundLayer.setAttribute("name", "ether-background"); |
| 2257 | this._backgroundLayer.className = "timeline-ether-bg"; |
| 2258 | this._markerLayer = null; |
| 2259 | this._lineLayer = null; |
| 2260 | var D = ("align" in this._params) ? this._params.align : this._theme.ether.interval.marker[B.isHorizontal() ? "hAlign" : "vAlign"]; |
| 2261 | var A = ("showLine" in this._params) ? this._params.showLine : this._theme.ether.interval.line.show; |
| 2262 | this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(this._timeline, this._band, this._theme, D, A); |
| 2263 | this._highlight = new Timeline.EtherHighlight(this._timeline, this._band, this._theme, this._backgroundLayer); |
| 2264 | }; |
| 2265 | Timeline.YearCountEtherPainter.prototype.setHighlight = function (A, B) { |
| 2266 | this._highlight.position(A, B); |
| 2267 | }; |
| 2268 | Timeline.YearCountEtherPainter.prototype.paint = function () { |
| 2269 | if (this._markerLayer) { |
| 2270 | this._band.removeLayerDiv(this._markerLayer); |
| 2271 | } |
| 2272 | this._markerLayer = this._band.createLayerDiv(100); |
| 2273 | this._markerLayer.setAttribute("name", "ether-markers"); |
| 2274 | this._markerLayer.style.display = "none"; |
| 2275 | if (this._lineLayer) { |
| 2276 | this._band.removeLayerDiv(this._lineLayer); |
| 2277 | } |
| 2278 | this._lineLayer = this._band.createLayerDiv(1); |
| 2279 | this._lineLayer.setAttribute("name", "ether-lines"); |
| 2280 | this._lineLayer.style.display = "none"; |
| 2281 | var B = new Date(this._startDate.getTime()); |
| 2282 | var F = this._band.getMaxDate(); |
| 2283 | var E = this._band.getMinDate().getUTCFullYear() - this._startDate.getUTCFullYear(); |
| 2284 | B.setUTCFullYear(this._band.getMinDate().getUTCFullYear() - E % this._multiple); |
| 2285 | var C = this; |
| 2286 | var A = function (G) { |
| 2287 | for (var H = 0; |
| 2288 | H < C._multiple; |
| 2289 | H++) { |
| 2290 | SimileAjax.DateTime.incrementByInterval(G, SimileAjax.DateTime.YEAR); |
| 2291 | } |
| 2292 | }; |
| 2293 | var D = { |
| 2294 | labelInterval: function (G, I) { |
| 2295 | var H = G.getUTCFullYear() - C._startDate.getUTCFullYear(); |
| 2296 | return { |
| 2297 | text: H, |
| 2298 | emphasized: H == 0 |
| 2299 | }; |
| 2300 | } |
| 2301 | }; |
| 2302 | while (B.getTime() < F.getTime()) { |
| 2303 | this._intervalMarkerLayout.createIntervalMarker(B, D, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer); |
| 2304 | A(B); |
| 2305 | } |
| 2306 | this._markerLayer.style.display = "block"; |
| 2307 | this._lineLayer.style.display = "block"; |
| 2308 | }; |
| 2309 | Timeline.YearCountEtherPainter.prototype.softPaint = function () {}; |
| 2310 | Timeline.QuarterlyEtherPainter = function (A) { |
| 2311 | this._params = A; |
| 2312 | this._theme = A.theme; |
| 2313 | this._startDate = SimileAjax.DateTime.parseGregorianDateTime(A.startDate); |
| 2314 | }; |
| 2315 | Timeline.QuarterlyEtherPainter.prototype.initialize = function (C, B) { |
| 2316 | this._band = C; |
| 2317 | this._timeline = B; |
| 2318 | this._backgroundLayer = C.createLayerDiv(0); |
| 2319 | this._backgroundLayer.setAttribute("name", "ether-background"); |
| 2320 | this._backgroundLayer.className = "timeline-ether-bg"; |
| 2321 | this._markerLayer = null; |
| 2322 | this._lineLayer = null; |
| 2323 | var D = ("align" in this._params) ? this._params.align : this._theme.ether.interval.marker[B.isHorizontal() ? "hAlign" : "vAlign"]; |
| 2324 | var A = ("showLine" in this._params) ? this._params.showLine : this._theme.ether.interval.line.show; |
| 2325 | this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(this._timeline, this._band, this._theme, D, A); |
| 2326 | this._highlight = new Timeline.EtherHighlight(this._timeline, this._band, this._theme, this._backgroundLayer); |
| 2327 | }; |
| 2328 | Timeline.QuarterlyEtherPainter.prototype.setHighlight = function (A, B) { |
| 2329 | this._highlight.position(A, B); |
| 2330 | }; |
| 2331 | Timeline.QuarterlyEtherPainter.prototype.paint = function () { |
| 2332 | if (this._markerLayer) { |
| 2333 | this._band.removeLayerDiv(this._markerLayer); |
| 2334 | } |
| 2335 | this._markerLayer = this._band.createLayerDiv(100); |
| 2336 | this._markerLayer.setAttribute("name", "ether-markers"); |
| 2337 | this._markerLayer.style.display = "none"; |
| 2338 | if (this._lineLayer) { |
| 2339 | this._band.removeLayerDiv(this._lineLayer); |
| 2340 | } |
| 2341 | this._lineLayer = this._band.createLayerDiv(1); |
| 2342 | this._lineLayer.setAttribute("name", "ether-lines"); |
| 2343 | this._lineLayer.style.display = "none"; |
| 2344 | var B = new Date(0); |
| 2345 | var E = this._band.getMaxDate(); |
| 2346 | B.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(), this._band.getMinDate().getUTCFullYear())); |
| 2347 | B.setUTCMonth(this._startDate.getUTCMonth()); |
| 2348 | var C = this; |
| 2349 | var A = function (F) { |
| 2350 | F.setUTCMonth(F.getUTCMonth() + 3); |
| 2351 | }; |
| 2352 | var D = { |
| 2353 | labelInterval: function (G, H) { |
| 2354 | var F = (4 + (G.getUTCMonth() - C._startDate.getUTCMonth()) / 3) % 4; |
| 2355 | if (F != 0) { |
| 2356 | return { |
| 2357 | text: "Q" + (F + 1), |
| 2358 | emphasized: false |
| 2359 | }; |
| 2360 | } else { |
| 2361 | return { |
| 2362 | text: "Y" + (G.getUTCFullYear() - C._startDate.getUTCFullYear() + 1), |
| 2363 | emphasized: true |
| 2364 | }; |
| 2365 | } |
| 2366 | } |
| 2367 | }; |
| 2368 | while (B.getTime() < E.getTime()) { |
| 2369 | this._intervalMarkerLayout.createIntervalMarker(B, D, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer); |
| 2370 | A(B); |
| 2371 | } |
| 2372 | this._markerLayer.style.display = "block"; |
| 2373 | this._lineLayer.style.display = "block"; |
| 2374 | }; |
| 2375 | Timeline.QuarterlyEtherPainter.prototype.softPaint = function () {}; |
| 2376 | Timeline.EtherIntervalMarkerLayout = function (I, L, C, E, M) { |
| 2377 | var A = I.isHorizontal(); |
| 2378 | if (A) { |
| 2379 | if (E == "Top") { |
| 2380 | this.positionDiv = function (O, N) { |
| 2381 | O.style.left = N + "px"; |
| 2382 | O.style.top = "0px"; |
| 2383 | }; |
| 2384 | } else { |
| 2385 | this.positionDiv = function (O, N) { |
| 2386 | O.style.left = N + "px"; |
| 2387 | O.style.bottom = "0px"; |
| 2388 | }; |
| 2389 | } |
| 2390 | } else { |
| 2391 | if (E == "Left") { |
| 2392 | this.positionDiv = function (O, N) { |
| 2393 | O.style.top = N + "px"; |
| 2394 | O.style.left = "0px"; |
| 2395 | }; |
| 2396 | } else { |
| 2397 | this.positionDiv = function (O, N) { |
| 2398 | O.style.top = N + "px"; |
| 2399 | O.style.right = "0px"; |
| 2400 | }; |
| 2401 | } |
| 2402 | } |
| 2403 | var D = C.ether.interval.marker; |
| 2404 | var K = C.ether.interval.line; |
| 2405 | var B = C.ether.interval.weekend; |
| 2406 | var H = (A ? "h" : "v") + E; |
| 2407 | var G = D[H + "Styler"]; |
| 2408 | var J = D[H + "EmphasizedStyler"]; |
| 2409 | var F = SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]; |
| 2410 | this.createIntervalMarker = function (T, c, a, Y, P) { |
| 2411 | var U = Math.round(L.dateToPixelOffset(T)); |
| 2412 | if (M && a != SimileAjax.DateTime.WEEK) { |
| 2413 | var V = I.getDocument().createElement("div"); |
| 2414 | V.className = "timeline-ether-lines"; |
| 2415 | if (K.opacity < 100) { |
| 2416 | SimileAjax.Graphics.setOpacity(V, K.opacity); |
| 2417 | } |
| 2418 | if (A) { |
| 2419 | V.style.left = U + "px"; |
| 2420 | } else { |
| 2421 | V.style.top = U + "px"; |
| 2422 | } |
| 2423 | P.appendChild(V); |
| 2424 | } |
| 2425 | if (a == SimileAjax.DateTime.WEEK) { |
| 2426 | var N = C.firstDayOfWeek; |
| 2427 | var R = new Date(T.getTime() + (6 - N - 7) * F); |
| 2428 | var b = new Date(R.getTime() + 2 * F); |
| 2429 | var Q = Math.round(L.dateToPixelOffset(R)); |
| 2430 | var S = Math.round(L.dateToPixelOffset(b)); |
| 2431 | var W = Math.max(1, S - Q); |
| 2432 | var X = I.getDocument().createElement("div"); |
| 2433 | X.className = "timeline-ether-weekends"; |
| 2434 | if (B.opacity < 100) { |
| 2435 | SimileAjax.Graphics.setOpacity(X, B.opacity); |
| 2436 | } |
| 2437 | if (A) { |
| 2438 | X.style.left = Q + "px"; |
| 2439 | X.style.width = W + "px"; |
| 2440 | } else { |
| 2441 | X.style.top = Q + "px"; |
| 2442 | X.style.height = W + "px"; |
| 2443 | } |
| 2444 | P.appendChild(X); |
| 2445 | } |
| 2446 | var Z = c.labelInterval(T, a); |
| 2447 | var O = I.getDocument().createElement("div"); |
| 2448 | O.innerHTML = Z.text; |
| 2449 | O.className = "timeline-date-label"; |
| 2450 | if (Z.emphasized) { |
| 2451 | O.className += " timeline-date-label-em"; |
| 2452 | } |
| 2453 | this.positionDiv(O, U); |
| 2454 | Y.appendChild(O); |
| 2455 | return O; |
| 2456 | }; |
| 2457 | }; |
| 2458 | Timeline.EtherHighlight = function (B, E, D, C) { |
| 2459 | var A = B.isHorizontal(); |
| 2460 | this._highlightDiv = null; |
| 2461 | this._createHighlightDiv = function () { |
| 2462 | if (this._highlightDiv == null) { |
| 2463 | this._highlightDiv = B.getDocument().createElement("div"); |
| 2464 | this._highlightDiv.setAttribute("name", "ether-highlight"); |
| 2465 | this._highlightDiv.className = "timeline-ether-highlight"; |
| 2466 | var F = D.ether.highlightOpacity; |
| 2467 | if (F < 100) { |
| 2468 | SimileAjax.Graphics.setOpacity(this._highlightDiv, F); |
| 2469 | } |
| 2470 | C.appendChild(this._highlightDiv); |
| 2471 | } |
| 2472 | }; |
| 2473 | this.position = function (H, J) { |
| 2474 | this._createHighlightDiv(); |
| 2475 | var I = Math.round(E.dateToPixelOffset(H)); |
| 2476 | var G = Math.round(E.dateToPixelOffset(J)); |
| 2477 | var F = Math.max(G - I, 3); |
| 2478 | if (A) { |
| 2479 | this._highlightDiv.style.left = I + "px"; |
| 2480 | this._highlightDiv.style.width = F + "px"; |
| 2481 | this._highlightDiv.style.height = (E.getViewWidth() - 4) + "px"; |
| 2482 | } else { |
| 2483 | this._highlightDiv.style.top = I + "px"; |
| 2484 | this._highlightDiv.style.height = F + "px"; |
| 2485 | this._highlightDiv.style.width = (E.getViewWidth() - 4) + "px"; |
| 2486 | } |
| 2487 | }; |
1598 | | Timeline.LinearEther=function(A){this._params=A; |
1599 | | this._interval=A.interval; |
1600 | | this._pixelsPerInterval=A.pixelsPerInterval; |
1601 | | }; |
1602 | | Timeline.LinearEther.prototype.initialize=function(B,A){this._band=B; |
1603 | | this._timeline=A; |
1604 | | this._unit=A.getUnit(); |
1605 | | if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn); |
1606 | | }else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn); |
1607 | | this.shiftPixels(-this._timeline.getPixelLength()); |
1608 | | }else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn); |
1609 | | this.shiftPixels(-this._timeline.getPixelLength()/2); |
1610 | | }else{this._start=this._unit.makeDefaultValue(); |
1611 | | this.shiftPixels(-this._timeline.getPixelLength()/2); |
1612 | | }}}}; |
1613 | | Timeline.LinearEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A); |
1614 | | }; |
1615 | | Timeline.LinearEther.prototype.shiftPixels=function(B){var A=this._interval*B/this._pixelsPerInterval; |
1616 | | this._start=this._unit.change(this._start,A); |
1617 | | }; |
1618 | | Timeline.LinearEther.prototype.dateToPixelOffset=function(B){var A=this._unit.compare(B,this._start); |
1619 | | return this._pixelsPerInterval*A/this._interval; |
1620 | | }; |
1621 | | Timeline.LinearEther.prototype.pixelOffsetToDate=function(B){var A=B*this._interval/this._pixelsPerInterval; |
1622 | | return this._unit.change(this._start,A); |
1623 | | }; |
1624 | | Timeline.LinearEther.prototype.zoom=function(D){var A=0; |
1625 | | var B=this._band._zoomIndex; |
1626 | | var C=B; |
1627 | | if(D&&(B>0)){C=B-1; |
1628 | | }if(!D&&(B<(this._band._zoomSteps.length-1))){C=B+1; |
1629 | | }this._band._zoomIndex=C; |
1630 | | this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; |
1631 | | this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval; |
1632 | | A=this._band._zoomSteps[C].unit-this._band._zoomSteps[B].unit; |
1633 | | return A; |
1634 | | }; |
1635 | | Timeline.HotZoneEther=function(A){this._params=A; |
1636 | | this._interval=A.interval; |
1637 | | this._pixelsPerInterval=A.pixelsPerInterval; |
1638 | | this._theme=A.theme; |
1639 | | }; |
1640 | | Timeline.HotZoneEther.prototype.initialize=function(I,H){this._band=I; |
1641 | | this._timeline=H; |
1642 | | this._unit=H.getUnit(); |
1643 | | this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,magnify:1}]; |
1644 | | var D=this._params; |
1645 | | for(var E=0; |
1646 | | E<D.zones.length; |
1647 | | E++){var G=D.zones[E]; |
1648 | | var F=this._unit.parseFromObject(G.start); |
1649 | | var B=this._unit.parseFromObject(G.end); |
1650 | | for(var C=0; |
1651 | | C<this._zones.length&&this._unit.compare(B,F)>0; |
1652 | | C++){var A=this._zones[C]; |
1653 | | if(this._unit.compare(F,A.endTime)<0){if(this._unit.compare(F,A.startTime)>0){this._zones.splice(C,0,{startTime:A.startTime,endTime:F,magnify:A.magnify}); |
1654 | | C++; |
1655 | | A.startTime=F; |
1656 | | }if(this._unit.compare(B,A.endTime)<0){this._zones.splice(C,0,{startTime:F,endTime:B,magnify:G.magnify*A.magnify}); |
1657 | | C++; |
1658 | | A.startTime=B; |
1659 | | F=B; |
1660 | | }else{A.magnify*=G.magnify; |
1661 | | F=A.endTime; |
1662 | | }}}}if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn); |
1663 | | }else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn); |
1664 | | this.shiftPixels(-this._timeline.getPixelLength()); |
1665 | | }else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn); |
1666 | | this.shiftPixels(-this._timeline.getPixelLength()/2); |
1667 | | }else{this._start=this._unit.makeDefaultValue(); |
1668 | | this.shiftPixels(-this._timeline.getPixelLength()/2); |
1669 | | }}}}; |
1670 | | Timeline.HotZoneEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A); |
1671 | | }; |
1672 | | Timeline.HotZoneEther.prototype.shiftPixels=function(A){this._start=this.pixelOffsetToDate(A); |
1673 | | }; |
1674 | | Timeline.HotZoneEther.prototype.dateToPixelOffset=function(A){return this._dateDiffToPixelOffset(this._start,A); |
1675 | | }; |
1676 | | Timeline.HotZoneEther.prototype.pixelOffsetToDate=function(A){return this._pixelOffsetToDate(A,this._start); |
1677 | | }; |
1678 | | Timeline.HotZoneEther.prototype.zoom=function(D){var A=0; |
1679 | | var B=this._band._zoomIndex; |
1680 | | var C=B; |
1681 | | if(D&&(B>0)){C=B-1; |
1682 | | }if(!D&&(B<(this._band._zoomSteps.length-1))){C=B+1; |
1683 | | }this._band._zoomIndex=C; |
1684 | | this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; |
1685 | | this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval; |
1686 | | A=this._band._zoomSteps[C].unit-this._band._zoomSteps[B].unit; |
1687 | | return A; |
1688 | | }; |
1689 | | Timeline.HotZoneEther.prototype._dateDiffToPixelOffset=function(H,C){var D=this._getScale(); |
1690 | | var I=H; |
1691 | | var B=C; |
1692 | | var E=0; |
1693 | | if(this._unit.compare(I,B)<0){var G=0; |
1694 | | while(G<this._zones.length){if(this._unit.compare(I,this._zones[G].endTime)<0){break; |
1695 | | }G++; |
1696 | | }while(this._unit.compare(I,B)<0){var F=this._zones[G]; |
1697 | | var A=this._unit.earlier(B,F.endTime); |
1698 | | E+=(this._unit.compare(A,I)/(D/F.magnify)); |
1699 | | I=A; |
1700 | | G++; |
1701 | | }}else{var G=this._zones.length-1; |
1702 | | while(G>=0){if(this._unit.compare(I,this._zones[G].startTime)>0){break; |
1703 | | }G--; |
1704 | | }while(this._unit.compare(I,B)>0){var F=this._zones[G]; |
1705 | | var A=this._unit.later(B,F.startTime); |
1706 | | E+=(this._unit.compare(A,I)/(D/F.magnify)); |
1707 | | I=A; |
1708 | | G--; |
1709 | | }}return E; |
1710 | | }; |
1711 | | Timeline.HotZoneEther.prototype._pixelOffsetToDate=function(E,B){var G=this._getScale(); |
1712 | | var D=B; |
1713 | | if(E>0){var F=0; |
1714 | | while(F<this._zones.length){if(this._unit.compare(D,this._zones[F].endTime)<0){break; |
1715 | | }F++; |
1716 | | }while(E>0){var A=this._zones[F]; |
1717 | | var H=G/A.magnify; |
1718 | | if(A.endTime==Number.POSITIVE_INFINITY){D=this._unit.change(D,E*H); |
1719 | | E=0; |
1720 | | }else{var C=this._unit.compare(A.endTime,D)/H; |
1721 | | if(C>E){D=this._unit.change(D,E*H); |
1722 | | E=0; |
1723 | | }else{D=A.endTime; |
1724 | | E-=C; |
1725 | | }}F++; |
1726 | | }}else{var F=this._zones.length-1; |
1727 | | while(F>=0){if(this._unit.compare(D,this._zones[F].startTime)>0){break; |
1728 | | }F--; |
1729 | | }E=-E; |
1730 | | while(E>0){var A=this._zones[F]; |
1731 | | var H=G/A.magnify; |
1732 | | if(A.startTime==Number.NEGATIVE_INFINITY){D=this._unit.change(D,-E*H); |
1733 | | E=0; |
1734 | | }else{var C=this._unit.compare(D,A.startTime)/H; |
1735 | | if(C>E){D=this._unit.change(D,-E*H); |
1736 | | E=0; |
1737 | | }else{D=A.startTime; |
1738 | | E-=C; |
1739 | | }}F--; |
1740 | | }}return D; |
1741 | | }; |
1742 | | Timeline.HotZoneEther.prototype._getScale=function(){return this._interval/this._pixelsPerInterval; |
| 2492 | Timeline.LinearEther = function (A) { |
| 2493 | this._params = A; |
| 2494 | this._interval = A.interval; |
| 2495 | this._pixelsPerInterval = A.pixelsPerInterval; |
| 2496 | }; |
| 2497 | Timeline.LinearEther.prototype.initialize = function (B, A) { |
| 2498 | this._band = B; |
| 2499 | this._timeline = A; |
| 2500 | this._unit = A.getUnit(); |
| 2501 | if ("startsOn" in this._params) { |
| 2502 | this._start = this._unit.parseFromObject(this._params.startsOn); |
| 2503 | } else { |
| 2504 | if ("endsOn" in this._params) { |
| 2505 | this._start = this._unit.parseFromObject(this._params.endsOn); |
| 2506 | this.shiftPixels(-this._timeline.getPixelLength()); |
| 2507 | } else { |
| 2508 | if ("centersOn" in this._params) { |
| 2509 | this._start = this._unit.parseFromObject(this._params.centersOn); |
| 2510 | this.shiftPixels(-this._timeline.getPixelLength() / 2); |
| 2511 | } else { |
| 2512 | this._start = this._unit.makeDefaultValue(); |
| 2513 | this.shiftPixels(-this._timeline.getPixelLength() / 2); |
| 2514 | } |
| 2515 | } |
| 2516 | } |
| 2517 | }; |
| 2518 | Timeline.LinearEther.prototype.setDate = function (A) { |
| 2519 | this._start = this._unit.cloneValue(A); |
| 2520 | }; |
| 2521 | Timeline.LinearEther.prototype.shiftPixels = function (B) { |
| 2522 | var A = this._interval * B / this._pixelsPerInterval; |
| 2523 | this._start = this._unit.change(this._start, A); |
| 2524 | }; |
| 2525 | Timeline.LinearEther.prototype.dateToPixelOffset = function (B) { |
| 2526 | var A = this._unit.compare(B, this._start); |
| 2527 | return this._pixelsPerInterval * A / this._interval; |
| 2528 | }; |
| 2529 | Timeline.LinearEther.prototype.pixelOffsetToDate = function (B) { |
| 2530 | var A = B * this._interval / this._pixelsPerInterval; |
| 2531 | return this._unit.change(this._start, A); |
| 2532 | }; |
| 2533 | Timeline.LinearEther.prototype.zoom = function (D) { |
| 2534 | var A = 0; |
| 2535 | var B = this._band._zoomIndex; |
| 2536 | var C = B; |
| 2537 | if (D && (B > 0)) { |
| 2538 | C = B - 1; |
| 2539 | } |
| 2540 | if (!D && (B < (this._band._zoomSteps.length - 1))) { |
| 2541 | C = B + 1; |
| 2542 | } |
| 2543 | this._band._zoomIndex = C; |
| 2544 | this._interval = SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; |
| 2545 | this._pixelsPerInterval = this._band._zoomSteps[C].pixelsPerInterval; |
| 2546 | A = this._band._zoomSteps[C].unit - this._band._zoomSteps[B].unit; |
| 2547 | return A; |
| 2548 | }; |
| 2549 | Timeline.HotZoneEther = function (A) { |
| 2550 | this._params = A; |
| 2551 | this._interval = A.interval; |
| 2552 | this._pixelsPerInterval = A.pixelsPerInterval; |
| 2553 | this._theme = A.theme; |
| 2554 | }; |
| 2555 | Timeline.HotZoneEther.prototype.initialize = function (I, H) { |
| 2556 | this._band = I; |
| 2557 | this._timeline = H; |
| 2558 | this._unit = H.getUnit(); |
| 2559 | this._zones = [{ |
| 2560 | startTime: Number.NEGATIVE_INFINITY, |
| 2561 | endTime: Number.POSITIVE_INFINITY, |
| 2562 | magnify: 1 |
| 2563 | }]; |
| 2564 | var D = this._params; |
| 2565 | for (var E = 0; |
| 2566 | E < D.zones.length; |
| 2567 | E++) { |
| 2568 | var G = D.zones[E]; |
| 2569 | var F = this._unit.parseFromObject(G.start); |
| 2570 | var B = this._unit.parseFromObject(G.end); |
| 2571 | for (var C = 0; |
| 2572 | C < this._zones.length && this._unit.compare(B, F) > 0; |
| 2573 | C++) { |
| 2574 | var A = this._zones[C]; |
| 2575 | if (this._unit.compare(F, A.endTime) < 0) { |
| 2576 | if (this._unit.compare(F, A.startTime) > 0) { |
| 2577 | this._zones.splice(C, 0, { |
| 2578 | startTime: A.startTime, |
| 2579 | endTime: F, |
| 2580 | magnify: A.magnify |
| 2581 | }); |
| 2582 | C++; |
| 2583 | A.startTime = F; |
| 2584 | } |
| 2585 | if (this._unit.compare(B, A.endTime) < 0) { |
| 2586 | this._zones.splice(C, 0, { |
| 2587 | startTime: F, |
| 2588 | endTime: B, |
| 2589 | magnify: G.magnify * A.magnify |
| 2590 | }); |
| 2591 | C++; |
| 2592 | A.startTime = B; |
| 2593 | F = B; |
| 2594 | } else { |
| 2595 | A.magnify *= G.magnify; |
| 2596 | F = A.endTime; |
| 2597 | } |
| 2598 | } |
| 2599 | } |
| 2600 | } |
| 2601 | if ("startsOn" in this._params) { |
| 2602 | this._start = this._unit.parseFromObject(this._params.startsOn); |
| 2603 | } else { |
| 2604 | if ("endsOn" in this._params) { |
| 2605 | this._start = this._unit.parseFromObject(this._params.endsOn); |
| 2606 | this.shiftPixels(-this._timeline.getPixelLength()); |
| 2607 | } else { |
| 2608 | if ("centersOn" in this._params) { |
| 2609 | this._start = this._unit.parseFromObject(this._params.centersOn); |
| 2610 | this.shiftPixels(-this._timeline.getPixelLength() / 2); |
| 2611 | } else { |
| 2612 | this._start = this._unit.makeDefaultValue(); |
| 2613 | this.shiftPixels(-this._timeline.getPixelLength() / 2); |
| 2614 | } |
| 2615 | } |
| 2616 | } |
| 2617 | }; |
| 2618 | Timeline.HotZoneEther.prototype.setDate = function (A) { |
| 2619 | this._start = this._unit.cloneValue(A); |
| 2620 | }; |
| 2621 | Timeline.HotZoneEther.prototype.shiftPixels = function (A) { |
| 2622 | this._start = this.pixelOffsetToDate(A); |
| 2623 | }; |
| 2624 | Timeline.HotZoneEther.prototype.dateToPixelOffset = function (A) { |
| 2625 | return this._dateDiffToPixelOffset(this._start, A); |
| 2626 | }; |
| 2627 | Timeline.HotZoneEther.prototype.pixelOffsetToDate = function (A) { |
| 2628 | return this._pixelOffsetToDate(A, this._start); |
| 2629 | }; |
| 2630 | Timeline.HotZoneEther.prototype.zoom = function (D) { |
| 2631 | var A = 0; |
| 2632 | var B = this._band._zoomIndex; |
| 2633 | var C = B; |
| 2634 | if (D && (B > 0)) { |
| 2635 | C = B - 1; |
| 2636 | } |
| 2637 | if (!D && (B < (this._band._zoomSteps.length - 1))) { |
| 2638 | C = B + 1; |
| 2639 | } |
| 2640 | this._band._zoomIndex = C; |
| 2641 | this._interval = SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit]; |
| 2642 | this._pixelsPerInterval = this._band._zoomSteps[C].pixelsPerInterval; |
| 2643 | A = this._band._zoomSteps[C].unit - this._band._zoomSteps[B].unit; |
| 2644 | return A; |
| 2645 | }; |
| 2646 | Timeline.HotZoneEther.prototype._dateDiffToPixelOffset = function (H, C) { |
| 2647 | var D = this._getScale(); |
| 2648 | var I = H; |
| 2649 | var B = C; |
| 2650 | var E = 0; |
| 2651 | if (this._unit.compare(I, B) < 0) { |
| 2652 | var G = 0; |
| 2653 | while (G < this._zones.length) { |
| 2654 | if (this._unit.compare(I, this._zones[G].endTime) < 0) { |
| 2655 | break; |
| 2656 | } |
| 2657 | G++; |
| 2658 | } |
| 2659 | while (this._unit.compare(I, B) < 0) { |
| 2660 | var F = this._zones[G]; |
| 2661 | var A = this._unit.earlier(B, F.endTime); |
| 2662 | E += (this._unit.compare(A, I) / (D / F.magnify)); |
| 2663 | I = A; |
| 2664 | G++; |
| 2665 | } |
| 2666 | } else { |
| 2667 | var G = this._zones.length - 1; |
| 2668 | while (G >= 0) { |
| 2669 | if (this._unit.compare(I, this._zones[G].startTime) > 0) { |
| 2670 | break; |
| 2671 | } |
| 2672 | G--; |
| 2673 | } |
| 2674 | while (this._unit.compare(I, B) > 0) { |
| 2675 | var F = this._zones[G]; |
| 2676 | var A = this._unit.later(B, F.startTime); |
| 2677 | E += (this._unit.compare(A, I) / (D / F.magnify)); |
| 2678 | I = A; |
| 2679 | G--; |
| 2680 | } |
| 2681 | } |
| 2682 | return E; |
| 2683 | }; |
| 2684 | Timeline.HotZoneEther.prototype._pixelOffsetToDate = function (E, B) { |
| 2685 | var G = this._getScale(); |
| 2686 | var D = B; |
| 2687 | if (E > 0) { |
| 2688 | var F = 0; |
| 2689 | while (F < this._zones.length) { |
| 2690 | if (this._unit.compare(D, this._zones[F].endTime) < 0) { |
| 2691 | break; |
| 2692 | } |
| 2693 | F++; |
| 2694 | } |
| 2695 | while (E > 0) { |
| 2696 | var A = this._zones[F]; |
| 2697 | var H = G / A.magnify; |
| 2698 | if (A.endTime == Number.POSITIVE_INFINITY) { |
| 2699 | D = this._unit.change(D, E * H); |
| 2700 | E = 0; |
| 2701 | } else { |
| 2702 | var C = this._unit.compare(A.endTime, D) / H; |
| 2703 | if (C > E) { |
| 2704 | D = this._unit.change(D, E * H); |
| 2705 | E = 0; |
| 2706 | } else { |
| 2707 | D = A.endTime; |
| 2708 | E -= C; |
| 2709 | } |
| 2710 | } |
| 2711 | F++; |
| 2712 | } |
| 2713 | } else { |
| 2714 | var F = this._zones.length - 1; |
| 2715 | while (F >= 0) { |
| 2716 | if (this._unit.compare(D, this._zones[F].startTime) > 0) { |
| 2717 | break; |
| 2718 | } |
| 2719 | F--; |
| 2720 | } |
| 2721 | E = -E; |
| 2722 | while (E > 0) { |
| 2723 | var A = this._zones[F]; |
| 2724 | var H = G / A.magnify; |
| 2725 | if (A.startTime == Number.NEGATIVE_INFINITY) { |
| 2726 | D = this._unit.change(D, -E * H); |
| 2727 | E = 0; |
| 2728 | } else { |
| 2729 | var C = this._unit.compare(D, A.startTime) / H; |
| 2730 | if (C > E) { |
| 2731 | D = this._unit.change(D, -E * H); |
| 2732 | E = 0; |
| 2733 | } else { |
| 2734 | D = A.startTime; |
| 2735 | E -= C; |
| 2736 | } |
| 2737 | } |
| 2738 | F--; |
| 2739 | } |
| 2740 | } |
| 2741 | return D; |
| 2742 | }; |
| 2743 | Timeline.HotZoneEther.prototype._getScale = function () { |
| 2744 | return this._interval / this._pixelsPerInterval; |
1811 | | Timeline.OriginalEventPainter=function(A){this._params=A; |
1812 | | this._onSelectListeners=[]; |
1813 | | this._eventPaintListeners=[]; |
1814 | | this._filterMatcher=null; |
1815 | | this._highlightMatcher=null; |
1816 | | this._frc=null; |
1817 | | this._eventIdToElmt={}; |
1818 | | }; |
1819 | | Timeline.OriginalEventPainter.prototype.initialize=function(B,A){this._band=B; |
1820 | | this._timeline=A; |
1821 | | this._backLayer=null; |
1822 | | this._eventLayer=null; |
1823 | | this._lineLayer=null; |
1824 | | this._highlightLayer=null; |
1825 | | this._eventIdToElmt=null; |
1826 | | }; |
1827 | | Timeline.OriginalEventPainter.prototype.getType=function(){return"original"; |
1828 | | }; |
1829 | | Timeline.OriginalEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); |
1830 | | }; |
1831 | | Timeline.OriginalEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; |
1832 | | A<this._onSelectListeners.length; |
1833 | | A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); |
1834 | | break; |
1835 | | }}}; |
1836 | | Timeline.OriginalEventPainter.prototype.addEventPaintListener=function(A){this._eventPaintListeners.push(A); |
1837 | | }; |
1838 | | Timeline.OriginalEventPainter.prototype.removeEventPaintListener=function(B){for(var A=0; |
1839 | | A<this._eventPaintListeners.length; |
1840 | | A++){if(this._eventPaintListeners[A]==B){this._eventPaintListeners.splice(A,1); |
1841 | | break; |
1842 | | }}}; |
1843 | | Timeline.OriginalEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; |
1844 | | }; |
1845 | | Timeline.OriginalEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; |
1846 | | }; |
1847 | | Timeline.OriginalEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; |
1848 | | }; |
1849 | | Timeline.OriginalEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; |
1850 | | }; |
1851 | | Timeline.OriginalEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); |
1852 | | if(C==null){return ; |
1853 | | }this._eventIdToElmt={}; |
1854 | | this._fireEventPaintListeners("paintStarting",null,null); |
1855 | | this._prepareForPainting(); |
1856 | | var I=this._params.theme.event; |
1857 | | var G=Math.max(I.track.height,I.tape.height+this._frc.getLineHeight()); |
1858 | | 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}; |
1859 | | var D=this._band.getMinDate(); |
1860 | | var B=this._band.getMaxDate(); |
1861 | | var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true; |
1862 | | }; |
1863 | | var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1; |
1864 | | }; |
1865 | | var E=C.getEventReverseIterator(D,B); |
1866 | | while(E.hasNext()){var H=E.next(); |
1867 | | if(J(H)){this.paintEvent(H,F,this._params.theme,A(H)); |
1868 | | }}this._highlightLayer.style.display="block"; |
1869 | | this._lineLayer.style.display="block"; |
1870 | | this._eventLayer.style.display="block"; |
1871 | | this._band.updateEventTrackInfo(this._tracks.length,F.trackIncrement); |
1872 | | this._fireEventPaintListeners("paintEnded",null,null); |
1873 | | }; |
1874 | | Timeline.OriginalEventPainter.prototype.softPaint=function(){}; |
1875 | | Timeline.OriginalEventPainter.prototype._prepareForPainting=function(){var B=this._band; |
1876 | | if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events"); |
1877 | | this._backLayer.style.visibility="hidden"; |
1878 | | var A=document.createElement("span"); |
1879 | | A.className="timeline-event-label"; |
1880 | | this._backLayer.appendChild(A); |
1881 | | this._frc=SimileAjax.Graphics.getFontRenderingContext(A); |
1882 | | }this._frc.update(); |
1883 | | this._tracks=[]; |
1884 | | if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer); |
1885 | | }this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights"); |
1886 | | this._highlightLayer.style.display="none"; |
1887 | | if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer); |
1888 | | }this._lineLayer=B.createLayerDiv(110,"timeline-band-lines"); |
1889 | | this._lineLayer.style.display="none"; |
1890 | | if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer); |
1891 | | }this._eventLayer=B.createLayerDiv(115,"timeline-band-events"); |
1892 | | this._eventLayer.style.display="none"; |
1893 | | }; |
1894 | | Timeline.OriginalEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); |
1895 | | }else{this.paintDurationEvent(B,C,D,A); |
1896 | | }}; |
1897 | | Timeline.OriginalEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A); |
1898 | | }else{this.paintPreciseInstantEvent(B,C,D,A); |
1899 | | }}; |
1900 | | Timeline.OriginalEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A); |
1901 | | }else{this.paintPreciseDurationEvent(B,C,D,A); |
1902 | | }}; |
1903 | | Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent=function(N,S,V,T){var W=this._timeline.getDocument(); |
1904 | | var L=N.getText(); |
1905 | | var H=N.getStart(); |
1906 | | var I=Math.round(this._band.dateToPixelOffset(H)); |
1907 | | var A=Math.round(I+S.iconWidth/2); |
1908 | | var C=Math.round(I-S.iconWidth/2); |
1909 | | var F=this._getLabelDivClassName(N); |
1910 | | var D=this._frc.computeSize(L,F); |
1911 | | var M=A+V.event.label.offsetFromLine; |
1912 | | var J=M+D.width; |
1913 | | var Q=J; |
1914 | | var P=this._findFreeTrack(N,Q); |
1915 | | var R=Math.round(S.trackOffset+P*S.trackIncrement+S.trackHeight/2-D.height/2); |
1916 | | var B=this._paintEventIcon(N,P,C,S,V,0); |
1917 | | var U=this._paintEventLabel(N,L,M,R,D.width,D.height,V,F,T); |
1918 | | var E=[B.elmt,U.elmt]; |
1919 | | var O=this; |
1920 | | var K=function(Y,X,Z){return O._onClickInstantEvent(B.elmt,X,N); |
1921 | | }; |
1922 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",K); |
1923 | | SimileAjax.DOM.registerEvent(U.elmt,"mousedown",K); |
1924 | | var G=this._createHighlightDiv(T,B,V,N); |
1925 | | if(G!=null){E.push(G); |
1926 | | }this._fireEventPaintListeners("paintedEvent",N,E); |
1927 | | this._eventIdToElmt[N.getID()]=B.elmt; |
1928 | | this._tracks[P]=C; |
1929 | | }; |
1930 | | Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent=function(P,U,Z,W){var b=this._timeline.getDocument(); |
1931 | | var N=P.getText(); |
1932 | | var J=P.getStart(); |
1933 | | var X=P.getEnd(); |
1934 | | var K=Math.round(this._band.dateToPixelOffset(J)); |
1935 | | var B=Math.round(this._band.dateToPixelOffset(X)); |
1936 | | var A=Math.round(K+U.iconWidth/2); |
1937 | | var D=Math.round(K-U.iconWidth/2); |
1938 | | var H=this._getLabelDivClassName(P); |
1939 | | var F=this._frc.computeSize(N,H); |
1940 | | var O=A+Z.event.label.offsetFromLine; |
1941 | | var L=O+F.width; |
1942 | | var S=Math.max(L,B); |
1943 | | var R=this._findFreeTrack(P,S); |
1944 | | var a=Z.event.tape.height; |
1945 | | var T=Math.round(U.trackOffset+R*U.trackIncrement+a); |
1946 | | var C=this._paintEventIcon(P,R,D,U,Z,a); |
1947 | | var Y=this._paintEventLabel(P,N,O,T,F.width,F.height,Z,H,W); |
1948 | | var V=P.getColor(); |
1949 | | V=V!=null?V:Z.event.instant.impreciseColor; |
1950 | | var E=this._paintEventTape(P,R,K,B,V,Z.event.instant.impreciseOpacity,U,Z,0); |
1951 | | var G=[C.elmt,Y.elmt,E.elmt]; |
1952 | | var Q=this; |
1953 | | var M=function(d,c,e){return Q._onClickInstantEvent(C.elmt,c,P); |
1954 | | }; |
1955 | | SimileAjax.DOM.registerEvent(C.elmt,"mousedown",M); |
1956 | | SimileAjax.DOM.registerEvent(E.elmt,"mousedown",M); |
1957 | | SimileAjax.DOM.registerEvent(Y.elmt,"mousedown",M); |
1958 | | var I=this._createHighlightDiv(W,C,Z,P); |
1959 | | if(I!=null){G.push(I); |
1960 | | }this._fireEventPaintListeners("paintedEvent",P,G); |
1961 | | this._eventIdToElmt[P.getID()]=C.elmt; |
1962 | | this._tracks[R]=D; |
1963 | | }; |
1964 | | Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent=function(M,R,W,T){var X=this._timeline.getDocument(); |
1965 | | var K=M.getText(); |
1966 | | var G=M.getStart(); |
1967 | | var U=M.getEnd(); |
1968 | | var H=Math.round(this._band.dateToPixelOffset(G)); |
1969 | | var A=Math.round(this._band.dateToPixelOffset(U)); |
1970 | | var E=this._getLabelDivClassName(M); |
1971 | | var C=this._frc.computeSize(K,E); |
1972 | | var L=H; |
1973 | | var I=L+C.width; |
1974 | | var P=Math.max(I,A); |
1975 | | var O=this._findFreeTrack(M,P); |
1976 | | var Q=Math.round(R.trackOffset+O*R.trackIncrement+W.event.tape.height); |
1977 | | var S=M.getColor(); |
1978 | | S=S!=null?S:W.event.duration.color; |
1979 | | var B=this._paintEventTape(M,O,H,A,S,100,R,W,0); |
1980 | | var V=this._paintEventLabel(M,K,L,Q,C.width,C.height,W,E,T); |
1981 | | var D=[B.elmt,V.elmt]; |
1982 | | var N=this; |
1983 | | var J=function(Z,Y,a){return N._onClickDurationEvent(B.elmt,Y,M); |
1984 | | }; |
1985 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",J); |
1986 | | SimileAjax.DOM.registerEvent(V.elmt,"mousedown",J); |
1987 | | var F=this._createHighlightDiv(T,B,W,M); |
1988 | | if(F!=null){D.push(F); |
1989 | | }this._fireEventPaintListeners("paintedEvent",M,D); |
1990 | | this._eventIdToElmt[M.getID()]=B.elmt; |
1991 | | this._tracks[O]=H; |
1992 | | }; |
1993 | | Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent=function(O,W,b,Y){var c=this._timeline.getDocument(); |
1994 | | var M=O.getText(); |
1995 | | var I=O.getStart(); |
1996 | | var V=O.getLatestStart(); |
1997 | | var Z=O.getEnd(); |
1998 | | var Q=O.getEarliestEnd(); |
1999 | | var K=Math.round(this._band.dateToPixelOffset(I)); |
2000 | | var F=Math.round(this._band.dateToPixelOffset(V)); |
2001 | | var A=Math.round(this._band.dateToPixelOffset(Z)); |
2002 | | var G=Math.round(this._band.dateToPixelOffset(Q)); |
2003 | | var E=this._getLabelDivClassName(O); |
2004 | | var C=this._frc.computeSize(M,E); |
2005 | | var N=F; |
2006 | | var J=N+C.width; |
2007 | | var S=Math.max(J,A); |
2008 | | var R=this._findFreeTrack(O,S); |
2009 | | var T=Math.round(W.trackOffset+R*W.trackIncrement+b.event.tape.height); |
2010 | | var X=O.getColor(); |
2011 | | X=X!=null?X:b.event.duration.color; |
2012 | | var U=this._paintEventTape(O,R,K,A,b.event.duration.impreciseColor,b.event.duration.impreciseOpacity,W,b,0); |
2013 | | var B=this._paintEventTape(O,R,F,G,X,100,W,b,1); |
2014 | | var a=this._paintEventLabel(O,M,N,T,C.width,C.height,b,E,Y); |
2015 | | var D=[U.elmt,B.elmt,a.elmt]; |
2016 | | var P=this; |
2017 | | var L=function(e,d,f){return P._onClickDurationEvent(B.elmt,d,O); |
2018 | | }; |
2019 | | SimileAjax.DOM.registerEvent(B.elmt,"mousedown",L); |
2020 | | SimileAjax.DOM.registerEvent(a.elmt,"mousedown",L); |
2021 | | var H=this._createHighlightDiv(Y,B,b,O); |
2022 | | if(H!=null){D.push(H); |
2023 | | }this._fireEventPaintListeners("paintedEvent",O,D); |
2024 | | this._eventIdToElmt[O.getID()]=B.elmt; |
2025 | | this._tracks[R]=K; |
2026 | | }; |
2027 | | Timeline.OriginalEventPainter.prototype._encodeEventElID=function(B,A){return Timeline.EventUtils.encodeEventElID(this._timeline,this._band,B,A); |
2028 | | }; |
2029 | | Timeline.OriginalEventPainter.prototype._findFreeTrack=function(E,D){var A=E.getTrackNum(); |
2030 | | if(A!=null){return A; |
2031 | | }for(var C=0; |
2032 | | C<this._tracks.length; |
2033 | | C++){var B=this._tracks[C]; |
2034 | | if(B>D){break; |
2035 | | }}return C; |
2036 | | }; |
2037 | | Timeline.OriginalEventPainter.prototype._paintEventIcon=function(K,B,C,G,F,D){var I=K.getIcon(); |
2038 | | I=I!=null?I:G.icon; |
2039 | | var J; |
2040 | | if(D>0){J=G.trackOffset+B*G.trackIncrement+D+G.impreciseIconMargin; |
2041 | | }else{var H=G.trackOffset+B*G.trackIncrement+G.trackHeight/2; |
2042 | | J=Math.round(H-G.iconHeight/2); |
2043 | | }var E=SimileAjax.Graphics.createTranslucentImage(I); |
2044 | | var A=this._timeline.getDocument().createElement("div"); |
2045 | | A.className=this._getElClassName("timeline-event-icon",K,"icon"); |
2046 | | A.id=this._encodeEventElID("icon",K); |
2047 | | A.style.left=C+"px"; |
2048 | | A.style.top=J+"px"; |
2049 | | A.appendChild(E); |
2050 | | if(K._title!=null){A.title=K._title; |
2051 | | }this._eventLayer.appendChild(A); |
2052 | | return{left:C,top:J,width:G.iconWidth,height:G.iconHeight,elmt:A}; |
2053 | | }; |
2054 | | Timeline.OriginalEventPainter.prototype._paintEventLabel=function(K,L,D,H,A,J,G,E,C){var I=this._timeline.getDocument(); |
2055 | | var B=I.createElement("div"); |
2056 | | B.className=E; |
2057 | | B.id=this._encodeEventElID("label",K); |
2058 | | B.style.left=D+"px"; |
2059 | | B.style.width=A+"px"; |
2060 | | B.style.top=H+"px"; |
2061 | | B.innerHTML=L; |
2062 | | if(K._title!=null){B.title=K._title; |
2063 | | }var F=K.getTextColor(); |
2064 | | if(F==null){F=K.getColor(); |
2065 | | }if(F!=null){B.style.color=F; |
2066 | | }if(G.event.highlightLabelBackground&&C>=0){B.style.background=this._getHighlightColor(C,G); |
2067 | | }this._eventLayer.appendChild(B); |
2068 | | return{left:D,top:H,width:A,height:J,elmt:B}; |
2069 | | }; |
2070 | | Timeline.OriginalEventPainter.prototype._paintEventTape=function(N,B,D,A,G,C,J,I,M){var F=A-D; |
2071 | | var E=I.event.tape.height; |
2072 | | var K=J.trackOffset+B*J.trackIncrement; |
2073 | | var O=this._timeline.getDocument().createElement("div"); |
2074 | | O.className=this._getElClassName("timeline-event-tape",N,"tape"); |
2075 | | O.id=this._encodeEventElID("tape"+M,N); |
2076 | | O.style.left=D+"px"; |
2077 | | O.style.width=F+"px"; |
2078 | | O.style.height=E+"px"; |
2079 | | O.style.top=K+"px"; |
2080 | | if(N._title!=null){O.title=N._title; |
2081 | | }if(G!=null){O.style.backgroundColor=G; |
2082 | | }var L=N.getTapeImage(); |
2083 | | var H=N.getTapeRepeat(); |
2084 | | H=H!=null?H:"repeat"; |
2085 | | if(L!=null){O.style.backgroundImage="url("+L+")"; |
2086 | | O.style.backgroundRepeat=H; |
2087 | | }SimileAjax.Graphics.setOpacity(O,C); |
2088 | | this._eventLayer.appendChild(O); |
2089 | | return{left:D,top:K,width:F,height:E,elmt:O}; |
2090 | | }; |
2091 | | Timeline.OriginalEventPainter.prototype._getLabelDivClassName=function(A){return this._getElClassName("timeline-event-label",A,"label"); |
2092 | | }; |
2093 | | Timeline.OriginalEventPainter.prototype._getElClassName=function(D,C,A){var E=C.getClassName(),B=[]; |
2094 | | if(E){if(A){B.push(A+"-"+E+" "); |
2095 | | }B.push(E+" "); |
2096 | | }B.push(D); |
2097 | | return(B.join("")); |
2098 | | }; |
2099 | | Timeline.OriginalEventPainter.prototype._getHighlightColor=function(A,B){var C=B.event.highlightColors; |
2100 | | return C[Math.min(A,C.length-1)]; |
2101 | | }; |
2102 | | Timeline.OriginalEventPainter.prototype._createHighlightDiv=function(A,D,F,B){var G=null; |
2103 | | if(A>=0){var E=this._timeline.getDocument(); |
2104 | | var C=this._getHighlightColor(A,F); |
2105 | | G=E.createElement("div"); |
2106 | | G.className=this._getElClassName("timeline-event-highlight",B,"highlight"); |
2107 | | G.id=this._encodeEventElID("highlight0",B); |
2108 | | G.style.position="absolute"; |
2109 | | G.style.overflow="hidden"; |
2110 | | G.style.left=(D.left-2)+"px"; |
2111 | | G.style.width=(D.width+4)+"px"; |
2112 | | G.style.top=(D.top-2)+"px"; |
2113 | | G.style.height=(D.height+4)+"px"; |
2114 | | G.style.background=C; |
2115 | | this._highlightLayer.appendChild(G); |
2116 | | }return G; |
2117 | | }; |
2118 | | Timeline.OriginalEventPainter.prototype._onClickInstantEvent=function(C,A,B){var D=SimileAjax.DOM.getPageCoordinates(C); |
2119 | | this._showBubble(D.left+Math.ceil(C.offsetWidth/2),D.top+Math.ceil(C.offsetHeight/2),B); |
2120 | | this._fireOnSelect(B.getID()); |
2121 | | A.cancelBubble=true; |
2122 | | SimileAjax.DOM.cancelEvent(A); |
2123 | | return false; |
2124 | | }; |
2125 | | Timeline.OriginalEventPainter.prototype._onClickDurationEvent=function(F,B,C){if("pageX" in B){var A=B.pageX; |
2126 | | var E=B.pageY; |
2127 | | }else{var D=SimileAjax.DOM.getPageCoordinates(F); |
2128 | | var A=B.offsetX+D.left; |
2129 | | var E=B.offsetY+D.top; |
2130 | | }this._showBubble(A,E,C); |
2131 | | this._fireOnSelect(C.getID()); |
2132 | | B.cancelBubble=true; |
2133 | | SimileAjax.DOM.cancelEvent(B); |
2134 | | return false; |
2135 | | }; |
2136 | | Timeline.OriginalEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()]; |
2137 | | if(B){var C=SimileAjax.DOM.getPageCoordinates(B); |
2138 | | this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A); |
2139 | | }}; |
2140 | | Timeline.OriginalEventPainter.prototype._showBubble=function(B,E,C){var D=document.createElement("div"); |
2141 | | var A=this._params.theme.event.bubble; |
2142 | | C.fillInfoBubble(D,this._params.theme,this._band.getLabeller()); |
2143 | | SimileAjax.WindowManager.cancelPopups(); |
2144 | | SimileAjax.Graphics.createBubbleForContentAndPoint(D,B,E,A.width,null,A.maxHeight); |
2145 | | }; |
2146 | | Timeline.OriginalEventPainter.prototype._fireOnSelect=function(A){for(var B=0; |
2147 | | B<this._onSelectListeners.length; |
2148 | | B++){this._onSelectListeners[B](A); |
2149 | | }}; |
2150 | | Timeline.OriginalEventPainter.prototype._fireEventPaintListeners=function(D,A,C){for(var B=0; |
2151 | | B<this._eventPaintListeners.length; |
2152 | | B++){this._eventPaintListeners[B](this._band,D,A,C); |
2153 | | }}; |
| 2858 | Timeline.OriginalEventPainter = function (A) { |
| 2859 | this._params = A; |
| 2860 | this._onSelectListeners = []; |
| 2861 | this._eventPaintListeners = []; |
| 2862 | this._filterMatcher = null; |
| 2863 | this._highlightMatcher = null; |
| 2864 | this._frc = null; |
| 2865 | this._eventIdToElmt = {}; |
| 2866 | }; |
| 2867 | Timeline.OriginalEventPainter.prototype.initialize = function (B, A) { |
| 2868 | this._band = B; |
| 2869 | this._timeline = A; |
| 2870 | this._backLayer = null; |
| 2871 | this._eventLayer = null; |
| 2872 | this._lineLayer = null; |
| 2873 | this._highlightLayer = null; |
| 2874 | this._eventIdToElmt = null; |
| 2875 | }; |
| 2876 | Timeline.OriginalEventPainter.prototype.getType = function () { |
| 2877 | return "original"; |
| 2878 | }; |
| 2879 | Timeline.OriginalEventPainter.prototype.addOnSelectListener = function (A) { |
| 2880 | this._onSelectListeners.push(A); |
| 2881 | }; |
| 2882 | Timeline.OriginalEventPainter.prototype.removeOnSelectListener = function (B) { |
| 2883 | for (var A = 0; |
| 2884 | A < this._onSelectListeners.length; |
| 2885 | A++) { |
| 2886 | if (this._onSelectListeners[A] == B) { |
| 2887 | this._onSelectListeners.splice(A, 1); |
| 2888 | break; |
| 2889 | } |
| 2890 | } |
| 2891 | }; |
| 2892 | Timeline.OriginalEventPainter.prototype.addEventPaintListener = function (A) { |
| 2893 | this._eventPaintListeners.push(A); |
| 2894 | }; |
| 2895 | Timeline.OriginalEventPainter.prototype.removeEventPaintListener = function (B) { |
| 2896 | for (var A = 0; |
| 2897 | A < this._eventPaintListeners.length; |
| 2898 | A++) { |
| 2899 | if (this._eventPaintListeners[A] == B) { |
| 2900 | this._eventPaintListeners.splice(A, 1); |
| 2901 | break; |
| 2902 | } |
| 2903 | } |
| 2904 | }; |
| 2905 | Timeline.OriginalEventPainter.prototype.getFilterMatcher = function () { |
| 2906 | return this._filterMatcher; |
| 2907 | }; |
| 2908 | Timeline.OriginalEventPainter.prototype.setFilterMatcher = function (A) { |
| 2909 | this._filterMatcher = A; |
| 2910 | }; |
| 2911 | Timeline.OriginalEventPainter.prototype.getHighlightMatcher = function () { |
| 2912 | return this._highlightMatcher; |
| 2913 | }; |
| 2914 | Timeline.OriginalEventPainter.prototype.setHighlightMatcher = function (A) { |
| 2915 | this._highlightMatcher = A; |
| 2916 | }; |
| 2917 | Timeline.OriginalEventPainter.prototype.paint = function () { |
| 2918 | var C = this._band.getEventSource(); |
| 2919 | if (C == null) { |
| 2920 | return; |
| 2921 | } |
| 2922 | this._eventIdToElmt = {}; |
| 2923 | this._fireEventPaintListeners("paintStarting", null, null); |
| 2924 | this._prepareForPainting(); |
| 2925 | var I = this._params.theme.event; |
| 2926 | var G = Math.max(I.track.height, I.tape.height + this._frc.getLineHeight()); |
| 2927 | var F = { |
| 2928 | trackOffset: I.track.offset, |
| 2929 | trackHeight: G, |
| 2930 | trackGap: I.track.gap, |
| 2931 | trackIncrement: G + I.track.gap, |
| 2932 | icon: I.instant.icon, |
| 2933 | iconWidth: I.instant.iconWidth, |
| 2934 | iconHeight: I.instant.iconHeight, |
| 2935 | labelWidth: I.label.width, |
| 2936 | maxLabelChar: I.label.maxLabelChar, |
| 2937 | impreciseIconMargin: I.instant.impreciseIconMargin |
| 2938 | }; |
| 2939 | var D = this._band.getMinDate(); |
| 2940 | var B = this._band.getMaxDate(); |
| 2941 | var J = (this._filterMatcher != null) ? this._filterMatcher : function (K) { |
| 2942 | return true; |
| 2943 | }; |
| 2944 | var A = (this._highlightMatcher != null) ? this._highlightMatcher : function (K) { |
| 2945 | return -1; |
| 2946 | }; |
| 2947 | var E = C.getEventReverseIterator(D, B); |
| 2948 | while (E.hasNext()) { |
| 2949 | var H = E.next(); |
| 2950 | if (J(H)) { |
| 2951 | this.paintEvent(H, F, this._params.theme, A(H)); |
| 2952 | } |
| 2953 | } |
| 2954 | this._highlightLayer.style.display = "block"; |
| 2955 | this._lineLayer.style.display = "block"; |
| 2956 | this._eventLayer.style.display = "block"; |
| 2957 | this._band.updateEventTrackInfo(this._tracks.length, F.trackIncrement); |
| 2958 | this._fireEventPaintListeners("paintEnded", null, null); |
| 2959 | }; |
| 2960 | Timeline.OriginalEventPainter.prototype.softPaint = function () {}; |
| 2961 | Timeline.OriginalEventPainter.prototype._prepareForPainting = function () { |
| 2962 | var B = this._band; |
| 2963 | if (this._backLayer == null) { |
| 2964 | this._backLayer = this._band.createLayerDiv(0, "timeline-band-events"); |
| 2965 | this._backLayer.style.visibility = "hidden"; |
| 2966 | var A = document.createElement("span"); |
| 2967 | A.className = "timeline-event-label"; |
| 2968 | this._backLayer.appendChild(A); |
| 2969 | this._frc = SimileAjax.Graphics.getFontRenderingContext(A); |
| 2970 | } |
| 2971 | this._frc.update(); |
| 2972 | this._tracks = []; |
| 2973 | if (this._highlightLayer != null) { |
| 2974 | B.removeLayerDiv(this._highlightLayer); |
| 2975 | } |
| 2976 | this._highlightLayer = B.createLayerDiv(105, "timeline-band-highlights"); |
| 2977 | this._highlightLayer.style.display = "none"; |
| 2978 | if (this._lineLayer != null) { |
| 2979 | B.removeLayerDiv(this._lineLayer); |
| 2980 | } |
| 2981 | this._lineLayer = B.createLayerDiv(110, "timeline-band-lines"); |
| 2982 | this._lineLayer.style.display = "none"; |
| 2983 | if (this._eventLayer != null) { |
| 2984 | B.removeLayerDiv(this._eventLayer); |
| 2985 | } |
| 2986 | this._eventLayer = B.createLayerDiv(115, "timeline-band-events"); |
| 2987 | this._eventLayer.style.display = "none"; |
| 2988 | }; |
| 2989 | Timeline.OriginalEventPainter.prototype.paintEvent = function (B, C, D, A) { |
| 2990 | if (B.isInstant()) { |
| 2991 | this.paintInstantEvent(B, C, D, A); |
| 2992 | } else { |
| 2993 | this.paintDurationEvent(B, C, D, A); |
| 2994 | } |
| 2995 | }; |
| 2996 | Timeline.OriginalEventPainter.prototype.paintInstantEvent = function (B, C, D, A) { |
| 2997 | if (B.isImprecise()) { |
| 2998 | this.paintImpreciseInstantEvent(B, C, D, A); |
| 2999 | } else { |
| 3000 | this.paintPreciseInstantEvent(B, C, D, A); |
| 3001 | } |
| 3002 | }; |
| 3003 | Timeline.OriginalEventPainter.prototype.paintDurationEvent = function (B, C, D, A) { |
| 3004 | if (B.isImprecise()) { |
| 3005 | this.paintImpreciseDurationEvent(B, C, D, A); |
| 3006 | } else { |
| 3007 | this.paintPreciseDurationEvent(B, C, D, A); |
| 3008 | } |
| 3009 | }; |
| 3010 | Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent = function (N, S, V, T) { |
| 3011 | var W = this._timeline.getDocument(); |
| 3012 | var L = N.getText(); |
| 3013 | var H = N.getStart(); |
| 3014 | var I = Math.round(this._band.dateToPixelOffset(H)); |
| 3015 | var A = Math.round(I + S.iconWidth / 2); |
| 3016 | var C = Math.round(I - S.iconWidth / 2); |
| 3017 | var F = this._getLabelDivClassName(N); |
| 3018 | var D = this._frc.computeSize(L, F); |
| 3019 | var M = A + V.event.label.offsetFromLine; |
| 3020 | var J = M + D.width; |
| 3021 | var Q = J; |
| 3022 | var P = this._findFreeTrack(N, Q); |
| 3023 | var R = Math.round(S.trackOffset + P * S.trackIncrement + S.trackHeight / 2 - D.height / 2); |
| 3024 | var B = this._paintEventIcon(N, P, C, S, V, 0); |
| 3025 | var U = this._paintEventLabel(N, L, M, R, D.width, D.height, V, F, T); |
| 3026 | var E = [B.elmt, U.elmt]; |
| 3027 | var O = this; |
| 3028 | var K = function (Y, X, Z) { |
| 3029 | return O._onClickInstantEvent(B.elmt, X, N); |
| 3030 | }; |
| 3031 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", K); |
| 3032 | SimileAjax.DOM.registerEvent(U.elmt, "mousedown", K); |
| 3033 | var G = this._createHighlightDiv(T, B, V, N); |
| 3034 | if (G != null) { |
| 3035 | E.push(G); |
| 3036 | } |
| 3037 | this._fireEventPaintListeners("paintedEvent", N, E); |
| 3038 | this._eventIdToElmt[N.getID()] = B.elmt; |
| 3039 | this._tracks[P] = C; |
| 3040 | }; |
| 3041 | Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent = function (P, U, Z, W) { |
| 3042 | var b = this._timeline.getDocument(); |
| 3043 | var N = P.getText(); |
| 3044 | var J = P.getStart(); |
| 3045 | var X = P.getEnd(); |
| 3046 | var K = Math.round(this._band.dateToPixelOffset(J)); |
| 3047 | var B = Math.round(this._band.dateToPixelOffset(X)); |
| 3048 | var A = Math.round(K + U.iconWidth / 2); |
| 3049 | var D = Math.round(K - U.iconWidth / 2); |
| 3050 | var H = this._getLabelDivClassName(P); |
| 3051 | var F = this._frc.computeSize(N, H); |
| 3052 | var O = A + Z.event.label.offsetFromLine; |
| 3053 | var L = O + F.width; |
| 3054 | var S = Math.max(L, B); |
| 3055 | var R = this._findFreeTrack(P, S); |
| 3056 | var a = Z.event.tape.height; |
| 3057 | var T = Math.round(U.trackOffset + R * U.trackIncrement + a); |
| 3058 | var C = this._paintEventIcon(P, R, D, U, Z, a); |
| 3059 | var Y = this._paintEventLabel(P, N, O, T, F.width, F.height, Z, H, W); |
| 3060 | var V = P.getColor(); |
| 3061 | V = V != null ? V : Z.event.instant.impreciseColor; |
| 3062 | var E = this._paintEventTape(P, R, K, B, V, Z.event.instant.impreciseOpacity, U, Z, 0); |
| 3063 | var G = [C.elmt, Y.elmt, E.elmt]; |
| 3064 | var Q = this; |
| 3065 | var M = function (d, c, e) { |
| 3066 | return Q._onClickInstantEvent(C.elmt, c, P); |
| 3067 | }; |
| 3068 | SimileAjax.DOM.registerEvent(C.elmt, "mousedown", M); |
| 3069 | SimileAjax.DOM.registerEvent(E.elmt, "mousedown", M); |
| 3070 | SimileAjax.DOM.registerEvent(Y.elmt, "mousedown", M); |
| 3071 | var I = this._createHighlightDiv(W, C, Z, P); |
| 3072 | if (I != null) { |
| 3073 | G.push(I); |
| 3074 | } |
| 3075 | this._fireEventPaintListeners("paintedEvent", P, G); |
| 3076 | this._eventIdToElmt[P.getID()] = C.elmt; |
| 3077 | this._tracks[R] = D; |
| 3078 | }; |
| 3079 | Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent = function (M, R, W, T) { |
| 3080 | var X = this._timeline.getDocument(); |
| 3081 | var K = M.getText(); |
| 3082 | var G = M.getStart(); |
| 3083 | var U = M.getEnd(); |
| 3084 | var H = Math.round(this._band.dateToPixelOffset(G)); |
| 3085 | var A = Math.round(this._band.dateToPixelOffset(U)); |
| 3086 | var E = this._getLabelDivClassName(M); |
| 3087 | var C = this._frc.computeSize(K, E); |
| 3088 | var L = H; |
| 3089 | var I = L + C.width; |
| 3090 | var P = Math.max(I, A); |
| 3091 | var O = this._findFreeTrack(M, P); |
| 3092 | var Q = Math.round(R.trackOffset + O * R.trackIncrement + W.event.tape.height); |
| 3093 | var S = M.getColor(); |
| 3094 | S = S != null ? S : W.event.duration.color; |
| 3095 | var B = this._paintEventTape(M, O, H, A, S, 100, R, W, 0); |
| 3096 | var V = this._paintEventLabel(M, K, L, Q, C.width, C.height, W, E, T); |
| 3097 | var D = [B.elmt, V.elmt]; |
| 3098 | var N = this; |
| 3099 | var J = function (Z, Y, a) { |
| 3100 | return N._onClickDurationEvent(B.elmt, Y, M); |
| 3101 | }; |
| 3102 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", J); |
| 3103 | SimileAjax.DOM.registerEvent(V.elmt, "mousedown", J); |
| 3104 | var F = this._createHighlightDiv(T, B, W, M); |
| 3105 | if (F != null) { |
| 3106 | D.push(F); |
| 3107 | } |
| 3108 | this._fireEventPaintListeners("paintedEvent", M, D); |
| 3109 | this._eventIdToElmt[M.getID()] = B.elmt; |
| 3110 | this._tracks[O] = H; |
| 3111 | }; |
| 3112 | Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent = function (O, W, b, Y) { |
| 3113 | var c = this._timeline.getDocument(); |
| 3114 | var M = O.getText(); |
| 3115 | var I = O.getStart(); |
| 3116 | var V = O.getLatestStart(); |
| 3117 | var Z = O.getEnd(); |
| 3118 | var Q = O.getEarliestEnd(); |
| 3119 | var K = Math.round(this._band.dateToPixelOffset(I)); |
| 3120 | var F = Math.round(this._band.dateToPixelOffset(V)); |
| 3121 | var A = Math.round(this._band.dateToPixelOffset(Z)); |
| 3122 | var G = Math.round(this._band.dateToPixelOffset(Q)); |
| 3123 | var E = this._getLabelDivClassName(O); |
| 3124 | var C = this._frc.computeSize(M, E); |
| 3125 | var N = F; |
| 3126 | var J = N + C.width; |
| 3127 | var S = Math.max(J, A); |
| 3128 | var R = this._findFreeTrack(O, S); |
| 3129 | var T = Math.round(W.trackOffset + R * W.trackIncrement + b.event.tape.height); |
| 3130 | var X = O.getColor(); |
| 3131 | X = X != null ? X : b.event.duration.color; |
| 3132 | var U = this._paintEventTape(O, R, K, A, b.event.duration.impreciseColor, b.event.duration.impreciseOpacity, W, b, 0); |
| 3133 | var B = this._paintEventTape(O, R, F, G, X, 100, W, b, 1); |
| 3134 | var a = this._paintEventLabel(O, M, N, T, C.width, C.height, b, E, Y); |
| 3135 | var D = [U.elmt, B.elmt, a.elmt]; |
| 3136 | var P = this; |
| 3137 | var L = function (e, d, f) { |
| 3138 | return P._onClickDurationEvent(B.elmt, d, O); |
| 3139 | }; |
| 3140 | SimileAjax.DOM.registerEvent(B.elmt, "mousedown", L); |
| 3141 | SimileAjax.DOM.registerEvent(a.elmt, "mousedown", L); |
| 3142 | var H = this._createHighlightDiv(Y, B, b, O); |
| 3143 | if (H != null) { |
| 3144 | D.push(H); |
| 3145 | } |
| 3146 | this._fireEventPaintListeners("paintedEvent", O, D); |
| 3147 | this._eventIdToElmt[O.getID()] = B.elmt; |
| 3148 | this._tracks[R] = K; |
| 3149 | }; |
| 3150 | Timeline.OriginalEventPainter.prototype._encodeEventElID = function (B, A) { |
| 3151 | return Timeline.EventUtils.encodeEventElID(this._timeline, this._band, B, A); |
| 3152 | }; |
| 3153 | Timeline.OriginalEventPainter.prototype._findFreeTrack = function (E, D) { |
| 3154 | var A = E.getTrackNum(); |
| 3155 | if (A != null) { |
| 3156 | return A; |
| 3157 | } |
| 3158 | for (var C = 0; |
| 3159 | C < this._tracks.length; |
| 3160 | C++) { |
| 3161 | var B = this._tracks[C]; |
| 3162 | if (B > D) { |
| 3163 | break; |
| 3164 | } |
| 3165 | } |
| 3166 | return C; |
| 3167 | }; |
| 3168 | Timeline.OriginalEventPainter.prototype._paintEventIcon = function (K, B, C, G, F, D) { |
| 3169 | var I = K.getIcon(); |
| 3170 | I = I != null ? I : G.icon; |
| 3171 | var J; |
| 3172 | if (D > 0) { |
| 3173 | J = G.trackOffset + B * G.trackIncrement + D + G.impreciseIconMargin; |
| 3174 | } else { |
| 3175 | var H = G.trackOffset + B * G.trackIncrement + G.trackHeight / 2; |
| 3176 | J = Math.round(H - G.iconHeight / 2); |
| 3177 | } |
| 3178 | var E = SimileAjax.Graphics.createTranslucentImage(I); |
| 3179 | var A = this._timeline.getDocument().createElement("div"); |
| 3180 | A.className = this._getElClassName("timeline-event-icon", K, "icon"); |
| 3181 | A.id = this._encodeEventElID("icon", K); |
| 3182 | A.style.left = C + "px"; |
| 3183 | A.style.top = J + "px"; |
| 3184 | A.appendChild(E); |
| 3185 | if (K._title != null) { |
| 3186 | A.title = K._title; |
| 3187 | } |
| 3188 | this._eventLayer.appendChild(A); |
| 3189 | return { |
| 3190 | left: C, |
| 3191 | top: J, |
| 3192 | width: G.iconWidth, |
| 3193 | height: G.iconHeight, |
| 3194 | elmt: A |
| 3195 | }; |
| 3196 | }; |
| 3197 | Timeline.OriginalEventPainter.prototype._paintEventLabel = function (K, L, D, H, A, J, G, E, C) { |
| 3198 | var I = this._timeline.getDocument(); |
| 3199 | var B = I.createElement("div"); |
| 3200 | B.className = E; |
| 3201 | B.id = this._encodeEventElID("label", K); |
| 3202 | B.style.left = D + "px"; |
| 3203 | B.style.width = A + "px"; |
| 3204 | B.style.top = H + "px"; |
| 3205 | B.innerHTML = L; |
| 3206 | if (K._title != null) { |
| 3207 | B.title = K._title; |
| 3208 | } |
| 3209 | var F = K.getTextColor(); |
| 3210 | if (F == null) { |
| 3211 | F = K.getColor(); |
| 3212 | } |
| 3213 | if (F != null) { |
| 3214 | B.style.color = F; |
| 3215 | } |
| 3216 | if (G.event.highlightLabelBackground && C >= 0) { |
| 3217 | B.style.background = this._getHighlightColor(C, G); |
| 3218 | } |
| 3219 | this._eventLayer.appendChild(B); |
| 3220 | return { |
| 3221 | left: D, |
| 3222 | top: H, |
| 3223 | width: A, |
| 3224 | height: J, |
| 3225 | elmt: B |
| 3226 | }; |
| 3227 | }; |
| 3228 | Timeline.OriginalEventPainter.prototype._paintEventTape = function (N, B, D, A, G, C, J, I, M) { |
| 3229 | var F = A - D; |
| 3230 | var E = I.event.tape.height; |
| 3231 | var K = J.trackOffset + B * J.trackIncrement; |
| 3232 | var O = this._timeline.getDocument().createElement("div"); |
| 3233 | O.className = this._getElClassName("timeline-event-tape", N, "tape"); |
| 3234 | O.id = this._encodeEventElID("tape" + M, N); |
| 3235 | O.style.left = D + "px"; |
| 3236 | O.style.width = F + "px"; |
| 3237 | O.style.height = E + "px"; |
| 3238 | O.style.top = K + "px"; |
| 3239 | if (N._title != null) { |
| 3240 | O.title = N._title; |
| 3241 | } |
| 3242 | if (G != null) { |
| 3243 | O.style.backgroundColor = G; |
| 3244 | } |
| 3245 | var L = N.getTapeImage(); |
| 3246 | var H = N.getTapeRepeat(); |
| 3247 | H = H != null ? H : "repeat"; |
| 3248 | if (L != null) { |
| 3249 | O.style.backgroundImage = "url(" + L + ")"; |
| 3250 | O.style.backgroundRepeat = H; |
| 3251 | } |
| 3252 | SimileAjax.Graphics.setOpacity(O, C); |
| 3253 | this._eventLayer.appendChild(O); |
| 3254 | return { |
| 3255 | left: D, |
| 3256 | top: K, |
| 3257 | width: F, |
| 3258 | height: E, |
| 3259 | elmt: O |
| 3260 | }; |
| 3261 | }; |
| 3262 | Timeline.OriginalEventPainter.prototype._getLabelDivClassName = function (A) { |
| 3263 | return this._getElClassName("timeline-event-label", A, "label"); |
| 3264 | }; |
| 3265 | Timeline.OriginalEventPainter.prototype._getElClassName = function (D, C, A) { |
| 3266 | var E = C.getClassName(), |
| 3267 | B = []; |
| 3268 | if (E) { |
| 3269 | if (A) { |
| 3270 | B.push(A + "-" + E + " "); |
| 3271 | } |
| 3272 | B.push(E + " "); |
| 3273 | } |
| 3274 | B.push(D); |
| 3275 | return (B.join("")); |
| 3276 | }; |
| 3277 | Timeline.OriginalEventPainter.prototype._getHighlightColor = function (A, B) { |
| 3278 | var C = B.event.highlightColors; |
| 3279 | return C[Math.min(A, C.length - 1)]; |
| 3280 | }; |
| 3281 | Timeline.OriginalEventPainter.prototype._createHighlightDiv = function (A, D, F, B) { |
| 3282 | var G = null; |
| 3283 | if (A >= 0) { |
| 3284 | var E = this._timeline.getDocument(); |
| 3285 | var C = this._getHighlightColor(A, F); |
| 3286 | G = E.createElement("div"); |
| 3287 | G.className = this._getElClassName("timeline-event-highlight", B, "highlight"); |
| 3288 | G.id = this._encodeEventElID("highlight0", B); |
| 3289 | G.style.position = "absolute"; |
| 3290 | G.style.overflow = "hidden"; |
| 3291 | G.style.left = (D.left - 2) + "px"; |
| 3292 | G.style.width = (D.width + 4) + "px"; |
| 3293 | G.style.top = (D.top - 2) + "px"; |
| 3294 | G.style.height = (D.height + 4) + "px"; |
| 3295 | G.style.background = C; |
| 3296 | this._highlightLayer.appendChild(G); |
| 3297 | } |
| 3298 | return G; |
| 3299 | }; |
| 3300 | Timeline.OriginalEventPainter.prototype._onClickInstantEvent = function (C, A, B) { |
| 3301 | var D = SimileAjax.DOM.getPageCoordinates(C); |
| 3302 | this._showBubble(D.left + Math.ceil(C.offsetWidth / 2), D.top + Math.ceil(C.offsetHeight / 2), B); |
| 3303 | this._fireOnSelect(B.getID()); |
| 3304 | A.cancelBubble = true; |
| 3305 | SimileAjax.DOM.cancelEvent(A); |
| 3306 | return false; |
| 3307 | }; |
| 3308 | Timeline.OriginalEventPainter.prototype._onClickDurationEvent = function (F, B, C) { |
| 3309 | if ("pageX" in B) { |
| 3310 | var A = B.pageX; |
| 3311 | var E = B.pageY; |
| 3312 | } else { |
| 3313 | var D = SimileAjax.DOM.getPageCoordinates(F); |
| 3314 | var A = B.offsetX + D.left; |
| 3315 | var E = B.offsetY + D.top; |
| 3316 | } |
| 3317 | this._showBubble(A, E, C); |
| 3318 | this._fireOnSelect(C.getID()); |
| 3319 | B.cancelBubble = true; |
| 3320 | SimileAjax.DOM.cancelEvent(B); |
| 3321 | return false; |
| 3322 | }; |
| 3323 | Timeline.OriginalEventPainter.prototype.showBubble = function (A) { |
| 3324 | var B = this._eventIdToElmt[A.getID()]; |
| 3325 | if (B) { |
| 3326 | var C = SimileAjax.DOM.getPageCoordinates(B); |
| 3327 | this._showBubble(C.left + B.offsetWidth / 2, C.top + B.offsetHeight / 2, A); |
| 3328 | } |
| 3329 | }; |
| 3330 | Timeline.OriginalEventPainter.prototype._showBubble = function (B, E, C) { |
| 3331 | var D = document.createElement("div"); |
| 3332 | var A = this._params.theme.event.bubble; |
| 3333 | C.fillInfoBubble(D, this._params.theme, this._band.getLabeller()); |
| 3334 | SimileAjax.WindowManager.cancelPopups(); |
| 3335 | SimileAjax.Graphics.createBubbleForContentAndPoint(D, B, E, A.width, null, A.maxHeight); |
| 3336 | }; |
| 3337 | Timeline.OriginalEventPainter.prototype._fireOnSelect = function (A) { |
| 3338 | for (var B = 0; |
| 3339 | B < this._onSelectListeners.length; |
| 3340 | B++) { |
| 3341 | this._onSelectListeners[B](A); |
| 3342 | } |
| 3343 | }; |
| 3344 | Timeline.OriginalEventPainter.prototype._fireEventPaintListeners = function (D, A, C) { |
| 3345 | for (var B = 0; |
| 3346 | B < this._eventPaintListeners.length; |
| 3347 | B++) { |
| 3348 | this._eventPaintListeners[B](this._band, D, A, C); |
| 3349 | } |
| 3350 | }; |
2157 | | Timeline.OverviewEventPainter=function(A){this._params=A; |
2158 | | this._onSelectListeners=[]; |
2159 | | this._filterMatcher=null; |
2160 | | this._highlightMatcher=null; |
2161 | | }; |
2162 | | Timeline.OverviewEventPainter.prototype.initialize=function(B,A){this._band=B; |
2163 | | this._timeline=A; |
2164 | | this._eventLayer=null; |
2165 | | this._highlightLayer=null; |
2166 | | }; |
2167 | | Timeline.OverviewEventPainter.prototype.getType=function(){return"overview"; |
2168 | | }; |
2169 | | Timeline.OverviewEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A); |
2170 | | }; |
2171 | | Timeline.OverviewEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0; |
2172 | | A<this._onSelectListeners.length; |
2173 | | A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1); |
2174 | | break; |
2175 | | }}}; |
2176 | | Timeline.OverviewEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher; |
2177 | | }; |
2178 | | Timeline.OverviewEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A; |
2179 | | }; |
2180 | | Timeline.OverviewEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher; |
2181 | | }; |
2182 | | Timeline.OverviewEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A; |
2183 | | }; |
2184 | | Timeline.OverviewEventPainter.prototype.paint=function(){var C=this._band.getEventSource(); |
2185 | | if(C==null){return ; |
2186 | | }this._prepareForPainting(); |
2187 | | var H=this._params.theme.event; |
2188 | | var F={trackOffset:H.overviewTrack.offset,trackHeight:H.overviewTrack.height,trackGap:H.overviewTrack.gap,trackIncrement:H.overviewTrack.height+H.overviewTrack.gap}; |
2189 | | var D=this._band.getMinDate(); |
2190 | | var B=this._band.getMaxDate(); |
2191 | | var I=(this._filterMatcher!=null)?this._filterMatcher:function(J){return true; |
2192 | | }; |
2193 | | var A=(this._highlightMatcher!=null)?this._highlightMatcher:function(J){return -1; |
2194 | | }; |
2195 | | var E=C.getEventReverseIterator(D,B); |
2196 | | while(E.hasNext()){var G=E.next(); |
2197 | | if(I(G)){this.paintEvent(G,F,this._params.theme,A(G)); |
2198 | | }}this._highlightLayer.style.display="block"; |
2199 | | this._eventLayer.style.display="block"; |
2200 | | this._band.updateEventTrackInfo(this._tracks.length,F.trackIncrement); |
2201 | | }; |
2202 | | Timeline.OverviewEventPainter.prototype.softPaint=function(){}; |
2203 | | Timeline.OverviewEventPainter.prototype._prepareForPainting=function(){var A=this._band; |
2204 | | this._tracks=[]; |
2205 | | if(this._highlightLayer!=null){A.removeLayerDiv(this._highlightLayer); |
2206 | | }this._highlightLayer=A.createLayerDiv(105,"timeline-band-highlights"); |
2207 | | this._highlightLayer.style.display="none"; |
2208 | | if(this._eventLayer!=null){A.removeLayerDiv(this._eventLayer); |
2209 | | }this._eventLayer=A.createLayerDiv(110,"timeline-band-events"); |
2210 | | this._eventLayer.style.display="none"; |
2211 | | }; |
2212 | | Timeline.OverviewEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A); |
2213 | | }else{this.paintDurationEvent(B,C,D,A); |
2214 | | }}; |
2215 | | Timeline.OverviewEventPainter.prototype.paintInstantEvent=function(I,H,E,A){var F=I.getStart(); |
2216 | | var B=Math.round(this._band.dateToPixelOffset(F)); |
2217 | | var C=I.getColor(),D=I.getClassName(); |
2218 | | if(D){C=null; |
2219 | | }else{C=C!=null?C:E.event.duration.color; |
2220 | | }var G=this._paintEventTick(I,B,C,100,H,E); |
2221 | | this._createHighlightDiv(A,G,E); |
2222 | | }; |
2223 | | Timeline.OverviewEventPainter.prototype.paintDurationEvent=function(L,K,H,B){var A=L.getLatestStart(); |
2224 | | var I=L.getEarliestEnd(); |
2225 | | var J=Math.round(this._band.dateToPixelOffset(A)); |
2226 | | var C=Math.round(this._band.dateToPixelOffset(I)); |
2227 | | var F=0; |
2228 | | for(; |
2229 | | F<this._tracks.length; |
2230 | | F++){if(C<this._tracks[F]){break; |
2231 | | }}this._tracks[F]=C; |
2232 | | var E=L.getColor(),G=L.getClassName(); |
2233 | | if(G){E=null; |
2234 | | }else{E=E!=null?E:H.event.duration.color; |
2235 | | }var D=this._paintEventTape(L,F,J,C,E,100,K,H,G); |
2236 | | this._createHighlightDiv(B,D,H); |
2237 | | }; |
2238 | | Timeline.OverviewEventPainter.prototype._paintEventTape=function(K,B,D,L,E,C,H,G,F){var I=H.trackOffset+B*H.trackIncrement; |
2239 | | var A=L-D; |
2240 | | var J=H.trackHeight; |
2241 | | var M=this._timeline.getDocument().createElement("div"); |
2242 | | M.className="timeline-small-event-tape"; |
2243 | | if(F){M.className+=" small-"+F; |
2244 | | }M.style.left=D+"px"; |
2245 | | M.style.width=A+"px"; |
2246 | | M.style.top=I+"px"; |
2247 | | M.style.height=J+"px"; |
2248 | | if(E){M.style.backgroundColor=E; |
2249 | | }if(C<100){SimileAjax.Graphics.setOpacity(M,C); |
2250 | | }this._eventLayer.appendChild(M); |
2251 | | return{left:D,top:I,width:A,height:J,elmt:M}; |
2252 | | }; |
2253 | | Timeline.OverviewEventPainter.prototype._paintEventTick=function(J,C,D,B,G,F){var I=F.event.overviewTrack.tickHeight; |
2254 | | var H=G.trackOffset-I; |
2255 | | var A=1; |
2256 | | var K=this._timeline.getDocument().createElement("div"); |
2257 | | K.className="timeline-small-event-icon"; |
2258 | | K.style.left=C+"px"; |
2259 | | K.style.top=H+"px"; |
2260 | | var E=J.getClassName(); |
2261 | | if(E){K.className+=" small-"+E; |
2262 | | }if(B<100){SimileAjax.Graphics.setOpacity(K,B); |
2263 | | }this._eventLayer.appendChild(K); |
2264 | | return{left:C,top:H,width:A,height:I,elmt:K}; |
2265 | | }; |
2266 | | Timeline.OverviewEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument(); |
2267 | | var G=E.event; |
2268 | | var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)]; |
2269 | | var F=D.createElement("div"); |
2270 | | F.style.position="absolute"; |
2271 | | F.style.overflow="hidden"; |
2272 | | F.style.left=(C.left-1)+"px"; |
2273 | | F.style.width=(C.width+2)+"px"; |
2274 | | F.style.top=(C.top-1)+"px"; |
2275 | | F.style.height=(C.height+2)+"px"; |
2276 | | F.style.background=B; |
2277 | | this._highlightLayer.appendChild(F); |
2278 | | }}; |
2279 | | Timeline.OverviewEventPainter.prototype.showBubble=function(A){}; |
| 3354 | Timeline.OverviewEventPainter = function (A) { |
| 3355 | this._params = A; |
| 3356 | this._onSelectListeners = []; |
| 3357 | this._filterMatcher = null; |
| 3358 | this._highlightMatcher = null; |
| 3359 | }; |
| 3360 | Timeline.OverviewEventPainter.prototype.initialize = function (B, A) { |
| 3361 | this._band = B; |
| 3362 | this._timeline = A; |
| 3363 | this._eventLayer = null; |
| 3364 | this._highlightLayer = null; |
| 3365 | }; |
| 3366 | Timeline.OverviewEventPainter.prototype.getType = function () { |
| 3367 | return "overview"; |
| 3368 | }; |
| 3369 | Timeline.OverviewEventPainter.prototype.addOnSelectListener = function (A) { |
| 3370 | this._onSelectListeners.push(A); |
| 3371 | }; |
| 3372 | Timeline.OverviewEventPainter.prototype.removeOnSelectListener = function (B) { |
| 3373 | for (var A = 0; |
| 3374 | A < this._onSelectListeners.length; |
| 3375 | A++) { |
| 3376 | if (this._onSelectListeners[A] == B) { |
| 3377 | this._onSelectListeners.splice(A, 1); |
| 3378 | break; |
| 3379 | } |
| 3380 | } |
| 3381 | }; |
| 3382 | Timeline.OverviewEventPainter.prototype.getFilterMatcher = function () { |
| 3383 | return this._filterMatcher; |
| 3384 | }; |
| 3385 | Timeline.OverviewEventPainter.prototype.setFilterMatcher = function (A) { |
| 3386 | this._filterMatcher = A; |
| 3387 | }; |
| 3388 | Timeline.OverviewEventPainter.prototype.getHighlightMatcher = function () { |
| 3389 | return this._highlightMatcher; |
| 3390 | }; |
| 3391 | Timeline.OverviewEventPainter.prototype.setHighlightMatcher = function (A) { |
| 3392 | this._highlightMatcher = A; |
| 3393 | }; |
| 3394 | Timeline.OverviewEventPainter.prototype.paint = function () { |
| 3395 | var C = this._band.getEventSource(); |
| 3396 | if (C == null) { |
| 3397 | return; |
| 3398 | } |
| 3399 | this._prepareForPainting(); |
| 3400 | var H = this._params.theme.event; |
| 3401 | var F = { |
| 3402 | trackOffset: H.overviewTrack.offset, |
| 3403 | trackHeight: H.overviewTrack.height, |
| 3404 | trackGap: H.overviewTrack.gap, |
| 3405 | trackIncrement: H.overviewTrack.height + H.overviewTrack.gap |
| 3406 | }; |
| 3407 | var D = this._band.getMinDate(); |
| 3408 | var B = this._band.getMaxDate(); |
| 3409 | var I = (this._filterMatcher != null) ? this._filterMatcher : function (J) { |
| 3410 | return true; |
| 3411 | }; |
| 3412 | var A = (this._highlightMatcher != null) ? this._highlightMatcher : function (J) { |
| 3413 | return -1; |
| 3414 | }; |
| 3415 | var E = C.getEventReverseIterator(D, B); |
| 3416 | while (E.hasNext()) { |
| 3417 | var G = E.next(); |
| 3418 | if (I(G)) { |
| 3419 | this.paintEvent(G, F, this._params.theme, A(G)); |
| 3420 | } |
| 3421 | } |
| 3422 | this._highlightLayer.style.display = "block"; |
| 3423 | this._eventLayer.style.display = "block"; |
| 3424 | this._band.updateEventTrackInfo(this._tracks.length, F.trackIncrement); |
| 3425 | }; |
| 3426 | Timeline.OverviewEventPainter.prototype.softPaint = function () {}; |
| 3427 | Timeline.OverviewEventPainter.prototype._prepareForPainting = function () { |
| 3428 | var A = this._band; |
| 3429 | this._tracks = []; |
| 3430 | if (this._highlightLayer != null) { |
| 3431 | A.removeLayerDiv(this._highlightLayer); |
| 3432 | } |
| 3433 | this._highlightLayer = A.createLayerDiv(105, "timeline-band-highlights"); |
| 3434 | this._highlightLayer.style.display = "none"; |
| 3435 | if (this._eventLayer != null) { |
| 3436 | A.removeLayerDiv(this._eventLayer); |
| 3437 | } |
| 3438 | this._eventLayer = A.createLayerDiv(110, "timeline-band-events"); |
| 3439 | this._eventLayer.style.display = "none"; |
| 3440 | }; |
| 3441 | Timeline.OverviewEventPainter.prototype.paintEvent = function (B, C, D, A) { |
| 3442 | if (B.isInstant()) { |
| 3443 | this.paintInstantEvent(B, C, D, A); |
| 3444 | } else { |
| 3445 | this.paintDurationEvent(B, C, D, A); |
| 3446 | } |
| 3447 | }; |
| 3448 | Timeline.OverviewEventPainter.prototype.paintInstantEvent = function (I, H, E, A) { |
| 3449 | var F = I.getStart(); |
| 3450 | var B = Math.round(this._band.dateToPixelOffset(F)); |
| 3451 | var C = I.getColor(), |
| 3452 | D = I.getClassName(); |
| 3453 | if (D) { |
| 3454 | C = null; |
| 3455 | } else { |
| 3456 | C = C != null ? C : E.event.duration.color; |
| 3457 | } |
| 3458 | var G = this._paintEventTick(I, B, C, 100, H, E); |
| 3459 | this._createHighlightDiv(A, G, E); |
| 3460 | }; |
| 3461 | Timeline.OverviewEventPainter.prototype.paintDurationEvent = function (L, K, H, B) { |
| 3462 | var A = L.getLatestStart(); |
| 3463 | var I = L.getEarliestEnd(); |
| 3464 | var J = Math.round(this._band.dateToPixelOffset(A)); |
| 3465 | var C = Math.round(this._band.dateToPixelOffset(I)); |
| 3466 | var F = 0; |
| 3467 | for (; |
| 3468 | F < this._tracks.length; |
| 3469 | F++) { |
| 3470 | if (C < this._tracks[F]) { |
| 3471 | break; |
| 3472 | } |
| 3473 | } |
| 3474 | this._tracks[F] = C; |
| 3475 | var E = L.getColor(), |
| 3476 | G = L.getClassName(); |
| 3477 | if (G) { |
| 3478 | E = null; |
| 3479 | } else { |
| 3480 | E = E != null ? E : H.event.duration.color; |
| 3481 | } |
| 3482 | var D = this._paintEventTape(L, F, J, C, E, 100, K, H, G); |
| 3483 | this._createHighlightDiv(B, D, H); |
| 3484 | }; |
| 3485 | Timeline.OverviewEventPainter.prototype._paintEventTape = function (K, B, D, L, E, C, H, G, F) { |
| 3486 | var I = H.trackOffset + B * H.trackIncrement; |
| 3487 | var A = L - D; |
| 3488 | var J = H.trackHeight; |
| 3489 | var M = this._timeline.getDocument().createElement("div"); |
| 3490 | M.className = "timeline-small-event-tape"; |
| 3491 | if (F) { |
| 3492 | M.className += " small-" + F; |
| 3493 | } |
| 3494 | M.style.left = D + "px"; |
| 3495 | M.style.width = A + "px"; |
| 3496 | M.style.top = I + "px"; |
| 3497 | M.style.height = J + "px"; |
| 3498 | if (E) { |
| 3499 | M.style.backgroundColor = E; |
| 3500 | } |
| 3501 | if (C < 100) { |
| 3502 | SimileAjax.Graphics.setOpacity(M, C); |
| 3503 | } |
| 3504 | this._eventLayer.appendChild(M); |
| 3505 | return { |
| 3506 | left: D, |
| 3507 | top: I, |
| 3508 | width: A, |
| 3509 | height: J, |
| 3510 | elmt: M |
| 3511 | }; |
| 3512 | }; |
| 3513 | Timeline.OverviewEventPainter.prototype._paintEventTick = function (J, C, D, B, G, F) { |
| 3514 | var I = F.event.overviewTrack.tickHeight; |
| 3515 | var H = G.trackOffset - I; |
| 3516 | var A = 1; |
| 3517 | var K = this._timeline.getDocument().createElement("div"); |
| 3518 | K.className = "timeline-small-event-icon"; |
| 3519 | K.style.left = C + "px"; |
| 3520 | K.style.top = H + "px"; |
| 3521 | var E = J.getClassName(); |
| 3522 | if (E) { |
| 3523 | K.className += " small-" + E; |
| 3524 | } |
| 3525 | if (B < 100) { |
| 3526 | SimileAjax.Graphics.setOpacity(K, B); |
| 3527 | } |
| 3528 | this._eventLayer.appendChild(K); |
| 3529 | return { |
| 3530 | left: C, |
| 3531 | top: H, |
| 3532 | width: A, |
| 3533 | height: I, |
| 3534 | elmt: K |
| 3535 | }; |
| 3536 | }; |
| 3537 | Timeline.OverviewEventPainter.prototype._createHighlightDiv = function (A, C, E) { |
| 3538 | if (A >= 0) { |
| 3539 | var D = this._timeline.getDocument(); |
| 3540 | var G = E.event; |
| 3541 | var B = G.highlightColors[Math.min(A, G.highlightColors.length - 1)]; |
| 3542 | var F = D.createElement("div"); |
| 3543 | F.style.position = "absolute"; |
| 3544 | F.style.overflow = "hidden"; |
| 3545 | F.style.left = (C.left - 1) + "px"; |
| 3546 | F.style.width = (C.width + 2) + "px"; |
| 3547 | F.style.top = (C.top - 1) + "px"; |
| 3548 | F.style.height = (C.height + 2) + "px"; |
| 3549 | F.style.background = B; |
| 3550 | this._highlightLayer.appendChild(F); |
| 3551 | } |
| 3552 | }; |
| 3553 | Timeline.OverviewEventPainter.prototype.showBubble = function (A) {}; |
2283 | | Timeline.DefaultEventSource=function(A){this._events=(A instanceof Object)?A:new SimileAjax.EventIndex(); |
2284 | | this._listeners=[]; |
2285 | | }; |
2286 | | Timeline.DefaultEventSource.prototype.addListener=function(A){this._listeners.push(A); |
2287 | | }; |
2288 | | Timeline.DefaultEventSource.prototype.removeListener=function(B){for(var A=0; |
2289 | | A<this._listeners.length; |
2290 | | A++){if(this._listeners[A]==B){this._listeners.splice(A,1); |
2291 | | break; |
2292 | | }}}; |
2293 | | Timeline.DefaultEventSource.prototype.loadXML=function(G,A){var C=this._getBaseURL(A); |
2294 | | var H=G.documentElement.getAttribute("wiki-url"); |
2295 | | var J=G.documentElement.getAttribute("wiki-section"); |
2296 | | var F=G.documentElement.getAttribute("date-time-format"); |
2297 | | var E=this._events.getUnit().getParser(F); |
2298 | | var D=G.documentElement.firstChild; |
2299 | | var I=false; |
2300 | | while(D!=null){if(D.nodeType==1){var L=""; |
2301 | | if(D.firstChild!=null&&D.firstChild.nodeType==3){L=D.firstChild.nodeValue; |
2302 | | }var B=(D.getAttribute("isDuration")===null&&D.getAttribute("durationEvent")===null)||D.getAttribute("isDuration")=="false"||D.getAttribute("durationEvent")=="false"; |
2303 | | var K=new Timeline.DefaultEventSource.Event({id:D.getAttribute("id"),start:E(D.getAttribute("start")),end:E(D.getAttribute("end")),latestStart:E(D.getAttribute("latestStart")),earliestEnd:E(D.getAttribute("earliestEnd")),instant:B,text:D.getAttribute("title"),description:L,image:this._resolveRelativeURL(D.getAttribute("image"),C),link:this._resolveRelativeURL(D.getAttribute("link"),C),icon:this._resolveRelativeURL(D.getAttribute("icon"),C),color:D.getAttribute("color"),textColor:D.getAttribute("textColor"),hoverText:D.getAttribute("hoverText"),classname:D.getAttribute("classname"),tapeImage:D.getAttribute("tapeImage"),tapeRepeat:D.getAttribute("tapeRepeat"),caption:D.getAttribute("caption"),eventID:D.getAttribute("eventID"),trackNum:D.getAttribute("trackNum")}); |
2304 | | K._node=D; |
2305 | | K.getProperty=function(M){return this._node.getAttribute(M); |
2306 | | }; |
2307 | | K.setWikiInfo(H,J); |
2308 | | this._events.add(K); |
2309 | | I=true; |
2310 | | }D=D.nextSibling; |
2311 | | }if(I){this._fire("onAddMany",[]); |
2312 | | }}; |
2313 | | Timeline.DefaultEventSource.prototype.loadJSON=function(H,B){var D=this._getBaseURL(B); |
2314 | | var J=false; |
2315 | | if(H&&H.events){var I=("wikiURL" in H)?H.wikiURL:null; |
2316 | | var K=("wikiSection" in H)?H.wikiSection:null; |
2317 | | var F=("dateTimeFormat" in H)?H.dateTimeFormat:null; |
2318 | | var E=this._events.getUnit().getParser(F); |
2319 | | for(var G=0; |
2320 | | G<H.events.length; |
2321 | | G++){var A=H.events[G]; |
2322 | | var C=A.isDuration||(A.durationEvent!=null&&!A.durationEvent); |
2323 | | var L=new Timeline.DefaultEventSource.Event({id:("id" in A)?A.id:undefined,start:E(A.start),end:E(A.end),latestStart:E(A.latestStart),earliestEnd:E(A.earliestEnd),instant:C,text:A.title,description:A.description,image:this._resolveRelativeURL(A.image,D),link:this._resolveRelativeURL(A.link,D),icon:this._resolveRelativeURL(A.icon,D),color:A.color,textColor:A.textColor,hoverText:A.hoverText,classname:A.classname,tapeImage:A.tapeImage,tapeRepeat:A.tapeRepeat,caption:A.caption,eventID:A.eventID,trackNum:A.trackNum}); |
2324 | | L._obj=A; |
2325 | | L.getProperty=function(M){return this._obj[M]; |
2326 | | }; |
2327 | | L.setWikiInfo(I,K); |
2328 | | this._events.add(L); |
2329 | | J=true; |
2330 | | }}if(J){this._fire("onAddMany",[]); |
2331 | | }}; |
2332 | | Timeline.DefaultEventSource.prototype.loadSPARQL=function(I,B){var E=this._getBaseURL(B); |
2333 | | var H="iso8601"; |
2334 | | var G=this._events.getUnit().getParser(H); |
2335 | | if(I==null){return ; |
2336 | | }var F=I.documentElement.firstChild; |
2337 | | while(F!=null&&(F.nodeType!=1||F.nodeName!="results")){F=F.nextSibling; |
2338 | | }var J=null; |
2339 | | var L=null; |
2340 | | if(F!=null){J=F.getAttribute("wiki-url"); |
2341 | | L=F.getAttribute("wiki-section"); |
2342 | | F=F.firstChild; |
2343 | | }var K=false; |
2344 | | while(F!=null){if(F.nodeType==1){var D={}; |
2345 | | var A=F.firstChild; |
2346 | | while(A!=null){if(A.nodeType==1&&A.firstChild!=null&&A.firstChild.nodeType==1&&A.firstChild.firstChild!=null&&A.firstChild.firstChild.nodeType==3){D[A.getAttribute("name")]=A.firstChild.firstChild.nodeValue; |
2347 | | }A=A.nextSibling; |
2348 | | }if(D["start"]==null&&D["date"]!=null){D["start"]=D["date"]; |
2349 | | }var C=(D["isDuration"]===null&&D["durationEvent"]===null)||D["isDuration"]=="false"||D["durationEvent"]=="false"; |
2350 | | var M=new Timeline.DefaultEventSource.Event({id:D["id"],start:G(D["start"]),end:G(D["end"]),latestStart:G(D["latestStart"]),earliestEnd:G(D["earliestEnd"]),instant:C,text:D["title"],description:D["description"],image:this._resolveRelativeURL(D["image"],E),link:this._resolveRelativeURL(D["link"],E),icon:this._resolveRelativeURL(D["icon"],E),color:D["color"],textColor:D["textColor"],hoverText:D["hoverText"],caption:D["caption"],classname:D["classname"],tapeImage:D["tapeImage"],tapeRepeat:D["tapeRepeat"],eventID:D["eventID"],trackNum:D["trackNum"]}); |
2351 | | M._bindings=D; |
2352 | | M.getProperty=function(N){return this._bindings[N]; |
2353 | | }; |
2354 | | M.setWikiInfo(J,L); |
2355 | | this._events.add(M); |
2356 | | K=true; |
2357 | | }F=F.nextSibling; |
2358 | | }if(K){this._fire("onAddMany",[]); |
2359 | | }}; |
2360 | | Timeline.DefaultEventSource.prototype.add=function(A){this._events.add(A); |
2361 | | this._fire("onAddOne",[A]); |
2362 | | }; |
2363 | | Timeline.DefaultEventSource.prototype.addMany=function(A){for(var B=0; |
2364 | | B<A.length; |
2365 | | B++){this._events.add(A[B]); |
2366 | | }this._fire("onAddMany",[]); |
2367 | | }; |
2368 | | Timeline.DefaultEventSource.prototype.clear=function(){this._events.removeAll(); |
2369 | | this._fire("onClear",[]); |
2370 | | }; |
2371 | | Timeline.DefaultEventSource.prototype.getEvent=function(A){return this._events.getEvent(A); |
2372 | | }; |
2373 | | Timeline.DefaultEventSource.prototype.getEventIterator=function(A,B){return this._events.getIterator(A,B); |
2374 | | }; |
2375 | | Timeline.DefaultEventSource.prototype.getEventReverseIterator=function(A,B){return this._events.getReverseIterator(A,B); |
2376 | | }; |
2377 | | Timeline.DefaultEventSource.prototype.getAllEventIterator=function(){return this._events.getAllIterator(); |
2378 | | }; |
2379 | | Timeline.DefaultEventSource.prototype.getCount=function(){return this._events.getCount(); |
2380 | | }; |
2381 | | Timeline.DefaultEventSource.prototype.getEarliestDate=function(){return this._events.getEarliestDate(); |
2382 | | }; |
2383 | | Timeline.DefaultEventSource.prototype.getLatestDate=function(){return this._events.getLatestDate(); |
2384 | | }; |
2385 | | Timeline.DefaultEventSource.prototype._fire=function(B,A){for(var C=0; |
2386 | | C<this._listeners.length; |
2387 | | C++){var D=this._listeners[C]; |
2388 | | if(B in D){try{D[B].apply(D,A); |
2389 | | }catch(E){SimileAjax.Debug.exception(E); |
2390 | | }}}}; |
2391 | | Timeline.DefaultEventSource.prototype._getBaseURL=function(A){if(A.indexOf("://")<0){var C=this._getBaseURL(document.location.href); |
2392 | | if(A.substr(0,1)=="/"){A=C.substr(0,C.indexOf("/",C.indexOf("://")+3))+A; |
2393 | | }else{A=C+A; |
2394 | | }}var B=A.lastIndexOf("/"); |
2395 | | if(B<0){return""; |
2396 | | }else{return A.substr(0,B+1); |
2397 | | }}; |
2398 | | Timeline.DefaultEventSource.prototype._resolveRelativeURL=function(A,B){if(A==null||A==""){return A; |
2399 | | }else{if(A.indexOf("://")>0){return A; |
2400 | | }else{if(A.substr(0,1)=="/"){return B.substr(0,B.indexOf("/",B.indexOf("://")+3))+A; |
2401 | | }else{return B+A; |
2402 | | }}}}; |
2403 | | Timeline.DefaultEventSource.Event=function(A){function D(E){return(A[E]!=null&&A[E]!="")?A[E]:null; |
2404 | | }var C=A.id?A.id.trim():""; |
2405 | | this._id=C.length>0?C:Timeline.EventUtils.getNewEventID(); |
2406 | | this._instant=A.instant||(A.end==null); |
2407 | | this._start=A.start; |
2408 | | this._end=(A.end!=null)?A.end:A.start; |
2409 | | this._latestStart=(A.latestStart!=null)?A.latestStart:(A.instant?this._end:this._start); |
2410 | | this._earliestEnd=(A.earliestEnd!=null)?A.earliestEnd:this._end; |
2411 | | var B=[]; |
2412 | | if(this._start>this._latestStart){this._latestStart=this._start; |
2413 | | B.push("start is > latestStart"); |
2414 | | }if(this._start>this._earliestEnd){this._earliestEnd=this._latestStart; |
2415 | | B.push("start is > earliestEnd"); |
2416 | | }if(this._start>this._end){this._end=this._earliestEnd; |
2417 | | B.push("start is > end"); |
2418 | | }if(this._latestStart>this._earliestEnd){this._earliestEnd=this._latestStart; |
2419 | | B.push("latestStart is > earliestEnd"); |
2420 | | }if(this._latestStart>this._end){this._end=this._earliestEnd; |
2421 | | B.push("latestStart is > end"); |
2422 | | }if(this._earliestEnd>this._end){this._end=this._earliestEnd; |
2423 | | B.push("earliestEnd is > end"); |
2424 | | }this._eventID=D("eventID"); |
2425 | | this._text=(A.text!=null)?SimileAjax.HTML.deEntify(A.text):""; |
2426 | | if(B.length>0){this._text+=" PROBLEM: "+B.join(", "); |
2427 | | }this._description=SimileAjax.HTML.deEntify(A.description); |
2428 | | this._image=D("image"); |
2429 | | this._link=D("link"); |
2430 | | this._title=D("hoverText"); |
2431 | | this._title=D("caption"); |
2432 | | this._icon=D("icon"); |
2433 | | this._color=D("color"); |
2434 | | this._textColor=D("textColor"); |
2435 | | this._classname=D("classname"); |
2436 | | this._tapeImage=D("tapeImage"); |
2437 | | this._tapeRepeat=D("tapeRepeat"); |
2438 | | this._trackNum=D("trackNum"); |
2439 | | if(this._trackNum!=null){this._trackNum=parseInt(this._trackNum); |
2440 | | }this._wikiURL=null; |
2441 | | this._wikiSection=null; |
2442 | | }; |
2443 | | Timeline.DefaultEventSource.Event.prototype={getID:function(){return this._id; |
2444 | | },isInstant:function(){return this._instant; |
2445 | | },isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd; |
2446 | | },getStart:function(){return this._start; |
2447 | | },getEnd:function(){return this._end; |
2448 | | },getLatestStart:function(){return this._latestStart; |
2449 | | },getEarliestEnd:function(){return this._earliestEnd; |
2450 | | },getEventID:function(){return this._eventID; |
2451 | | },getText:function(){return this._text; |
2452 | | },getDescription:function(){return this._description; |
2453 | | },getImage:function(){return this._image; |
2454 | | },getLink:function(){return this._link; |
2455 | | },getIcon:function(){return this._icon; |
2456 | | },getColor:function(){return this._color; |
2457 | | },getTextColor:function(){return this._textColor; |
2458 | | },getClassName:function(){return this._classname; |
2459 | | },getTapeImage:function(){return this._tapeImage; |
2460 | | },getTapeRepeat:function(){return this._tapeRepeat; |
2461 | | },getTrackNum:function(){return this._trackNum; |
2462 | | },getProperty:function(A){return null; |
2463 | | },getWikiURL:function(){return this._wikiURL; |
2464 | | },getWikiSection:function(){return this._wikiSection; |
2465 | | },setWikiInfo:function(B,A){this._wikiURL=B; |
2466 | | this._wikiSection=A; |
2467 | | },fillDescription:function(A){A.innerHTML=this._description; |
2468 | | },fillWikiInfo:function(D){D.style.display="none"; |
2469 | | if(this._wikiURL==null||this._wikiSection==null){return ; |
2470 | | }var C=this.getProperty("wikiID"); |
2471 | | if(C==null||C.length==0){C=this.getText(); |
2472 | | }if(C==null||C.length==0){return ; |
2473 | | }D.style.display="inline"; |
2474 | | C=C.replace(/\s/g,"_"); |
2475 | | var B=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+C; |
2476 | | var A=document.createElement("a"); |
2477 | | A.href=B; |
2478 | | A.target="new"; |
2479 | | A.innerHTML=Timeline.strings[Timeline.clientLocale].wikiLinkLabel; |
2480 | | D.appendChild(document.createTextNode("[")); |
2481 | | D.appendChild(A); |
2482 | | D.appendChild(document.createTextNode("]")); |
2483 | | },fillTime:function(A,B){if(this._instant){if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); |
2484 | | A.appendChild(A.ownerDocument.createElement("br")); |
2485 | | A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end))); |
2486 | | }else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); |
2487 | | }}else{if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)+" ~ "+B.labelPrecise(this._latestStart))); |
2488 | | A.appendChild(A.ownerDocument.createElement("br")); |
2489 | | A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._earliestEnd)+" ~ "+B.labelPrecise(this._end))); |
2490 | | }else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start))); |
2491 | | A.appendChild(A.ownerDocument.createElement("br")); |
2492 | | A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end))); |
2493 | | }}},fillInfoBubble:function(A,E,M){var K=A.ownerDocument; |
2494 | | var J=this.getText(); |
2495 | | var H=this.getLink(); |
2496 | | var B=this.getImage(); |
2497 | | if(B!=null){var D=K.createElement("img"); |
2498 | | D.src=B; |
2499 | | E.event.bubble.imageStyler(D); |
2500 | | A.appendChild(D); |
2501 | | }var L=K.createElement("div"); |
2502 | | var C=K.createTextNode(J); |
2503 | | if(H!=null){var I=K.createElement("a"); |
2504 | | I.href=H; |
2505 | | I.appendChild(C); |
2506 | | L.appendChild(I); |
2507 | | }else{L.appendChild(C); |
2508 | | }E.event.bubble.titleStyler(L); |
2509 | | A.appendChild(L); |
2510 | | var N=K.createElement("div"); |
2511 | | this.fillDescription(N); |
2512 | | E.event.bubble.bodyStyler(N); |
2513 | | A.appendChild(N); |
2514 | | var G=K.createElement("div"); |
2515 | | this.fillTime(G,M); |
2516 | | E.event.bubble.timeStyler(G); |
2517 | | A.appendChild(G); |
2518 | | var F=K.createElement("div"); |
2519 | | this.fillWikiInfo(F); |
2520 | | E.event.bubble.wikiStyler(F); |
2521 | | A.appendChild(F); |
2522 | | }}; |
| 3557 | Timeline.DefaultEventSource = function (A) { |
| 3558 | this._events = (A instanceof Object) ? A : new SimileAjax.EventIndex(); |
| 3559 | this._listeners = []; |
| 3560 | }; |
| 3561 | Timeline.DefaultEventSource.prototype.addListener = function (A) { |
| 3562 | this._listeners.push(A); |
| 3563 | }; |
| 3564 | Timeline.DefaultEventSource.prototype.removeListener = function (B) { |
| 3565 | for (var A = 0; |
| 3566 | A < this._listeners.length; |
| 3567 | A++) { |
| 3568 | if (this._listeners[A] == B) { |
| 3569 | this._listeners.splice(A, 1); |
| 3570 | break; |
| 3571 | } |
| 3572 | } |
| 3573 | }; |
| 3574 | Timeline.DefaultEventSource.prototype.loadXML = function (G, A) { |
| 3575 | var C = this._getBaseURL(A); |
| 3576 | var H = G.documentElement.getAttribute("wiki-url"); |
| 3577 | var J = G.documentElement.getAttribute("wiki-section"); |
| 3578 | var F = G.documentElement.getAttribute("date-time-format"); |
| 3579 | var E = this._events.getUnit().getParser(F); |
| 3580 | var D = G.documentElement.firstChild; |
| 3581 | var I = false; |
| 3582 | while (D != null) { |
| 3583 | if (D.nodeType == 1) { |
| 3584 | var L = ""; |
| 3585 | if (D.firstChild != null && D.firstChild.nodeType == 3) { |
| 3586 | L = D.firstChild.nodeValue; |
| 3587 | } |
| 3588 | var B = (D.getAttribute("isDuration") === null && D.getAttribute("durationEvent") === null) || D.getAttribute("isDuration") == "false" || D.getAttribute("durationEvent") == "false"; |
| 3589 | var K = new Timeline.DefaultEventSource.Event({ |
| 3590 | id: D.getAttribute("id"), |
| 3591 | start: E(D.getAttribute("start")), |
| 3592 | end: E(D.getAttribute("end")), |
| 3593 | latestStart: E(D.getAttribute("latestStart")), |
| 3594 | earliestEnd: E(D.getAttribute("earliestEnd")), |
| 3595 | instant: B, |
| 3596 | text: D.getAttribute("title"), |
| 3597 | description: L, |
| 3598 | image: this._resolveRelativeURL(D.getAttribute("image"), C), |
| 3599 | link: this._resolveRelativeURL(D.getAttribute("link"), C), |
| 3600 | icon: this._resolveRelativeURL(D.getAttribute("icon"), C), |
| 3601 | color: D.getAttribute("color"), |
| 3602 | textColor: D.getAttribute("textColor"), |
| 3603 | hoverText: D.getAttribute("hoverText"), |
| 3604 | classname: D.getAttribute("classname"), |
| 3605 | tapeImage: D.getAttribute("tapeImage"), |
| 3606 | tapeRepeat: D.getAttribute("tapeRepeat"), |
| 3607 | caption: D.getAttribute("caption"), |
| 3608 | eventID: D.getAttribute("eventID"), |
| 3609 | trackNum: D.getAttribute("trackNum") |
| 3610 | }); |
| 3611 | K._node = D; |
| 3612 | K.getProperty = function (M) { |
| 3613 | return this._node.getAttribute(M); |
| 3614 | }; |
| 3615 | &n |