use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetsManagerDialog method editPresetGroup.
public PresetGroup editPresetGroup(PresetGroup presetGroup) {
PresetGroup groupCopy = new PresetGroup(presetGroup);
setPresetGroup(groupCopy);
this.setVisible(true);
PresetGroup returnValue = retVal;
retVal = null;
return returnValue;
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetsTreeDropTarget method drop.
@Override
public void drop(DropTargetDropEvent dtde) {
Point pt = dtde.getLocation();
DropTargetContext dtc = dtde.getDropTargetContext();
JTree tree = (JTree) dtc.getComponent();
TreePath parentpath = tree.getClosestPathForLocation(pt.x, pt.y);
Object node = parentpath.getLastPathComponent();
if (!(node instanceof PresetGroup)) {
dtde.rejectDrop();
return;
}
try {
Transferable tr = dtde.getTransferable();
DataFlavor[] flavors = tr.getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (tr.isDataFlavorSupported(flavors[i])) {
dtde.acceptDrop(dtde.getDropAction());
Object transferNode = tr.getTransferData(flavors[i]);
PresetsTreeModel presetsTreeModel = (PresetsTreeModel) tree.getModel();
PresetGroup parentNode = (PresetGroup) node;
if (transferNode instanceof Preset) {
Preset preset = (Preset) transferNode;
// presetsTreeModel.removePreset(preset);
presetsTreeModel.addPreset(parentNode, preset);
dtde.dropComplete(true);
} else if (transferNode instanceof PresetGroup) {
PresetGroup presetGroup = (PresetGroup) transferNode;
// presetsTreeModel.removePresetGroup(presetGroup);
presetsTreeModel.addPresetGroup(parentNode, presetGroup);
dtde.dropComplete(true);
} else {
dtde.rejectDrop();
}
return;
}
}
dtde.rejectDrop();
} catch (UnsupportedFlavorException | IOException e) {
e.printStackTrace();
}
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetsTreeModel method getIndexOfChild.
/*
* (non-Javadoc)
*
* @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object,
* java.lang.Object)
*/
@Override
public int getIndexOfChild(Object parent, Object child) {
PresetGroup presetGroup = (PresetGroup) parent;
if (presetGroup == null || child == null) {
return -1;
}
int retVal = presetGroup.getSubGroups().indexOf(child);
if (retVal >= 0) {
return retVal;
}
retVal = presetGroup.getPresets().indexOf(child);
if (retVal >= 0) {
return retVal + presetGroup.getSubGroups().size();
}
return -1;
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetsUtilities method synchronizePresets.
public static void synchronizePresets(PresetGroup presetGroup, BSBGraphicInterface gInterface) {
if (presetGroup == null || gInterface == null) {
System.err.println("Null error in PresetsUtilities");
return;
}
ArrayList<PresetGroup> subGroups = presetGroup.getSubGroups();
for (int i = 0; i < subGroups.size(); i++) {
synchronizePresets(subGroups.get(i), gInterface);
}
ArrayList<Preset> presets = presetGroup.getPresets();
for (int i = 0; i < presets.size(); i++) {
Preset preset = presets.get(i);
preset.synchronizeWithInterface(gInterface);
}
}
Aggregations