130 |
*/ |
*/ |
131 |
public |
public |
132 |
Channel(SamplerChannelModel model) { |
Channel(SamplerChannelModel model) { |
133 |
|
this(model, null); |
134 |
|
} |
135 |
|
|
136 |
|
/** |
137 |
|
* Creates a new instance of <code>Channel</code> using the specified |
138 |
|
* non-<code>null</code> channel model. |
139 |
|
* @param model The model to be used by this channel. |
140 |
|
* @param listener A listener which is notified when the newly created |
141 |
|
* channel is fully expanded on the screen. |
142 |
|
* @throws IllegalArgumentException If the model is <code>null</code>. |
143 |
|
*/ |
144 |
|
public |
145 |
|
Channel(SamplerChannelModel model, final ActionListener listener) { |
146 |
super(model); |
super(model); |
147 |
|
|
148 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
251 |
|
|
252 |
add(mainPane); |
add(mainPane); |
253 |
|
|
254 |
|
if(listener != null) { |
255 |
|
final String s = JXCollapsiblePane.ANIMATION_STATE_KEY; |
256 |
|
mainPane.addPropertyChangeListener(s, new PropertyChangeListener() { |
257 |
|
public void |
258 |
|
propertyChange(PropertyChangeEvent e) { |
259 |
|
if(e.getNewValue() == "expanded") { |
260 |
|
mainPane.removePropertyChangeListener(s, this); |
261 |
|
listener.actionPerformed(null); |
262 |
|
} |
263 |
|
} |
264 |
|
}); |
265 |
|
} |
266 |
|
|
267 |
mainPane.setAnimated(false); |
mainPane.setAnimated(false); |
268 |
mainPane.setCollapsed(true); |
mainPane.setCollapsed(true); |
269 |
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
275 |
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
276 |
} |
} |
277 |
}); |
}); |
278 |
|
|
279 |
|
if(listener != null) { |
280 |
|
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
281 |
|
public void |
282 |
|
run() { listener.actionPerformed(null); } |
283 |
|
}); |
284 |
|
} |
285 |
} |
} |
286 |
|
|
287 |
private JPanel |
private JPanel |