1 |
iliev |
787 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
2200 |
* Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
787 |
* |
6 |
|
|
* This file is part of JSampler. |
7 |
|
|
* |
8 |
|
|
* JSampler is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License version 2 |
10 |
|
|
* as published by the Free Software Foundation. |
11 |
|
|
* |
12 |
|
|
* JSampler is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with JSampler; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
|
|
* MA 02111-1307 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
package org.jsampler.view.classic; |
24 |
|
|
|
25 |
|
|
import java.awt.BorderLayout; |
26 |
|
|
import java.awt.Component; |
27 |
iliev |
1318 |
import java.awt.Rectangle; |
28 |
iliev |
787 |
|
29 |
|
|
import java.awt.event.MouseAdapter; |
30 |
|
|
import java.awt.event.MouseEvent; |
31 |
|
|
|
32 |
|
|
import java.util.Vector; |
33 |
|
|
|
34 |
|
|
import javax.swing.BorderFactory; |
35 |
|
|
import javax.swing.JMenu; |
36 |
|
|
import javax.swing.JMenuItem; |
37 |
|
|
import javax.swing.JPopupMenu; |
38 |
|
|
import javax.swing.JScrollPane; |
39 |
|
|
import javax.swing.ListSelectionModel; |
40 |
|
|
|
41 |
|
|
import javax.swing.event.ListSelectionEvent; |
42 |
|
|
import javax.swing.event.ListSelectionListener; |
43 |
|
|
|
44 |
iliev |
2288 |
import net.sf.juife.swing.ComponentList; |
45 |
|
|
import net.sf.juife.swing.ComponentListModel; |
46 |
|
|
import net.sf.juife.swing.DefaultComponentListModel; |
47 |
iliev |
911 |
|
48 |
iliev |
787 |
import org.jsampler.CC; |
49 |
|
|
import org.jsampler.SamplerChannelModel; |
50 |
|
|
|
51 |
|
|
import org.jsampler.view.JSChannelsPane; |
52 |
iliev |
2288 |
import org.jsampler.view.swing.SHF; |
53 |
|
|
import org.jsampler.view.swing.SwingChannelsPane; |
54 |
iliev |
787 |
|
55 |
iliev |
1818 |
import static org.jsampler.view.classic.A4n.a4n; |
56 |
iliev |
787 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
/** |
60 |
|
|
* |
61 |
|
|
* @author Grigor Iliev |
62 |
|
|
*/ |
63 |
iliev |
2288 |
public class ChannelsPane extends SwingChannelsPane<Channel> implements ListSelectionListener { |
64 |
iliev |
787 |
private final ComponentList chnList = new ComponentList(); |
65 |
|
|
private final DefaultComponentListModel listModel = new DefaultComponentListModel(); |
66 |
iliev |
1318 |
|
67 |
|
|
private final JScrollPane scrollPane; |
68 |
iliev |
787 |
|
69 |
iliev |
911 |
/** |
70 |
|
|
* Creates a new instance of <code>ChannelsPane</code> with |
71 |
|
|
* the specified <code>title</code>. |
72 |
|
|
* @param title The title of this <code>ChannelsPane</code> |
73 |
|
|
*/ |
74 |
iliev |
787 |
public |
75 |
|
|
ChannelsPane(String title) { |
76 |
|
|
super(title); |
77 |
|
|
|
78 |
|
|
setLayout(new BorderLayout()); |
79 |
|
|
|
80 |
|
|
chnList.setOpaque(false); |
81 |
|
|
//chnList.setLayoutOrientation(JList.HORIZONTAL_WRAP); |
82 |
|
|
chnList.setModel(listModel); |
83 |
|
|
chnList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
84 |
|
|
chnList.addListSelectionListener(this); |
85 |
|
|
chnList.addMouseListener(new ContextMenu()); |
86 |
|
|
//chnList.setDragEnabled(true); |
87 |
|
|
|
88 |
iliev |
1318 |
scrollPane = new JScrollPane(chnList); |
89 |
|
|
scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
90 |
|
|
add(scrollPane); |
91 |
iliev |
787 |
|
92 |
|
|
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
93 |
|
|
|
94 |
|
|
} |
95 |
|
|
|
96 |
iliev |
1818 |
@Override |
97 |
iliev |
1776 |
public void |
98 |
iliev |
2288 |
setSelectedChannel(Channel channel) { |
99 |
iliev |
1776 |
chnList.setSelectedComponent(channel, true); |
100 |
|
|
} |
101 |
|
|
|
102 |
iliev |
787 |
/** |
103 |
|
|
* Adds new channel to this channels pane. |
104 |
|
|
* @param channelModel The sampler channel model to be used by the new channel. |
105 |
|
|
*/ |
106 |
iliev |
1818 |
@Override |
107 |
iliev |
787 |
public void |
108 |
|
|
addChannel(SamplerChannelModel channelModel) { |
109 |
|
|
Channel channel = new Channel(channelModel); |
110 |
|
|
listModel.add(channel); |
111 |
|
|
if(channel.getChannelInfo().getEngine() == null) channel.expandChannel(); |
112 |
|
|
chnList.setSelectedComponent(channel, true); |
113 |
iliev |
1318 |
scrollToBottom(); |
114 |
iliev |
2200 |
|
115 |
|
|
firePropertyChange("channelAdded", null, channelModel); |
116 |
iliev |
787 |
} |
117 |
|
|
|
118 |
|
|
/** |
119 |
|
|
* Adds the specified channels to this channels pane. |
120 |
|
|
* @param chns The channels to be added. |
121 |
|
|
*/ |
122 |
iliev |
1818 |
@Override |
123 |
iliev |
911 |
public void |
124 |
iliev |
2288 |
addChannels(Channel[] chns) { |
125 |
iliev |
911 |
if(chns == null || chns.length == 0) return; |
126 |
|
|
|
127 |
iliev |
2288 |
for(Channel c : chns) listModel.add(c); |
128 |
iliev |
787 |
chnList.setSelectionInterval ( |
129 |
|
|
listModel.getSize() - chns.length, listModel.getSize() - 1 |
130 |
|
|
); |
131 |
|
|
|
132 |
|
|
chnList.ensureIndexIsVisible(listModel.getSize() - 1); |
133 |
iliev |
2200 |
|
134 |
|
|
firePropertyChange("channelsAdded", null, chns); |
135 |
iliev |
787 |
} |
136 |
|
|
|
137 |
|
|
/** |
138 |
|
|
* Removes the specified channel from this channels pane. |
139 |
|
|
* This method is invoked when a sampler channel is removed in the back-end. |
140 |
|
|
* @param chn The channel to be removed from this channels pane. |
141 |
|
|
*/ |
142 |
iliev |
1818 |
@Override |
143 |
iliev |
787 |
public void |
144 |
iliev |
2288 |
removeChannel(Channel chn) { |
145 |
iliev |
2200 |
listModel.remove(chn); |
146 |
|
|
|
147 |
|
|
firePropertyChange("channelRemoved", null, chn); |
148 |
|
|
} |
149 |
iliev |
787 |
|
150 |
|
|
/** |
151 |
|
|
* Gets the first channel in this channels pane. |
152 |
|
|
* @return The first channel in this channels pane or <code>null</code> if |
153 |
|
|
* the channels pane is empty. |
154 |
|
|
*/ |
155 |
iliev |
1818 |
@Override |
156 |
iliev |
2288 |
public Channel |
157 |
|
|
getFirstChannel() { return listModel.size() == 0 ? null : (Channel)listModel.get(0); } |
158 |
iliev |
787 |
|
159 |
|
|
/** |
160 |
|
|
* Gets the last channel in this channels pane. |
161 |
|
|
* @return The last channel in this channels pane or <code>null</code> if |
162 |
|
|
* the channels pane is empty. |
163 |
|
|
*/ |
164 |
iliev |
1818 |
@Override |
165 |
iliev |
2288 |
public Channel |
166 |
iliev |
787 |
getLastChannel() { |
167 |
iliev |
2288 |
return listModel.size() == 0 ? null : (Channel)listModel.get(listModel.size()-1); |
168 |
iliev |
787 |
} |
169 |
|
|
|
170 |
|
|
/** |
171 |
|
|
* Gets the channel at the specified index. |
172 |
|
|
* @return The channel at the specified index. |
173 |
|
|
* @throws ArrayIndexOutOfBoundsException If the index is out of range. |
174 |
|
|
*/ |
175 |
iliev |
1818 |
@Override |
176 |
iliev |
2288 |
public Channel |
177 |
|
|
getChannel(int idx) { return (Channel)listModel.get(idx); } |
178 |
iliev |
787 |
|
179 |
|
|
/** |
180 |
|
|
* Gets an array with all channels in this channels pane. |
181 |
|
|
* @return An array with all channels in this channels pane. |
182 |
|
|
*/ |
183 |
iliev |
1818 |
@Override |
184 |
iliev |
2288 |
public Channel[] |
185 |
iliev |
787 |
getChannels() { |
186 |
iliev |
2288 |
Channel[] chns = new Channel[listModel.size()]; |
187 |
|
|
for(int i = 0; i < listModel.size(); i++) chns[i] = (Channel)listModel.get(i); |
188 |
iliev |
787 |
return chns; |
189 |
|
|
} |
190 |
|
|
|
191 |
|
|
/** |
192 |
|
|
* Gets the number of channels in this channels pane. |
193 |
|
|
* @return The number of channels in this channels pane. |
194 |
|
|
*/ |
195 |
iliev |
1818 |
@Override |
196 |
iliev |
787 |
public int |
197 |
|
|
getChannelCount() { return listModel.size(); } |
198 |
|
|
|
199 |
|
|
/** |
200 |
|
|
* Determines whether there is at least one selected channel. |
201 |
|
|
* @return <code>true</code> if there is at least one selected channel, |
202 |
|
|
* <code>false</code> otherwise. |
203 |
|
|
*/ |
204 |
iliev |
1818 |
@Override |
205 |
iliev |
787 |
public boolean |
206 |
|
|
hasSelectedChannel() { return !chnList.isSelectionEmpty(); } |
207 |
|
|
|
208 |
|
|
/** |
209 |
|
|
* Gets the number of the selected channels. |
210 |
|
|
* @return The number of the selected channels. |
211 |
|
|
*/ |
212 |
iliev |
1818 |
@Override |
213 |
iliev |
787 |
public int |
214 |
|
|
getSelectedChannelCount() { return chnList.getSelectedIndices().length; } |
215 |
|
|
|
216 |
|
|
/** |
217 |
|
|
* Gets an array with all selected channels. |
218 |
|
|
* The channels are sorted in increasing index order. |
219 |
|
|
* @return The selected channels or an empty array if nothing is selected. |
220 |
|
|
*/ |
221 |
iliev |
1818 |
@Override |
222 |
iliev |
2288 |
public Channel[] |
223 |
iliev |
787 |
getSelectedChannels() { |
224 |
|
|
Component[] cS = chnList.getSelectedComponents(); |
225 |
iliev |
2288 |
Channel[] chns = new Channel[cS.length]; |
226 |
|
|
for(int i = 0; i < cS.length; i++) chns[i] = (Channel)cS[i]; |
227 |
iliev |
787 |
return chns; |
228 |
|
|
} |
229 |
|
|
|
230 |
|
|
/** |
231 |
|
|
* Removes all selected channels in this channels pane. |
232 |
|
|
* Notice that this method does not remove any channels in the back-end. |
233 |
|
|
* It is invoked after the channels are already removed in the back-end. |
234 |
|
|
* @return The number of removed channels. |
235 |
|
|
*/ |
236 |
iliev |
1818 |
@Override |
237 |
iliev |
787 |
public int |
238 |
|
|
removeSelectedChannels() { |
239 |
|
|
int[] l = chnList.getSelectedIndices(); |
240 |
|
|
ComponentListModel model = chnList.getModel(); |
241 |
|
|
|
242 |
|
|
for(;;) { |
243 |
|
|
int i = chnList.getMinSelectionIndex(); |
244 |
|
|
if(i == -1) break; |
245 |
|
|
model.remove(i); |
246 |
|
|
} |
247 |
|
|
|
248 |
iliev |
2200 |
firePropertyChange("channelsRemoved", null, null); |
249 |
|
|
|
250 |
iliev |
787 |
return l.length; |
251 |
|
|
} |
252 |
|
|
|
253 |
|
|
/** Selects all channels. */ |
254 |
iliev |
1818 |
@Override |
255 |
iliev |
787 |
public void |
256 |
iliev |
1818 |
selectAll() { chnList.selectAll(); } |
257 |
iliev |
787 |
|
258 |
|
|
/** Deselects all selected channels. */ |
259 |
iliev |
1818 |
@Override |
260 |
iliev |
787 |
public void |
261 |
iliev |
1818 |
clearSelection() { chnList.clearSelection(); } |
262 |
iliev |
787 |
|
263 |
|
|
/** |
264 |
|
|
* Registers the specified listener for receiving list selection events. |
265 |
|
|
* @param listener The <code>ListSelectionListener</code> to register. |
266 |
|
|
*/ |
267 |
iliev |
1818 |
@Override |
268 |
iliev |
787 |
public void |
269 |
iliev |
2288 |
addListSelectionListener(org.jsampler.event.ListSelectionListener listener) { |
270 |
|
|
listenerList.add(org.jsampler.event.ListSelectionListener.class, listener); |
271 |
iliev |
787 |
} |
272 |
|
|
|
273 |
|
|
/** |
274 |
|
|
* Removes the specified listener. |
275 |
|
|
* @param listener The <code>ListSelectionListener</code> to remove. |
276 |
|
|
*/ |
277 |
iliev |
1818 |
@Override |
278 |
iliev |
787 |
public void |
279 |
iliev |
2288 |
removeListSelectionListener(org.jsampler.event.ListSelectionListener listener) { |
280 |
|
|
listenerList.remove(org.jsampler.event.ListSelectionListener.class, listener); |
281 |
iliev |
787 |
} |
282 |
|
|
|
283 |
|
|
/** |
284 |
|
|
* Invoked when the selection has changed. |
285 |
|
|
* This method implements <code>valueChanged</code> |
286 |
|
|
* method of the <code>ListSelectionListener</code> interface. |
287 |
|
|
* @param e A <code>ListSelectionEvent</code> |
288 |
|
|
* instance providing the event information. |
289 |
|
|
*/ |
290 |
iliev |
1818 |
@Override |
291 |
iliev |
787 |
public void |
292 |
|
|
valueChanged(ListSelectionEvent e) { |
293 |
|
|
ListSelectionEvent e2 = null; |
294 |
|
|
Object[] listeners = listenerList.getListenerList(); |
295 |
|
|
|
296 |
|
|
for(int i = listeners.length - 2; i >= 0; i -= 2) { |
297 |
|
|
if(listeners[i] == ListSelectionListener.class) { |
298 |
|
|
if(e2 == null) e2 = new ListSelectionEvent ( |
299 |
|
|
this, |
300 |
|
|
e.getFirstIndex(), |
301 |
|
|
e.getLastIndex(), |
302 |
|
|
e.getValueIsAdjusting() |
303 |
|
|
); |
304 |
|
|
((ListSelectionListener)listeners[i + 1]).valueChanged(e2); |
305 |
|
|
} |
306 |
|
|
} |
307 |
|
|
|
308 |
|
|
} |
309 |
|
|
|
310 |
iliev |
1734 |
/** |
311 |
|
|
* Determines whether the channel list UI should be automatically updated |
312 |
|
|
* when channel is added/removed. The default value is <code>true</code>. |
313 |
|
|
* @see updateChannelListUI |
314 |
|
|
*/ |
315 |
iliev |
1818 |
@Override |
316 |
iliev |
1734 |
public boolean |
317 |
|
|
getAutoUpdate() { return chnList.getAutoUpdate(); } |
318 |
|
|
|
319 |
|
|
/** |
320 |
|
|
* Determines whether the channel list UI should be automatically updated |
321 |
|
|
* when channel is added/removed. |
322 |
|
|
* @see updateChannelListUI |
323 |
|
|
*/ |
324 |
iliev |
1818 |
@Override |
325 |
iliev |
1734 |
public void |
326 |
|
|
setAutoUpdate(boolean b) { chnList.setAutoUpdate(b); } |
327 |
|
|
|
328 |
|
|
/** |
329 |
|
|
* Updates the channel list UI. |
330 |
|
|
* @see setAutoUpdate |
331 |
|
|
*/ |
332 |
iliev |
1818 |
@Override |
333 |
iliev |
1734 |
public void |
334 |
|
|
updateChannelListUI() { chnList.updateList(); } |
335 |
|
|
|
336 |
iliev |
787 |
|
337 |
iliev |
1818 |
@Override |
338 |
iliev |
787 |
public void |
339 |
|
|
moveSelectedChannelsOnTop() { |
340 |
iliev |
2288 |
Channel[] chns = getSelectedChannels(); |
341 |
iliev |
787 |
|
342 |
|
|
if(chns.length == 0) { |
343 |
|
|
CC.getLogger().info("Can't move channel(s) at the beginning"); |
344 |
|
|
return; |
345 |
|
|
} |
346 |
|
|
|
347 |
|
|
for(int i = chns.length - 1; i >= 0; i--) { |
348 |
|
|
listModel.remove(chns[i]); |
349 |
|
|
listModel.insert(chns[i], 0); |
350 |
|
|
} |
351 |
|
|
|
352 |
|
|
chnList.setSelectionInterval(0, chns.length - 1); |
353 |
|
|
chnList.ensureIndexIsVisible(0); |
354 |
iliev |
2200 |
|
355 |
|
|
firePropertyChange("channelsPositionChanged", null, chns); |
356 |
iliev |
787 |
} |
357 |
|
|
|
358 |
iliev |
1818 |
@Override |
359 |
iliev |
787 |
public void |
360 |
|
|
moveSelectedChannelsUp() { |
361 |
iliev |
2288 |
Channel[] chns = getSelectedChannels(); |
362 |
iliev |
787 |
|
363 |
|
|
if(chns.length == 0 || chns[0] == getFirstChannel()) { |
364 |
|
|
CC.getLogger().info("Can't move channel(s) up"); |
365 |
|
|
return; |
366 |
|
|
} |
367 |
|
|
|
368 |
|
|
for(int i = 0; i < chns.length; i++) listModel.moveUp(chns[i]); |
369 |
|
|
|
370 |
|
|
int[] si = chnList.getSelectedIndices(); |
371 |
|
|
|
372 |
|
|
for(int i = 0; i < si.length; i++) si[i] -= 1; |
373 |
|
|
|
374 |
|
|
chnList.setSelectedIndices(si); |
375 |
|
|
chnList.ensureIndexIsVisible(si[0]); |
376 |
iliev |
2200 |
|
377 |
|
|
firePropertyChange("channelsPositionChanged", null, chns); |
378 |
iliev |
787 |
} |
379 |
|
|
|
380 |
iliev |
1818 |
@Override |
381 |
iliev |
787 |
public void |
382 |
|
|
moveSelectedChannelsDown() { |
383 |
iliev |
2288 |
Channel[] chns = getSelectedChannels(); |
384 |
iliev |
787 |
|
385 |
|
|
if(chns.length == 0 || chns[chns.length - 1] == getLastChannel()) { |
386 |
|
|
CC.getLogger().info("Can't move channel(s) down"); |
387 |
|
|
return; |
388 |
|
|
} |
389 |
|
|
|
390 |
|
|
for(int i = chns.length - 1; i >= 0; i--) listModel.moveDown(chns[i]); |
391 |
|
|
|
392 |
|
|
int[] si = chnList.getSelectedIndices(); |
393 |
|
|
for(int i = 0; i < si.length; i++) si[i] += 1; |
394 |
|
|
chnList.setSelectedIndices(si); |
395 |
|
|
chnList.ensureIndexIsVisible(si[si.length - 1]); |
396 |
iliev |
2200 |
|
397 |
|
|
firePropertyChange("channelsPositionChanged", null, chns); |
398 |
iliev |
787 |
} |
399 |
|
|
|
400 |
iliev |
1818 |
@Override |
401 |
iliev |
787 |
public void |
402 |
|
|
moveSelectedChannelsAtBottom() { |
403 |
iliev |
2288 |
Channel[] chns = getSelectedChannels(); |
404 |
iliev |
787 |
|
405 |
|
|
if(chns.length == 0) { |
406 |
|
|
CC.getLogger().info("Can't move channel(s) at the end"); |
407 |
|
|
return; |
408 |
|
|
} |
409 |
|
|
|
410 |
|
|
for(int i = 0; i < chns.length; i++) { |
411 |
|
|
listModel.remove(chns[i]); |
412 |
|
|
listModel.add(chns[i]); |
413 |
|
|
} |
414 |
|
|
|
415 |
|
|
chnList.setSelectionInterval ( |
416 |
|
|
listModel.getSize() - chns.length, listModel.getSize() - 1 |
417 |
|
|
); |
418 |
|
|
chnList.ensureIndexIsVisible(listModel.getSize() - 1); |
419 |
iliev |
2200 |
|
420 |
|
|
firePropertyChange("channelsPositionChanged", null, chns); |
421 |
iliev |
787 |
} |
422 |
|
|
|
423 |
iliev |
1318 |
private void |
424 |
|
|
scrollToBottom() { |
425 |
|
|
int h = scrollPane.getViewport().getView().getHeight(); |
426 |
|
|
scrollPane.getViewport().scrollRectToVisible(new Rectangle(0, h - 2, 1, 1)); |
427 |
|
|
} |
428 |
|
|
|
429 |
iliev |
787 |
class ContextMenu extends MouseAdapter { |
430 |
|
|
private final JPopupMenu cmenu = new JPopupMenu(); |
431 |
|
|
private final JMenu submenu = new JMenu(i18n.getMenuLabel("channels.MoveToTab")); |
432 |
|
|
|
433 |
|
|
ContextMenu() { |
434 |
iliev |
1818 |
JMenuItem mi = new JMenuItem(a4n.moveChannelsOnTop); |
435 |
iliev |
787 |
mi.setIcon(null); |
436 |
|
|
cmenu.add(mi); |
437 |
|
|
|
438 |
iliev |
1818 |
mi = new JMenuItem(a4n.moveChannelsUp); |
439 |
iliev |
787 |
mi.setIcon(null); |
440 |
|
|
cmenu.add(mi); |
441 |
|
|
|
442 |
iliev |
1818 |
mi = new JMenuItem(a4n.moveChannelsDown); |
443 |
iliev |
787 |
mi.setIcon(null); |
444 |
|
|
cmenu.add(mi); |
445 |
|
|
|
446 |
iliev |
1818 |
mi = new JMenuItem(a4n.moveChannelsAtBottom); |
447 |
iliev |
787 |
mi.setIcon(null); |
448 |
|
|
cmenu.add(mi); |
449 |
|
|
|
450 |
|
|
cmenu.add(submenu); |
451 |
|
|
|
452 |
|
|
cmenu.addSeparator(); |
453 |
|
|
|
454 |
iliev |
1818 |
mi = new JMenuItem(a4n.removeChannels); |
455 |
iliev |
787 |
mi.setIcon(null); |
456 |
|
|
cmenu.add(mi); |
457 |
|
|
} |
458 |
|
|
|
459 |
iliev |
1818 |
@Override |
460 |
iliev |
787 |
public void |
461 |
|
|
mousePressed(MouseEvent e) { |
462 |
|
|
if(e.isPopupTrigger()) show(e); |
463 |
|
|
} |
464 |
|
|
|
465 |
iliev |
1818 |
@Override |
466 |
iliev |
787 |
public void |
467 |
|
|
mouseReleased(MouseEvent e) { |
468 |
|
|
if(e.isPopupTrigger()) show(e); |
469 |
|
|
} |
470 |
|
|
|
471 |
|
|
void |
472 |
|
|
show(MouseEvent e) { |
473 |
|
|
/*int idx = chnList.locationToIndex(e.getPoint()); |
474 |
|
|
if(!chnList.isSelectedIndex(idx)) chnList.setSelectedIndex(idx); |
475 |
|
|
|
476 |
|
|
if(idx != -1 && CC.getMainFrame().getChannelsPaneCount() > 1) { |
477 |
|
|
updateMenu(); |
478 |
|
|
submenu.setEnabled(true); |
479 |
|
|
} else submenu.setEnabled(false); |
480 |
|
|
|
481 |
|
|
cmenu.show(e.getComponent(), e.getX(), e.getY());*/ |
482 |
|
|
} |
483 |
|
|
|
484 |
|
|
private void |
485 |
|
|
updateMenu() { |
486 |
|
|
submenu.removeAll(); |
487 |
iliev |
2288 |
Vector<SwingChannelsPane> v = SHF.getMainFrame().getChannelsPaneList(); |
488 |
|
|
for(SwingChannelsPane p : v) |
489 |
iliev |
787 |
if(p != CC.getMainFrame().getSelectedChannelsPane()) |
490 |
|
|
submenu.add(new JMenuItem(new A4n.MoveChannelsTo(p))); |
491 |
|
|
} |
492 |
|
|
} |
493 |
iliev |
1818 |
|
494 |
iliev |
2200 |
@Override |
495 |
iliev |
1818 |
public void |
496 |
iliev |
2288 |
processChannelSelection(Channel c, boolean controlDown, boolean shiftDown) { |
497 |
iliev |
1818 |
|
498 |
|
|
} |
499 |
iliev |
787 |
} |