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