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

Diff of /jsampler/trunk/src/org/jsampler/DefaultOrchestraListModel.java

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

revision 2287 by iliev, Mon Apr 2 21:18:31 2007 UTC revision 2288 by iliev, Wed Nov 23 21:19:44 2011 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 Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 53  public class DefaultOrchestraListModel i Line 53  public class DefaultOrchestraListModel i
53           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
54           * @param l The <code>OrchestraListListener</code> to register.           * @param l The <code>OrchestraListListener</code> to register.
55           */           */
56            @Override
57          public void          public void
58          addOrchestraListListener(ListListener<OrchestraModel> l) { listeners.add(l); }          addOrchestraListListener(ListListener<OrchestraModel> l) { listeners.add(l); }
59                    
# Line 60  public class DefaultOrchestraListModel i Line 61  public class DefaultOrchestraListModel i
61           * Removes the specified listener.           * Removes the specified listener.
62           * @param l The <code>OrchestraListListener</code> to remove.           * @param l The <code>OrchestraListListener</code> to remove.
63           */           */
64            @Override
65          public void          public void
66          removeOrchestraListListener(ListListener<OrchestraModel> l) { listeners.remove(l); }          removeOrchestraListListener(ListListener<OrchestraModel> l) { listeners.remove(l); }
67                    
# Line 67  public class DefaultOrchestraListModel i Line 69  public class DefaultOrchestraListModel i
69           * Gets the current number of orchestras in the list.           * Gets the current number of orchestras in the list.
70           * @return The current number of orchestras in the list.           * @return The current number of orchestras in the list.
71           */           */
72            @Override
73          public int          public int
74          getOrchestraCount() { return orchestras.size(); }          getOrchestraCount() { return orchestras.size(); }
75                    
# Line 75  public class DefaultOrchestraListModel i Line 78  public class DefaultOrchestraListModel i
78           * @param idx The index of the orchestra to be returned.           * @param idx The index of the orchestra to be returned.
79           * @return The orchestra at the specified position.           * @return The orchestra at the specified position.
80           */           */
81            @Override
82          public OrchestraModel          public OrchestraModel
83          getOrchestra(int idx) { return orchestras.get(idx); }          getOrchestra(int idx) { return orchestras.get(idx); }
84                    
# Line 83  public class DefaultOrchestraListModel i Line 87  public class DefaultOrchestraListModel i
87           * @param orchestra The model of the orchestra to be added.           * @param orchestra The model of the orchestra to be added.
88           * @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>.           * @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>.
89           */           */
90            @Override
91          public void          public void
92          addOrchestra(OrchestraModel orchestra) {          addOrchestra(OrchestraModel orchestra) {
93                  insertOrchestra(orchestra, getOrchestraCount());                  insertOrchestra(orchestra, getOrchestraCount());
# Line 95  public class DefaultOrchestraListModel i Line 100  public class DefaultOrchestraListModel i
100           * @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>.           * @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>.
101           * @throws ArrayIndexOutOfBoundsException If the specified index is invalid.           * @throws ArrayIndexOutOfBoundsException If the specified index is invalid.
102           */           */
103            @Override
104          public void          public void
105          insertOrchestra(OrchestraModel orchestra, int idx) {          insertOrchestra(OrchestraModel orchestra, int idx) {
106                  if(orchestra == null)                  if(orchestra == null)
# Line 108  public class DefaultOrchestraListModel i Line 114  public class DefaultOrchestraListModel i
114           * Removes the specified orchestra from the list.           * Removes the specified orchestra from the list.
115           * @param idx The index of the orchestra to remove.           * @param idx The index of the orchestra to remove.
116           */           */
117            @Override
118          public void          public void
119          removeOrchestra(int idx) {          removeOrchestra(int idx) {
120                  OrchestraModel orchestraModel = orchestras.get(idx);                  OrchestraModel orchestraModel = orchestras.get(idx);
# Line 121  public class DefaultOrchestraListModel i Line 128  public class DefaultOrchestraListModel i
128           * @return <code>true</code> if the specified orchestra was in the list,           * @return <code>true</code> if the specified orchestra was in the list,
129           * <code>false</code> otherwise.           * <code>false</code> otherwise.
130           */           */
131            @Override
132          public boolean          public boolean
133          removeOrchestra(OrchestraModel orchestraModel) {          removeOrchestra(OrchestraModel orchestraModel) {
134                  boolean b = orchestras.removeElement(orchestraModel);                  boolean b = orchestras.removeElement(orchestraModel);
# Line 129  public class DefaultOrchestraListModel i Line 137  public class DefaultOrchestraListModel i
137          }          }
138                    
139          /** Removes all orchestras from the list. */          /** Removes all orchestras from the list. */
140            @Override
141          public void          public void
142          removeAllOrchestras() {          removeAllOrchestras() {
143                  for(int i = 0; i < getOrchestraCount(); i++) removeOrchestra(i);                  for(int i = 0; i < getOrchestraCount(); i++) removeOrchestra(i);
# Line 141  public class DefaultOrchestraListModel i Line 150  public class DefaultOrchestraListModel i
150           * and -1 if <code>orchestra</code> is <code>null</code> or           * and -1 if <code>orchestra</code> is <code>null</code> or
151           * the orchestra list does not contain the specified orchestra.           * the orchestra list does not contain the specified orchestra.
152           */           */
153            @Override
154          public int          public int
155          getOrchestraIndex(OrchestraModel orchestra) {          getOrchestraIndex(OrchestraModel orchestra) {
156                  if(orchestra == null) return -1;                  if(orchestra == null) return -1;
# Line 159  public class DefaultOrchestraListModel i Line 169  public class DefaultOrchestraListModel i
169           * or if the orchestra is already on the top.           * or if the orchestra is already on the top.
170           * @param orchestra The orchestra to move on top.           * @param orchestra The orchestra to move on top.
171           */           */
172            @Override
173          public void          public void
174          moveOrchestraOnTop(OrchestraModel orchestra) {          moveOrchestraOnTop(OrchestraModel orchestra) {
175                  if(orchestra == null) return;                  if(orchestra == null) return;
# Line 177  public class DefaultOrchestraListModel i Line 188  public class DefaultOrchestraListModel i
188           * or if the orchestra is already on the top.           * or if the orchestra is already on the top.
189           * @param orchestra The orchestra to move up.           * @param orchestra The orchestra to move up.
190           */           */
191            @Override
192          public void          public void
193          moveOrchestraUp(OrchestraModel orchestra) {          moveOrchestraUp(OrchestraModel orchestra) {
194                  if(orchestra == null) return;                  if(orchestra == null) return;
# Line 195  public class DefaultOrchestraListModel i Line 207  public class DefaultOrchestraListModel i
207           * or if the orchestra is already at the bottom.           * or if the orchestra is already at the bottom.
208           * @param orchestra The orchestra to move down.           * @param orchestra The orchestra to move down.
209           */           */
210            @Override
211          public void          public void
212          moveOrchestraDown(OrchestraModel orchestra) {          moveOrchestraDown(OrchestraModel orchestra) {
213                  if(orchestra == null) return;                  if(orchestra == null) return;
# Line 212  public class DefaultOrchestraListModel i Line 225  public class DefaultOrchestraListModel i
225           * or if the orchestra is already at the bottom.           * or if the orchestra is already at the bottom.
226           * @param orchestra The orchestra to move at bottom.           * @param orchestra The orchestra to move at bottom.
227           */           */
228            @Override
229          public void          public void
230          moveOrchestraAtBottom(OrchestraModel orchestra) {          moveOrchestraAtBottom(OrchestraModel orchestra) {
231                  if(orchestra == null) return;                  if(orchestra == null) return;
# Line 229  public class DefaultOrchestraListModel i Line 243  public class DefaultOrchestraListModel i
243           * @throws IllegalArgumentException If an error occurs while           * @throws IllegalArgumentException If an error occurs while
244           * reading the content of this orchestra list.           * reading the content of this orchestra list.
245           */           */
246            @Override
247          public void          public void
248          readObject(Node node) {          readObject(Node node) {
249                  if(                  if(
# Line 257  public class DefaultOrchestraListModel i Line 272  public class DefaultOrchestraListModel i
272           * @param node Specifies the node where the content of this orchestra           * @param node Specifies the node where the content of this orchestra
273           * list should be written.           * list should be written.
274           */           */
275            @Override
276          public void          public void
277          writeObject(Document doc, Node node) {          writeObject(Document doc, Node node) {
278                  Element el = doc.createElement("orchestras");                  Element el = doc.createElement("orchestras");

Legend:
Removed from v.2287  
changed lines
  Added in v.2288

  ViewVC Help
Powered by ViewVC