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

Annotation of /jsampler/trunk/src/org/jsampler/view/JSChannelsPane.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1818 - (hide annotations) (download)
Wed Dec 24 17:29:47 2008 UTC (15 years, 4 months ago) by iliev
File size: 6829 byte(s)
* Added support for controlling the global sampler-wide limit of
  maximum voices and disk streams
  (choose Edit/Preferences, then click the `General' tab)
* Fantasia: store the view configuration of audio/MIDI devices and sampler
  channels in the LSCP script when exporting sampler configuration
* Fantasia: Implemented multiple sampler channels' selection
* Fantasia: Added option to move sampler channels up and down
  in the channels list
* Fantasia: Added option to move sampler channels
  to another channels panels

1 iliev 787 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1143 * Copyright (C) 2005-2006 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;
24    
25     import javax.swing.JPanel;
26     import javax.swing.event.ListSelectionListener;
27    
28     import org.jsampler.SamplerChannelModel;
29 iliev 1818 import org.jsampler.view.SessionViewConfig.ChannelConfig;
30 iliev 787
31    
32     /**
33 iliev 911 * This class defines the skeleton of a pane containg sampler channels.
34 iliev 787 * @author Grigor Iliev
35     */
36     public abstract class JSChannelsPane extends JPanel {
37 iliev 911 /** The key used for reporting title's property change. */
38 iliev 787 public final static String TITLE = "ChannelsPaneTitle";
39    
40     private String title;
41    
42 iliev 911 /** Creates a new instance of <code>JSChannelsPane</code>. */
43 iliev 787 public
44     JSChannelsPane(String title) { this.title = title; }
45    
46 iliev 911 /**
47     * Returns the title of this <code>JSChannelsPane</code>.
48     * @return The title of this <code>JSChannelsPane</code>.
49     */
50 iliev 787 public String
51     getTitle() { return title; }
52    
53 iliev 911 /**
54     * Sets the title of this <code>JSChannelsPane</code>.
55     * @param title The new title of this <code>JSChannelsPane</code>.
56     */
57 iliev 787 public void
58     setTitle(String title) {
59     if(this.title.equals(title)) return;
60    
61     String oldTitle = this.title;
62     this.title = title;
63     firePropertyChange(TITLE, oldTitle, title);
64     }
65    
66 iliev 911 /**
67     * Returns the title of this <code>JSChannelsPane</code>.
68     * @return The title of this <code>JSChannelsPane</code>.
69     */
70 iliev 1818 @Override
71 iliev 787 public String
72     toString() { return getTitle(); }
73    
74     /**
75     * Adds new channel to this channels pane.
76     * @param channelModel The sampler channel model to be used by the new channel.
77     */
78     public abstract void addChannel(SamplerChannelModel channelModel);
79    
80     /**
81 iliev 1818 * Adds new channel to this channels pane.
82     * @param channelModel The sampler channel model to be used by the new channel.
83     * @param config The view config of the sampler channel.
84     */
85     public void
86     addChannel(SamplerChannelModel channelModel, ChannelConfig config) {
87     addChannel(channelModel);
88     }
89    
90     /**
91 iliev 787 * Adds the specified channels to this channels pane.
92     * @param chns The channels to be added.
93     */
94     public abstract void addChannels(JSChannel[] chns);
95    
96     /**
97     * Removes the specified channel from this channels pane.
98     * This method is invoked when a sampler channel is removed in the back-end.
99     * @param chn The channel to be removed from this channels pane.
100     */
101     public abstract void removeChannel(JSChannel chn);
102    
103     /**
104     * Determines whether there is at least one selected channel.
105     * @return <code>true</code> if there is at least one selected channel,
106     * <code>false</code> otherwise.
107     */
108     public abstract boolean hasSelectedChannel();
109    
110     /**
111     * Gets the first channel in this channels pane.
112     * @return The first channel in this channels pane or <code>null</code> if
113     * the channels pane is empty.
114     */
115     public abstract JSChannel getFirstChannel();
116    
117     /**
118     * Gets the last channel in this channels pane.
119     * @return The last channel in this channels pane or <code>null</code> if
120     * the channels pane is empty.
121     */
122     public abstract JSChannel getLastChannel();
123    
124     /**
125     * Gets the channel at the specified index.
126     * @return The channel at the specified index.
127     * @throws ArrayIndexOutOfBoundsException If the index is out of range.
128     */
129     public abstract JSChannel getChannel(int idx);
130    
131     /**
132     * Gets an array of all channels in this channels pane.
133     * @return An array of all channels in this channels pane.
134     */
135     public abstract JSChannel[] getChannels();
136    
137     /**
138     * Gets the number of channels in this channels pane.
139     * @return The number of channels in this channels pane.
140     */
141     public abstract int getChannelCount();
142    
143     /**
144     * Gets an array of all selected channels.
145     * The channels are sorted in increasing index order.
146     * @return The selected channels or an empty array if nothing is selected.
147     */
148     public abstract JSChannel[] getSelectedChannels();
149    
150     /**
151     * Gets the number of the selected channels.
152     * @return The number of the selected channels.
153     */
154     public abstract int getSelectedChannelCount();
155    
156     /**
157 iliev 1776 * Selects the specified channel.
158     */
159     public abstract void setSelectedChannel(JSChannel channel);
160    
161 iliev 1818 /** Selects all channels. */
162     public abstract void selectAll();
163    
164     /** Deselects all selected channels. */
165     public abstract void clearSelection();
166    
167 iliev 1776 /**
168 iliev 787 * Removes all selected channels in this channels pane.
169     * Notice that this method does not remove any channels in the back-end.
170     * It is invoked after the channels are already removed in the back-end.
171     * @return The number of removed channels.
172     */
173     public abstract int removeSelectedChannels();
174    
175 iliev 1818 public abstract void moveSelectedChannelsOnTop();
176    
177     public abstract void moveSelectedChannelsUp();
178    
179     public abstract void moveSelectedChannelsDown();
180    
181     public abstract void moveSelectedChannelsAtBottom();
182    
183 iliev 911 /**
184     * Registers the specified listener for receiving list selection events.
185     * @param listener The <code>ListSelectionListener</code> to register.
186     */
187 iliev 787 public abstract void addListSelectionListener(ListSelectionListener listener);
188 iliev 911
189     /**
190     * Removes the specified listener.
191     * @param listener The <code>ListSelectionListener</code> to remove.
192     */
193 iliev 787 public abstract void removeListSelectionListener(ListSelectionListener listener);
194 iliev 1734
195     /**
196 iliev 1818 * Process a selection event.
197     * @param c The newly selected channel.
198     * @param controlDown Specifies whether the control key is held down during selection.
199     * @param shiftDown Specifies whether the shift key is held down during selection.
200     */
201     public abstract void processChannelSelection(JSChannel c, boolean controlDown, boolean shiftDown);
202    
203     /**
204 iliev 1734 * Determines whether the channel list UI should be automatically updated
205     * when channel is added/removed. The default value is <code>true</code>.
206     * @see updateChannelListUI
207     */
208     public abstract boolean getAutoUpdate();
209    
210     /**
211     * Determines whether the channel list UI should be automatically updated
212     * when channel is added/removed.
213     * @see updateChannelListUI
214     */
215     public abstract void setAutoUpdate(boolean b);
216    
217     /**
218     * Updates the channel list UI.
219     * @see setAutoUpdate
220     */
221     public abstract void updateChannelListUI();
222 iliev 787 }

  ViewVC Help
Powered by ViewVC