Search in sources :

Example 6 with UDOCategory

use of blue.udo.UDOCategory in project blue by kunstmusik.

the class UDOTreePopup method removeUDOCategory.

private void removeUDOCategory() {
    UDOCategory category = (UDOCategory) userObj;
    instrGUI.iLibrary.removeCategory(category);
}
Also used : UDOCategory(blue.udo.UDOCategory)

Example 7 with UDOCategory

use of blue.udo.UDOCategory in project blue by kunstmusik.

the class UDOTreePopup method addUDO.

private void addUDO(UserDefinedOpcode udo) {
    UserDefinedOpcode newUDO = new UserDefinedOpcode(udo);
    UDOCategory currentCategory = (UDOCategory) userObj;
    instrGUI.iLibrary.addUDO(currentCategory, newUDO);
/*
         * BlueUndoManager.setUndoManager("orchestra"); BlueUndoManager.addEdit(
         * new AddEdit(orchTableModel, clone, new Integer(iNum)));
         */
}
Also used : UDOCategory(blue.udo.UDOCategory) UserDefinedOpcode(blue.udo.UserDefinedOpcode)

Example 8 with UDOCategory

use of blue.udo.UDOCategory in project blue by kunstmusik.

the class UDOTreeDropTarget method dragEnter.

@Override
public void dragEnter(DropTargetDragEvent dtde) {
    if (!dtde.isDataFlavorSupported(TransferableUDO.UDO_FLAVOR) && !dtde.isDataFlavorSupported(TransferableUDO.UDO_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 UDOCategory) {
        dtde.acceptDrag(dtde.getDropAction());
    } else if (dtde.isDataFlavorSupported(TransferableUDO.UDO_FLAVOR)) {
        dtde.acceptDrag(dtde.getDropAction());
    } else {
        dtde.rejectDrag();
    }
}
Also used : JTree(javax.swing.JTree) UDOCategory(blue.udo.UDOCategory) TreePath(javax.swing.tree.TreePath) DropTargetContext(java.awt.dnd.DropTargetContext) Point(java.awt.Point)

Example 9 with UDOCategory

use of blue.udo.UDOCategory in project blue by kunstmusik.

the class UDOTreeDragSource 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 UserDefinedOpcode || path.getLastPathComponent() instanceof UDOCategory) {
        oldNode = path.getLastPathComponent();
        Object cloneNode;
        if (oldNode instanceof UserDefinedOpcode) {
            cloneNode = new UserDefinedOpcode((UserDefinedOpcode) oldNode);
        } else {
            cloneNode = new UDOCategory((UDOCategory) oldNode);
        }
        transferable = new TransferableUDO(cloneNode);
        source.startDrag(dge, null, transferable, this);
        DragManager.setDragSource(sourceTree);
    }
}
Also used : UDOCategory(blue.udo.UDOCategory) TreePath(javax.swing.tree.TreePath) UserDefinedOpcode(blue.udo.UserDefinedOpcode)

Aggregations

UDOCategory (blue.udo.UDOCategory)9 UserDefinedOpcode (blue.udo.UserDefinedOpcode)6 Point (java.awt.Point)3 TreePath (javax.swing.tree.TreePath)3 DropTargetContext (java.awt.dnd.DropTargetContext)2 JTree (javax.swing.JTree)2 UDOLibrary (blue.udo.UDOLibrary)1 Rectangle (java.awt.Rectangle)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 IOException (java.io.IOException)1