/** * Selects the specified instrument. If <code>instr</code> is <code>null</code> or is not in the * table the current selection is cleared. * * @param instr The instrument to select. */ public void setSelectedInstrument(OrchestraInstrument instr) { int i = getModel().getOrchestraModel().getInstrumentIndex(instr); if (i < 0) { clearSelection(); return; } setRowSelectionInterval(i, i); }
public void actionPerformed(ActionEvent e) { String key = getValue(Action.NAME).toString(); if (key == CLEAR_SELECTION) { clearSelection(); } else if (key == MOVE_ON_TOP) { OrchestraInstrument instr = getSelectedInstrument(); getModel().getOrchestraModel().moveInstrumentOnTop(instr); setSelectedInstrument(instr); } else if (key == MOVE_UP) { OrchestraInstrument instr = getSelectedInstrument(); getModel().getOrchestraModel().moveInstrumentUp(instr); setSelectedInstrument(instr); } else if (key == MOVE_DOWN) { OrchestraInstrument instr = getSelectedInstrument(); getModel().getOrchestraModel().moveInstrumentDown(instr); setSelectedInstrument(instr); } else if (key == MOVE_AT_BOTTOM) { OrchestraInstrument instr = getSelectedInstrument(); getModel().getOrchestraModel().moveInstrumentAtBottom(instr); setSelectedInstrument(instr); } }