Commit 50098ef1e1f0854862cc963cc8d95bce4f14a25f
1 parent
d0692c05
Exists in
master
and in
42 other branches
Disable Next and Previous option for PlotFunction in Preview mode
Showing
1 changed file
with
160 additions
and
160 deletions
Show diff stats
js/app/views/PlotComponents/PlotPreviewUI.js
... | ... | @@ -13,49 +13,50 @@ |
13 | 13 | */ |
14 | 14 | |
15 | 15 | Ext.define('amdaPlotComp.PlotPreviewUI', { |
16 | - extend: 'Ext.panel.Panel', | |
17 | - | |
18 | - alias: 'widget.plotPreview', | |
16 | + extend: 'Ext.panel.Panel', | |
19 | 17 | |
20 | - requires: [ | |
21 | - 'amdaPlotComp.PlotContextManager', | |
22 | - 'amdaPlotComp.PlotResultImage', | |
18 | + alias: 'widget.plotPreview', | |
19 | + | |
20 | + requires: [ | |
21 | + 'amdaPlotComp.PlotContextManager', | |
22 | + 'amdaPlotComp.PlotResultImage', | |
23 | 23 | 'amdaUI.PlotTabResultUI' |
24 | - ], | |
25 | - | |
26 | - panelImage : null, | |
27 | - crtContext : null, | |
28 | - sliderPage : null, | |
29 | - contextualMenu : null, | |
30 | - hiddenForm: null, | |
31 | - panelResultInstance:null, | |
24 | + ], | |
25 | + | |
26 | + isPlotFunction: false, | |
27 | + panelImage: null, | |
28 | + crtContext: null, | |
29 | + sliderPage: null, | |
30 | + contextualMenu: null, | |
31 | + hiddenForm: null, | |
32 | + panelResultInstance: null, | |
32 | 33 | |
33 | - setPanelResultInstance: function(panelResultInstance_) | |
34 | - { | |
34 | + setPanelResultInstance: function (panelResultInstance_) { | |
35 | 35 | this.panelResultInstance = panelResultInstance_; |
36 | 36 | }, |
37 | - constructor: function(config) { | |
38 | - this.init(config); | |
39 | - this.callParent(arguments); | |
40 | - }, | |
41 | - | |
42 | - getImageSize : function() { | |
43 | - if (!this.crtContext) | |
44 | - return { | |
45 | - width : 0, | |
46 | - height : 0 | |
47 | - }; | |
48 | - | |
49 | - return { | |
50 | - width : this.crtContext.page.width * this.sliderPage.getValue()/100., | |
51 | - height : this.crtContext.page.height * this.sliderPage.getValue()/100. | |
52 | - } | |
53 | - }, | |
54 | - | |
55 | - getImageUrl: function(resultFolder, plotFile) { | |
56 | - return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile; | |
57 | - }, | |
58 | - | |
37 | + | |
38 | + constructor: function (config) { | |
39 | + this.init(config); | |
40 | + this.callParent(arguments); | |
41 | + }, | |
42 | + | |
43 | + getImageSize: function () { | |
44 | + if (!this.crtContext) | |
45 | + return { | |
46 | + width: 0, | |
47 | + height: 0 | |
48 | + }; | |
49 | + | |
50 | + return { | |
51 | + width: this.crtContext.page.width * this.sliderPage.getValue() / 100., | |
52 | + height: this.crtContext.page.height * this.sliderPage.getValue() / 100. | |
53 | + } | |
54 | + }, | |
55 | + | |
56 | + getImageUrl: function (resultFolder, plotFile) { | |
57 | + return 'data/' + sessionID + '/RES/' + resultFolder + '/' + plotFile; | |
58 | + }, | |
59 | + | |
59 | 60 | toPixelOnSourceImage: function (value) { |
60 | 61 | return value * 100 / this.sliderPage.getValue(); |
61 | 62 | }, |
... | ... | @@ -68,13 +69,13 @@ Ext.define('amdaPlotComp.PlotPreviewUI', { |
68 | 69 | return parseFloat(val).toPrecision(5); |
69 | 70 | }, |
70 | 71 | |
71 | - createPlotImage: function(resultFolder, plotFile) { | |
72 | - var me = this; | |
73 | - var size = this.getImageSize(); | |
74 | - this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', { | |
75 | - src : this.getImageUrl(resultFolder, plotFile), | |
76 | - width : size.width, | |
77 | - height : size.height, | |
72 | + createPlotImage: function (resultFolder, plotFile) { | |
73 | + var me = this; | |
74 | + var size = this.getImageSize(); | |
75 | + this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', { | |
76 | + src: this.getImageUrl(resultFolder, plotFile), | |
77 | + width: size.width, | |
78 | + height: size.height, | |
78 | 79 | onMouseMove: function (x, y) { |
79 | 80 | if (!me.crtContext) |
80 | 81 | return; |
... | ... | @@ -131,70 +132,70 @@ Ext.define('amdaPlotComp.PlotPreviewUI', { |
131 | 132 | } |
132 | 133 | me.coordinatesField.setText(text); |
133 | 134 | }, |
134 | - onContextMenu : function(absoluteX, absoluteY, imageX, imageY) { | |
135 | - me.contextualMenu.showAt(absoluteX, absoluteY); | |
136 | - } | |
137 | - }); | |
135 | + onContextMenu: function (absoluteX, absoluteY, imageX, imageY) { | |
136 | + me.contextualMenu.showAt(absoluteX, absoluteY); | |
137 | + } | |
138 | + }); | |
138 | 139 | |
139 | - return this.panelImage; | |
140 | - }, | |
141 | - | |
142 | - updatePlotImage: function(configResult, newPlot) { | |
143 | - this.crtContext = configResult.context; | |
140 | + return this.panelImage; | |
141 | + }, | |
142 | + | |
143 | + updatePlotImage: function (configResult, newPlot) { | |
144 | + this.crtContext = configResult.context; | |
144 | 145 | |
145 | - this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile)); | |
146 | + this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile)); | |
146 | 147 | var newTime = new Date(configResult.time); |
147 | 148 | newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, newTime.getTimezoneOffset()); |
148 | 149 | Ext.getCmp('plotPreview-goto-Date' + configResult.interactiveId).setValue(newTime); |
149 | - var size = this.getImageSize(); | |
150 | - this.panelImage.setSize(size.width, size.height); | |
151 | - | |
152 | - this.panelImage.refreshMe(); | |
153 | - }, | |
154 | - | |
155 | - init: function(configResult){ | |
156 | - var me = this; | |
150 | + var size = this.getImageSize(); | |
151 | + this.panelImage.setSize(size.width, size.height); | |
152 | + | |
153 | + this.panelImage.refreshMe(); | |
154 | + }, | |
155 | + | |
156 | + init: function (configResult) { | |
157 | + var me = this; | |
157 | 158 | |
158 | - this.crtContext = configResult.context; | |
159 | - this.interactiveId = configResult.interactiveId; | |
159 | + this.crtContext = configResult.context; | |
160 | + this.interactiveId = configResult.interactiveId; | |
160 | 161 | this.time = new Date(configResult.time); |
161 | 162 | this.time = Ext.Date.add(this.time, Ext.Date.MINUTE, this.time.getTimezoneOffset()); |
162 | - this.panelId= configResult.panelId | |
163 | - | |
163 | + this.panelId = configResult.panelId; | |
164 | + this.isPlotFunction = configResult.plotFile.includes("plotFunction"); | |
165 | + | |
164 | 166 | this.coordinatesField = new Ext.toolbar.TextItem({ |
165 | 167 | width: 300, |
166 | 168 | text: '' |
167 | 169 | }); |
168 | 170 | |
169 | - this.sliderPage = new Ext.slider.Single({ | |
170 | - width: 130, | |
171 | - value: 75, | |
172 | - increment: 5, | |
173 | - minValue: 50, | |
174 | - maxValue: 100, | |
175 | - fieldLabel : 'Resize', | |
176 | - labelWidth : 40, | |
177 | - listeners: { | |
178 | - scope : this, | |
179 | - changecomplete: function(s, v) | |
180 | - { | |
181 | - var size = this.getImageSize(); | |
182 | - this.panelImage.width = size.width; | |
183 | - this.panelImage.height = size.height; | |
184 | - this.panelImage.doComponentLayout(); | |
185 | - } | |
186 | - } | |
187 | - }); | |
188 | - var topToolbar= | |
171 | + this.sliderPage = new Ext.slider.Single({ | |
172 | + width: 130, | |
173 | + value: 75, | |
174 | + increment: 5, | |
175 | + minValue: 50, | |
176 | + maxValue: 100, | |
177 | + fieldLabel: 'Resize', | |
178 | + labelWidth: 40, | |
179 | + listeners: { | |
180 | + scope: this, | |
181 | + changecomplete: function (s, v) { | |
182 | + var size = this.getImageSize(); | |
183 | + this.panelImage.width = size.width; | |
184 | + this.panelImage.height = size.height; | |
185 | + this.panelImage.doComponentLayout(); | |
186 | + } | |
187 | + } | |
188 | + }); | |
189 | + var topToolbar = | |
189 | 190 | { |
190 | - xtype:'toolbar', | |
191 | - dock:'top', | |
192 | - items:[{ | |
191 | + xtype: 'toolbar', | |
192 | + dock: 'top', | |
193 | + items: [{ | |
193 | 194 | xtype: 'datefield', |
194 | - allowBlank:true, | |
195 | + allowBlank: true, | |
195 | 196 | format: 'Y-m-d\\TH:i:s.u', |
196 | 197 | id: 'plotPreview-goto-Date' + this.interactiveId, |
197 | - value:this.time, | |
198 | + value: this.time, | |
198 | 199 | width: 175, |
199 | 200 | renderer: function (value) { |
200 | 201 | if (value != null) { |
... | ... | @@ -208,33 +209,33 @@ Ext.define('amdaPlotComp.PlotPreviewUI', { |
208 | 209 | } |
209 | 210 | } |
210 | 211 | |
211 | - },'-', | |
212 | - { | |
213 | - text: 'Change cut time', | |
214 | - scope: this, | |
215 | - handler: function (bt) { | |
216 | - var newTime = Ext.getCmp('plotPreview-goto-Date' + me.interactiveId).getValue(); | |
217 | - newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, -newTime.getTimezoneOffset()); | |
218 | - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()}); | |
219 | - } | |
220 | - }, | |
212 | + }, '-', | |
213 | + { | |
214 | + text: 'Change cut time', | |
215 | + scope: this, | |
216 | + handler: function (bt) { | |
217 | + var newTime = Ext.getCmp('plotPreview-goto-Date' + me.interactiveId).getValue(); | |
218 | + newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, -newTime.getTimezoneOffset()); | |
219 | + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() }); | |
220 | + } | |
221 | + }, | |
221 | 222 | '-', |
222 | - { | |
223 | - xtype:'button', | |
224 | - text : 'Previous', | |
225 | - handler: function(){ | |
226 | - var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimePrev(me.crtContext)*1000); | |
227 | - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()}); | |
228 | - } | |
229 | - }, | |
230 | - { | |
231 | - xtype:'button', | |
232 | - text : 'Next', | |
233 | - handler: function(){ | |
234 | - var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimeNext(me.crtContext) *1000); | |
235 | - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()}); | |
236 | - } | |
223 | + { | |
224 | + xtype: 'button', | |
225 | + text: 'Previous', | |
226 | + handler: function () { | |
227 | + var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimePrev(me.crtContext) * 1000); | |
228 | + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() }); | |
229 | + } | |
230 | + }, | |
231 | + { | |
232 | + xtype: 'button', | |
233 | + text: 'Next', | |
234 | + handler: function () { | |
235 | + var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimeNext(me.crtContext) * 1000); | |
236 | + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() }); | |
237 | 237 | } |
238 | + } | |
238 | 239 | ] |
239 | 240 | } |
240 | 241 | var mouseToolbar = { |
... | ... | @@ -248,50 +249,49 @@ Ext.define('amdaPlotComp.PlotPreviewUI', { |
248 | 249 | ] |
249 | 250 | }; |
250 | 251 | |
251 | - this.contextualMenu = Ext.create('Ext.menu.Menu', { | |
252 | - width: 200, | |
253 | - plain: true, | |
254 | - items: [ | |
255 | - { | |
256 | - text: 'Save Plot', | |
257 | - handler : function () | |
252 | + this.contextualMenu = Ext.create('Ext.menu.Menu', { | |
253 | + width: 200, | |
254 | + plain: true, | |
255 | + items: [ | |
258 | 256 | { |
259 | - if (me.hiddenForm == null) | |
260 | - me.hiddenForm = Ext.create('Ext.form.Panel', { | |
261 | - title:'hiddenForm', | |
262 | - renderTo: Ext.getBody(), | |
263 | - standardSubmit: true, | |
264 | - url: 'php/downloadPlot.php', | |
265 | - timeout: 120000, | |
266 | - height:100, | |
267 | - width: 100, | |
268 | - hidden:true, | |
269 | - items:[] | |
270 | - }); | |
257 | + text: 'Save Plot', | |
258 | + handler: function () { | |
259 | + if (me.hiddenForm == null) | |
260 | + me.hiddenForm = Ext.create('Ext.form.Panel', { | |
261 | + title: 'hiddenForm', | |
262 | + renderTo: Ext.getBody(), | |
263 | + standardSubmit: true, | |
264 | + url: 'php/downloadPlot.php', | |
265 | + timeout: 120000, | |
266 | + height: 100, | |
267 | + width: 100, | |
268 | + hidden: true, | |
269 | + items: [] | |
270 | + }); | |
271 | 271 | |
272 | - me.hiddenForm.getForm().submit({ | |
273 | - params: { | |
274 | - sessionId: sessionID, | |
275 | - interactiveId : me.interactiveId, | |
276 | - preview: true | |
277 | - }, | |
278 | - success: function(form, action) {}, | |
279 | - failure: function(form, action) {} | |
280 | - }); | |
272 | + me.hiddenForm.getForm().submit({ | |
273 | + params: { | |
274 | + sessionId: sessionID, | |
275 | + interactiveId: me.interactiveId, | |
276 | + preview: true | |
277 | + }, | |
278 | + success: function (form, action) { }, | |
279 | + failure: function (form, action) { } | |
280 | + }); | |
281 | + } | |
281 | 282 | } |
282 | - } | |
283 | - ] | |
284 | - }); | |
285 | - | |
286 | - var plotPreviewPanelConfig = { | |
287 | - preventHeader : true, | |
288 | - autoScroll: false, | |
289 | - items: [ | |
290 | - this.createPlotImage(configResult.folder, configResult.plotFile) | |
291 | - ], | |
292 | - dockedItems: [topToolbar,mouseToolbar] | |
293 | - }; | |
294 | - | |
295 | - Ext.apply(this , plotPreviewPanelConfig); | |
296 | - } | |
283 | + ] | |
284 | + }); | |
285 | + | |
286 | + var plotPreviewPanelConfig = { | |
287 | + preventHeader: true, | |
288 | + autoScroll: false, | |
289 | + items: [ | |
290 | + this.createPlotImage(configResult.folder, configResult.plotFile) | |
291 | + ], | |
292 | + dockedItems: me.isPlotFunction ? [mouseToolbar] : [topToolbar, mouseToolbar] | |
293 | + }; | |
294 | + | |
295 | + Ext.apply(this, plotPreviewPanelConfig); | |
296 | + } | |
297 | 297 | }); |
... | ... |