Commit 87dcaf0151c7f2bf89071629fe30a21775d8bc48
1 parent
6e2fdb1f
Exists in
master
and in
102 other branches
Rename plot name in PlotUI
Showing
1 changed file
with
26 additions
and
8 deletions
Show diff stats
js/app/views/PlotComponents/PlotTabPanel.js
@@ -53,6 +53,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | @@ -53,6 +53,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | ||
53 | var tabNumber = this.getTabBar().items.getCount(); | 53 | var tabNumber = this.getTabBar().items.getCount(); |
54 | var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')}); | 54 | var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')}); |
55 | tabContent.setTabObject(tabObject); | 55 | tabContent.setTabObject(tabObject); |
56 | + var me = this; | ||
56 | var tabComp = this.add({ | 57 | var tabComp = this.add({ |
57 | title: (tabObject.get('tab-name') != '') ? tabObject.get('tab-name') : 'Plot '+tabNumber, | 58 | title: (tabObject.get('tab-name') != '') ? tabObject.get('tab-name') : 'Plot '+tabNumber, |
58 | closable: true, | 59 | closable: true, |
@@ -79,8 +80,31 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | @@ -79,8 +80,31 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | ||
79 | this.object.removeTabById(tab.items.getAt(0).object.get('id')); | 80 | this.object.removeTabById(tab.items.getAt(0).object.get('id')); |
80 | }, | 81 | }, |
81 | destroy: function(tab, eOpts) { | 82 | destroy: function(tab, eOpts) { |
83 | + | ||
82 | this.updatePlotTabs(); | 84 | this.updatePlotTabs(); |
83 | - } | 85 | + }, |
86 | + afterrender: function(tab, e0pts) { | ||
87 | + tab.tab.el.on('contextmenu', function(e, t, eOpts) { | ||
88 | + var menu = new Ext.menu.Menu({ | ||
89 | + items: [ | ||
90 | + { | ||
91 | + text: 'Rename', | ||
92 | + handler: function() { | ||
93 | + Ext.Msg.prompt('Rename', 'Please enter new plot tab name:', function(btn, text){ | ||
94 | + if (btn == 'ok'){ | ||
95 | + tabObject.set('tab-name',text); | ||
96 | + me.updatePlotTabs(); | ||
97 | + } | ||
98 | + }, me); | ||
99 | + } | ||
100 | + } | ||
101 | + ] | ||
102 | + }); | ||
103 | + var position = e.getXY(); | ||
104 | + e.stopEvent(); | ||
105 | + menu.showAt(position); | ||
106 | + },this); | ||
107 | + } | ||
84 | } | 108 | } |
85 | }); | 109 | }); |
86 | 110 | ||
@@ -165,13 +189,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | @@ -165,13 +189,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { | ||
165 | handler:function(btn,e){ | 189 | handler:function(btn,e){ |
166 | var tabContent = me.addPlotTab(me.object.createNewTab(), true); | 190 | var tabContent = me.addPlotTab(me.object.createNewTab(), true); |
167 | } | 191 | } |
168 | - }], | ||
169 | - listeners: { | ||
170 | - click: function(tabBar, e, eOpts) { | ||
171 | - console.log('click'); | ||
172 | - }, | ||
173 | - scope: me | ||
174 | - } | 192 | + }] |
175 | }, | 193 | }, |
176 | 194 | ||
177 | listeners: { | 195 | listeners: { |