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

Diff of /jsampler/trunk/src/org/jsampler/view/InstrumentTable.java

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

revision 1539 by iliev, Mon Apr 2 21:18:31 2007 UTC revision 1540 by iliev, Mon Dec 3 23:22:02 2007 UTC
# Line 45  import javax.swing.table.TableCellRender Line 45  import javax.swing.table.TableCellRender
45  import org.jsampler.CC;  import org.jsampler.CC;
46  import org.jsampler.DefaultOrchestraModel;  import org.jsampler.DefaultOrchestraModel;
47  import org.jsampler.HF;  import org.jsampler.HF;
48  import org.jsampler.Instrument;  import org.jsampler.OrchestraInstrument;
49    
50  import org.jsampler.event.OrchestraAdapter;  import org.jsampler.event.OrchestraAdapter;
51  import org.jsampler.event.OrchestraEvent;  import org.jsampler.event.OrchestraEvent;
# Line 153  public class InstrumentTable extends JTa Line 153  public class InstrumentTable extends JTa
153           * Gets the selected instrument.           * Gets the selected instrument.
154           * @return The selected instrument, or <code>null</code> if no instrument is selected.           * @return The selected instrument, or <code>null</code> if no instrument is selected.
155           */           */
156          public Instrument          public OrchestraInstrument
157          getSelectedInstrument() {          getSelectedInstrument() {
158                  int i = getSelectedRow();                  int i = getSelectedRow();
159                  if(i == -1) return null;                  if(i == -1) return null;
# Line 166  public class InstrumentTable extends JTa Line 166  public class InstrumentTable extends JTa
166           * @param instr The instrument to select.           * @param instr The instrument to select.
167           */           */
168          public void          public void
169          setSelectedInstrument(Instrument instr) {          setSelectedInstrument(OrchestraInstrument instr) {
170                  int i = getModel().getOrchestraModel().getInstrumentIndex(instr);                  int i = getModel().getOrchestraModel().getInstrumentIndex(instr);
171                  if(i < 0) {                  if(i < 0) {
172                          clearSelection();                          clearSelection();
# Line 190  public class InstrumentTable extends JTa Line 190  public class InstrumentTable extends JTa
190          /**          /**
191           * Creates new instrument using the specified           * Creates new instrument using the specified
192           * drag & drop string representation of the instrument.           * drag & drop string representation of the instrument.
193             *
194           * @param instr The drag & drop string representation of the instrument.           * @param instr The drag & drop string representation of the instrument.
195           * @see Instrument#getDnDString           * @see OrchestraInstrument#getDnDString
196           */           */
197          public void          public void
198          setInstrument(String instr) {          setInstrument(String instr) {
199                  if(!Instrument.isDnDString(instr)) return;                  if(!OrchestraInstrument.isDnDString(instr)) return;
200                                    
201                  Instrument instrument = new Instrument();                  OrchestraInstrument instrument = new OrchestraInstrument();
202                  try { instrument.setDnDString(instr); }                  try { instrument.setDnDString(instr); }
203                  catch(Exception x) {                  catch(Exception x) {
204                          CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x);                          CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
# Line 255  public class InstrumentTable extends JTa Line 256  public class InstrumentTable extends JTa
256                          if(key == CLEAR_SELECTION) {                          if(key == CLEAR_SELECTION) {
257                                  clearSelection();                                  clearSelection();
258                          } else if(key == MOVE_ON_TOP) {                          } else if(key == MOVE_ON_TOP) {
259                                  Instrument instr = getSelectedInstrument();                                  OrchestraInstrument instr = getSelectedInstrument();
260                                  getModel().getOrchestraModel().moveInstrumentOnTop(instr);                                  getModel().getOrchestraModel().moveInstrumentOnTop(instr);
261                                  setSelectedInstrument(instr);                                  setSelectedInstrument(instr);
262                          } else if(key == MOVE_UP) {                          } else if(key == MOVE_UP) {
263                                  Instrument instr = getSelectedInstrument();                                  OrchestraInstrument instr = getSelectedInstrument();
264                                  getModel().getOrchestraModel().moveInstrumentUp(instr);                                  getModel().getOrchestraModel().moveInstrumentUp(instr);
265                                  setSelectedInstrument(instr);                                  setSelectedInstrument(instr);
266                          } else if(key == MOVE_DOWN) {                          } else if(key == MOVE_DOWN) {
267                                  Instrument instr = getSelectedInstrument();                                  OrchestraInstrument instr = getSelectedInstrument();
268                                  getModel().getOrchestraModel().moveInstrumentDown(instr);                                  getModel().getOrchestraModel().moveInstrumentDown(instr);
269                                  setSelectedInstrument(instr);                                  setSelectedInstrument(instr);
270                          } else if(key == MOVE_AT_BOTTOM) {                          } else if(key == MOVE_AT_BOTTOM) {
271                                  Instrument instr = getSelectedInstrument();                                  OrchestraInstrument instr = getSelectedInstrument();
272                                  getModel().getOrchestraModel().moveInstrumentAtBottom(instr);                                  getModel().getOrchestraModel().moveInstrumentAtBottom(instr);
273                                  setSelectedInstrument(instr);                                  setSelectedInstrument(instr);
274                          }                          }

Legend:
Removed from v.1539  
changed lines
  Added in v.1540

  ViewVC Help
Powered by ViewVC