26 |
import java.awt.Dimension; |
import java.awt.Dimension; |
27 |
import java.awt.Frame; |
import java.awt.Frame; |
28 |
|
|
29 |
|
import java.awt.event.ActionEvent; |
30 |
|
import java.awt.event.KeyEvent; |
31 |
import java.awt.event.WindowAdapter; |
import java.awt.event.WindowAdapter; |
32 |
import java.awt.event.WindowEvent; |
import java.awt.event.WindowEvent; |
33 |
|
|
34 |
import java.util.Vector; |
import java.util.Vector; |
35 |
import java.util.logging.Level; |
import java.util.logging.Level; |
36 |
|
|
37 |
|
import javax.swing.AbstractAction; |
38 |
|
import javax.swing.JComponent; |
39 |
import javax.swing.JFrame; |
import javax.swing.JFrame; |
40 |
|
import javax.swing.KeyStroke; |
41 |
|
|
42 |
import org.jsampler.CC; |
import org.jsampler.CC; |
43 |
import org.jsampler.JSampler; |
import org.jsampler.JSampler; |
54 |
*/ |
*/ |
55 |
public abstract class JSMainFrame extends JFrame { |
public abstract class JSMainFrame extends JFrame { |
56 |
private final Vector<JSChannelsPane> chnPaneList = new Vector<JSChannelsPane>(); |
private final Vector<JSChannelsPane> chnPaneList = new Vector<JSChannelsPane>(); |
57 |
|
private boolean autoUpdateChannelListUI = true; |
58 |
|
|
59 |
/** Creates a new instance of <code>JSMainFrame</code>. */ |
/** Creates a new instance of <code>JSMainFrame</code>. */ |
60 |
public |
public |
68 |
}); |
}); |
69 |
|
|
70 |
CC.getSamplerModel().addSamplerChannelListListener(new EventHandler()); |
CC.getSamplerModel().addSamplerChannelListListener(new EventHandler()); |
71 |
|
|
72 |
|
getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put ( |
73 |
|
KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK), |
74 |
|
"RunGarbageCollector" |
75 |
|
); |
76 |
|
|
77 |
|
getRootPane().getActionMap().put ("RunGarbageCollector", new AbstractAction() { |
78 |
|
public void |
79 |
|
actionPerformed(ActionEvent e) { |
80 |
|
System.gc(); |
81 |
|
} |
82 |
|
}); |
83 |
} |
} |
84 |
|
|
85 |
/** |
/** |
260 |
|
|
261 |
return null; |
return null; |
262 |
} |
} |
263 |
|
|
264 |
|
/** |
265 |
|
* Determines whether the channel list UI should be automatically updated |
266 |
|
* when channel is added/removed. The default value is <code>true</code>. |
267 |
|
*/ |
268 |
|
public boolean |
269 |
|
getAutoUpdateChannelListUI() { return autoUpdateChannelListUI; } |
270 |
|
|
271 |
|
/** |
272 |
|
* Determines whether the channel list UI should be automatically updated |
273 |
|
* when channel is added/removed. |
274 |
|
*/ |
275 |
|
public void |
276 |
|
setAutoUpdateChannelListUI(boolean b) { |
277 |
|
if(b == autoUpdateChannelListUI) return; |
278 |
|
|
279 |
|
autoUpdateChannelListUI = b; |
280 |
|
for(JSChannelsPane cp : getChannelsPaneList()) { |
281 |
|
cp.setAutoUpdate(b); |
282 |
|
} |
283 |
|
} |
284 |
|
|
285 |
|
/** |
286 |
|
* Updates the channel list UI. |
287 |
|
*/ |
288 |
|
public void |
289 |
|
updateChannelListUI() { |
290 |
|
for(JSChannelsPane cp : getChannelsPaneList()) { |
291 |
|
cp.updateChannelListUI(); |
292 |
|
} |
293 |
|
} |
294 |
} |
} |