use of blue.orchestra.InstrumentCategory in project blue by kunstmusik.
the class InstrumentLibrary method importInstrument.
public void importInstrument(Instrument instr) {
List categories = rootInstrumentCategory.getSubCategories();
for (Iterator iter = categories.iterator(); iter.hasNext(); ) {
InstrumentCategory cat = (InstrumentCategory) iter.next();
if (cat.getCategoryName().equals("Imported Instruments")) {
addInstrument(cat, instr);
return;
}
}
InstrumentCategory cat = new InstrumentCategory();
cat.setCategoryName("Imported Instruments");
cat.addInstrument(instr);
addCategory(rootInstrumentCategory, cat);
}
use of blue.orchestra.InstrumentCategory in project blue by kunstmusik.
the class UserInstrumentTreePopup method copyNode.
protected void copyNode() {
if (userObj == instrGUI.iLibrary.getRoot()) {
return;
}
Object bufferedObj;
if (userObj instanceof Instrument) {
bufferedObj = ((Instrument) userObj).deepCopy();
} else {
bufferedObj = new InstrumentCategory((InstrumentCategory) userObj);
}
CopyBuffer.setBufferedObject(CopyBuffer.INSTRUMENT, userObj);
}
use of blue.orchestra.InstrumentCategory in project blue by kunstmusik.
the class InstrumentTreeDropTarget method dragEnter.
@Override
public void dragEnter(DropTargetDragEvent dtde) {
if (!dtde.isDataFlavorSupported(TransferableInstrument.INSTR_FLAVOR) && !dtde.isDataFlavorSupported(TransferableInstrument.INSTR_CAT_FLAVOR)) {
dtde.rejectDrag();
return;
}
Point p = dtde.getLocation();
DropTargetContext dtc = dtde.getDropTargetContext();
JTree tree = (JTree) dtc.getComponent();
TreePath path = tree.getClosestPathForLocation(p.x, p.y);
if (path.getLastPathComponent() instanceof InstrumentCategory) {
dtde.acceptDrag(dtde.getDropAction());
} else if (dtde.isDataFlavorSupported(TransferableInstrument.INSTR_FLAVOR)) {
dtde.acceptDrag(dtde.getDropAction());
} else {
dtde.rejectDrag();
}
}
use of blue.orchestra.InstrumentCategory in project blue by kunstmusik.
the class InstrumentTreeDragSource method dragGestureRecognized.
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
TreePath path = sourceTree.getSelectionPath();
if ((path == null) || (path.getPathCount() <= 1)) {
// We can't really move the root node (or an empty selection).
return;
}
if (path.getLastPathComponent() instanceof Instrument || path.getLastPathComponent() instanceof InstrumentCategory) {
oldNode = path.getLastPathComponent();
Object cloneNode = null;
if (oldNode instanceof Instrument) {
cloneNode = ((Instrument) oldNode).deepCopy();
} else if (oldNode instanceof InstrumentCategory) {
cloneNode = new InstrumentCategory((InstrumentCategory) oldNode);
}
transferable = new TransferableInstrument(cloneNode);
source.startDrag(dge, null, transferable, this);
DragManager.setDragSource(sourceTree);
}
}
use of blue.orchestra.InstrumentCategory in project blue by kunstmusik.
the class UserInstrumentTreePopup method addInstrument.
private void addInstrument(Instrument instr) {
Instrument newInstrument = (Instrument) instr.deepCopy();
InstrumentCategory currentCategory = (InstrumentCategory) userObj;
instrGUI.iLibrary.addInstrument(currentCategory, newInstrument);
/*
* BlueUndoManager.setUndoManager("orchestra"); BlueUndoManager.addEdit(
* new AddEdit(orchTableModel, clone, new Integer(iNum)));
*/
}
Aggregations