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

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/ChannelsPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 912 by iliev, Mon Aug 7 18:34:40 2006 UTC revision 1318 by iliev, Sat Sep 1 13:46:04 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005, 2006 Grigor Kirilov Iliev   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 25  package org.jsampler.view.fantasia; Line 25  package org.jsampler.view.fantasia;
25  import java.awt.BorderLayout;  import java.awt.BorderLayout;
26  import java.awt.Component;  import java.awt.Component;
27    
28    import java.awt.event.ActionEvent;
29    import java.awt.event.ActionListener;
30    
31    import javax.swing.BoxLayout;
32  import javax.swing.ListSelectionModel;  import javax.swing.ListSelectionModel;
33    
34  import javax.swing.event.ListSelectionEvent;  import javax.swing.event.ListSelectionEvent;
# Line 46  import org.jsampler.view.JSChannelsPane; Line 50  import org.jsampler.view.JSChannelsPane;
50   * @author Grigor Iliev   * @author Grigor Iliev
51   */   */
52  public class ChannelsPane extends JSChannelsPane {  public class ChannelsPane extends JSChannelsPane {
53          private final ComponentList chnList = new ComponentList();          private final ChannelListPane chnList = new ChannelListPane();
54          private final DefaultComponentListModel listModel = new DefaultComponentListModel();          private final DefaultComponentListModel listModel = new DefaultComponentListModel();
55                            
56            private ActionListener listener;
57                    
58          /**          /**
59           * Creates a new instance of <code>ChannelsPane</code> with           * Creates a new instance of <code>ChannelsPane</code> with
# Line 57  public class ChannelsPane extends JSChan Line 62  public class ChannelsPane extends JSChan
62           */           */
63          public          public
64          ChannelsPane(String title) {          ChannelsPane(String title) {
65                    this(title, null);
66            }
67            
68            /**
69             * Creates a new instance of <code>ChannelsPane</code> with
70             * the specified <code>title</code>.
71             * @param title The title of this <code>ChannelsPane</code>
72             * @param l A listener which is notified when a newly created
73             * channel is fully expanded on the screen.
74             */
75            public
76            ChannelsPane(String title, ActionListener l) {
77                  super(title);                  super(title);
78                                    
79                  setLayout(new BorderLayout());                  listener = l;
80                    
81                    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
82                                    
                 chnList.setOpaque(false);  
83                  chnList.setModel(listModel);                  chnList.setModel(listModel);
84                  chnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);                  chnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
85                                    
86                  add(chnList);                  add(chnList);
87                            }
88                  setOpaque(true);          
89            class ChannelListPane extends ComponentList {
90                    public java.awt.Dimension
91                    getMaximumSize() { return getPreferredSize(); }
92          }          }
93                    
94          /**          /**
# Line 76  public class ChannelsPane extends JSChan Line 97  public class ChannelsPane extends JSChan
97           */           */
98          public void          public void
99          addChannel(SamplerChannelModel channelModel) {          addChannel(SamplerChannelModel channelModel) {
100                  Channel channel = new Channel(channelModel);                  Channel channel = new Channel(channelModel, listener);
101                  listModel.add(channel);                  listModel.add(channel);
102                  if(channel.getChannelInfo().getEngine() == null) channel.expandChannel();                  if(channel.getChannelInfo().getEngine() == null) channel.expandChannel(false);
103                  chnList.setSelectedComponent(channel, true);                  chnList.setSelectedComponent(channel, true);
                   
                 MainFrame.repack(CC.getMainFrame());  
104          }          }
105                    
106          /**          /**
# Line 95  public class ChannelsPane extends JSChan Line 114  public class ChannelsPane extends JSChan
114                  for(JSChannel c : chns) listModel.add(c);                  for(JSChannel c : chns) listModel.add(c);
115                                    
116                  chnList.setSelectedIndex(listModel.getSize() - 1);                  chnList.setSelectedIndex(listModel.getSize() - 1);
                   
                 MainFrame.repack(CC.getMainFrame());  
117          }          }
118                    
119          /**          /**
# Line 107  public class ChannelsPane extends JSChan Line 124  public class ChannelsPane extends JSChan
124          public void          public void
125          removeChannel(JSChannel chn) {          removeChannel(JSChannel chn) {
126                  listModel.remove(chn);                  listModel.remove(chn);
                   
                 MainFrame.repack(CC.getMainFrame());  
127          }          }
128                    
129          /**          /**
# Line 200  public class ChannelsPane extends JSChan Line 215  public class ChannelsPane extends JSChan
215                          model.remove(i);                          model.remove(i);
216                  }                  }
217                                    
                   
                 MainFrame.repack(CC.getMainFrame());  
                   
218                  return l.length;                  return l.length;
219          }          }
220                    

Legend:
Removed from v.912  
changed lines
  Added in v.1318

  ViewVC Help
Powered by ViewVC