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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1734 - (show annotations) (download)
Sun May 4 18:40:13 2008 UTC (15 years, 11 months ago) by iliev
File size: 5625 byte(s)
* bugfix: JSampler took forever to load a configuration with
  too many sampler channels
* Implemented option to show different channel view when
  the mouse pointer is over sampler channel
  (choose Edit/Preferences, then click the `Defaults' tab)

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

  ViewVC Help
Powered by ViewVC