use of blue.ui.core.mixer.EffectsLibrary in project blue by kunstmusik.
the class EffectsPopup method reinitialize.
private void reinitialize() {
this.removeAll();
effectsMenu.removeAll();
EffectsLibrary library = EffectsLibrary.getInstance();
populateMenu(library.getRootEffectCategory(), effectsMenu);
// this.add(addInsert);
this.add(addNewEffect);
this.add(effectsMenu);
this.addSeparator();
this.add(addSend);
this.addSeparator();
this.add(pushUp);
this.add(pushDown);
this.addSeparator();
this.add(openEditor);
this.add(editEffect);
this.add(enableDisableEffect);
this.addSeparator();
this.add(cutAction);
this.add(copyAction);
this.add(pasteAction);
this.addSeparator();
this.add(importToLibrary);
this.addSeparator();
this.add(removeItem);
this.addSeparator();
this.add(importAction);
this.add(exportAction);
}
use of blue.ui.core.mixer.EffectsLibrary in project blue by kunstmusik.
the class EffectImportPane method importEffect.
private void importEffect() {
EffectOption effectOption = iTableModel.getInstrumentOption(instrumentTable.getSelectedRow());
if (effectOption == null) {
return;
}
try {
Effect effect = BlueShareRemoteCaller.getEffect(effectOption);
if (effect == null) {
String error = BlueSystem.getString("blueShare.effect.importError");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
// data.getOrchestra().addInstrument(instrument);
// instrumentTreeModel.reload();
// InstrumentLibrary instrLib =
// BlueSystem.getUserInstrumentLibrary();
EffectsLibrary library = EffectsLibrary.getInstance();
library.importEffect(effect);
library.save();
String message = BlueSystem.getString("blueShare.effect.importSuccess");
JOptionPane.showMessageDialog(null, message, BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
} catch (ParseException pe) {
String error = BlueSystem.getString("blueShare.selectServer.couldNotReadResponse");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (XmlRpcException xre) {
String error = "Error: " + xre.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (IOException ioe) {
String error = "Error: " + ioe.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
}
use of blue.ui.core.mixer.EffectsLibrary in project blue by kunstmusik.
the class EffectTreeDropTarget 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();
EffectsLibrary eLibrary = EffectsLibrary.getInstance();
if (dtde.isDataFlavorSupported(TransferableEffect.EFFECT_CAT_FLAVOR)) {
if (!(node instanceof EffectCategory)) {
dtde.rejectDrop();
return;
}
if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) {
dtde.acceptDrop(dtde.getDropAction());
Transferable tr = dtde.getTransferable();
try {
Object transferNode = tr.getTransferData(TransferableEffect.EFFECT_CAT_FLAVOR);
EffectCategory effectCategory = (EffectCategory) transferNode;
EffectCategory parentNode = (EffectCategory) node;
eLibrary.addCategory(parentNode, effectCategory);
dtde.dropComplete(true);
} catch (UnsupportedFlavorException | IOException e) {
dtde.dropComplete(false);
}
} else {
dtde.rejectDrop();
}
} else if (dtde.isDataFlavorSupported(TransferableEffect.EFFECT_FLAVOR)) {
dtde.acceptDrop(dtde.getDropAction());
try {
Transferable tr = dtde.getTransferable();
Object transferNode = tr.getTransferData(TransferableEffect.EFFECT_FLAVOR);
Effect effect = (Effect) transferNode;
effect.clearParameters();
// iLibrary.removeInstrument(instrument);
if (node instanceof EffectCategory) {
EffectCategory parentNode = (EffectCategory) node;
eLibrary.addEffect(parentNode, effect);
} else if (node instanceof Effect) {
EffectCategory parentNode = (EffectCategory) parentpath.getPathComponent(parentpath.getPathCount() - 2);
int index = ListUtil.indexOfByRef(parentNode.getEffects(), node);
int closestRow = tree.getClosestRowForLocation(pt.x, pt.y);
Rectangle bounds = tree.getRowBounds(closestRow);
if (pt.y > bounds.y + bounds.height) {
eLibrary.addEffect(parentNode, effect);
} else {
eLibrary.addEffect(parentNode, index, effect);
}
}
dtde.dropComplete(true);
} catch (UnsupportedFlavorException | IOException e) {
dtde.dropComplete(false);
}
} else {
dtde.rejectDrop();
}
}
Aggregations