/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSAddEffectInstancesDlg.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/std/JSAddEffectInstancesDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2192 - (show annotations) (download)
Fri Jun 24 21:34:51 2011 UTC (12 years, 10 months ago) by iliev
File size: 2525 byte(s)
* Initial implementation of Sampler Browser
  (choose Window/Sampler Browser) - another way to view/edit
  the sampler configuration (work in progress - for now only
  support for viewing/editing send effects)

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2011 Grigor Iliev <grigor@grigoriliev.com>
5 *
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 package org.jsampler.view.std;
23
24 import java.awt.BorderLayout;
25 import java.awt.Rectangle;
26
27 import javax.swing.JPanel;
28 import javax.swing.JScrollPane;
29 import javax.swing.event.ListSelectionEvent;
30 import javax.swing.event.ListSelectionListener;
31
32 import org.jsampler.CC;
33 import org.jsampler.view.EffectTable;
34
35 import org.linuxsampler.lscp.Effect;
36
37 import net.sf.juife.OkCancelDialog;
38
39 import static org.jsampler.view.std.StdI18n.i18n;
40
41 /**
42 *
43 * @author Grigor Iliev
44 */
45 public class JSAddEffectInstancesDlg extends OkCancelDialog implements ListSelectionListener {
46 public final EffectTable effectTable;
47 public
48 JSAddEffectInstancesDlg() {
49 super(CC.getMainFrame(), i18n.getLabel("JSAddEffectInstancesDlg.title"));
50 setName("JSAddEffectInstancesDlg");
51
52 JPanel p = new JPanel();
53 p.setLayout(new BorderLayout());
54
55 effectTable = new EffectTable();
56 p.add(new JScrollPane(effectTable));
57 setMainPane(p);
58
59 setSavedSize();
60
61 setResizable(true);
62
63 effectTable.getSelectionModel().addListSelectionListener(this);
64 btnOk.setEnabled(effectTable.getSelectedRowCount() > 0);
65 }
66
67 @Override
68 protected void
69 onOk() {
70 if(!btnOk.isEnabled()) return;
71
72 effectTable.saveColumnWidths();
73 StdUtils.saveWindowBounds(getName(), getBounds());
74
75 setVisible(false);
76 setCancelled(false);
77 }
78
79 @Override
80 protected void
81 onCancel() { setVisible(false); }
82
83 private void
84 setSavedSize() {
85 Rectangle r = StdUtils.getWindowBounds(getName());
86 if(r == null) return;
87
88 setBounds(r);
89 }
90
91 public void
92 valueChanged(ListSelectionEvent e) {
93 btnOk.setEnabled(effectTable.getSelectedRowCount() > 0);
94 }
95
96 public Effect[]
97 getSelectedEffects() { return effectTable.getSelectedEffects(); }
98 }

  ViewVC Help
Powered by ViewVC