Search in sources :

Example 6 with PresetGroup

use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.

the class PresetsTreeModel method valueForPathChanged.

/*
     * (non-Javadoc)
     * 
     * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
     *      java.lang.Object)
     */
@Override
public void valueForPathChanged(TreePath path, Object newValue) {
    Object obj = path.getLastPathComponent();
    if (obj instanceof PresetGroup) {
        ((PresetGroup) obj).setPresetGroupName(newValue.toString());
    } else if (obj instanceof Preset) {
        ((Preset) obj).setPresetName(newValue.toString());
    }
    TreeModelEvent e = new TreeModelEvent(this, path);
    fireNodesChanged(e);
}
Also used : TreeModelEvent(javax.swing.event.TreeModelEvent) Preset(blue.orchestra.blueSynthBuilder.Preset) PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup)

Example 7 with PresetGroup

use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.

the class PresetsTreeModel method removePreset.

public void removePreset(Preset preset) {
    PresetGroup parent = findParent(rootGroup, preset);
    int index = getIndexOfChild(parent, preset);
    int[] childIndices = new int[1];
    childIndices[0] = index;
    Object[] children = new Object[1];
    children[0] = preset;
    TreeModelEvent e = new TreeModelEvent(this, getPathForObject(preset), childIndices, children);
    rootGroup.removePreset(preset);
    fireNodesRemoved(e);
}
Also used : TreeModelEvent(javax.swing.event.TreeModelEvent) PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup)

Example 8 with PresetGroup

use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.

the class PresetsTreeModel method removePresetGroup.

public void removePresetGroup(PresetGroup presetGroup) {
    PresetGroup parent = findParent(rootGroup, presetGroup);
    int index = getIndexOfChild(parent, presetGroup);
    int[] childIndices = new int[1];
    childIndices[0] = index;
    Object[] children = new Object[1];
    children[0] = presetGroup;
    TreeModelEvent e = new TreeModelEvent(this, getPathForObject(presetGroup), childIndices, children);
    rootGroup.removePresetGroup(presetGroup);
    fireNodesRemoved(e);
}
Also used : TreeModelEvent(javax.swing.event.TreeModelEvent) PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup)

Example 9 with PresetGroup

use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.

the class PresetPane method updateCurrentPresetUI.

protected void updateCurrentPresetUI() {
    if (getPresetGroup() == null) {
        return;
    }
    if (getPresetGroup().getCurrentPresetUniqueId() == null) {
        currentPresetText.setText(" No Preset Selected");
        updateButton.setDisable(true);
        ;
    } else {
        PresetGroup pGroup = getPresetGroup();
        Preset preset = pGroup.findPresetByUniqueId(pGroup.getCurrentPresetUniqueId());
        String presetText = " Current Preset: ";
        if (preset != null) {
            String presetPath = pGroup.getPresetFullPathName(pGroup.getCurrentPresetUniqueId());
            presetText += presetPath;
        }
        currentPresetText.setText(presetText);
        updateButton.setDisable(false);
    }
}
Also used : Preset(blue.orchestra.blueSynthBuilder.Preset) PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup)

Example 10 with PresetGroup

use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.

the class PresetPane method addFolder.

/**
 * @param currentPresetGroup
 */
protected void addFolder(PresetGroup presetGroup) {
    TextInputDialog dlg = new TextInputDialog();
    dlg.setTitle("Enter Folder Name");
    dlg.setHeaderText("Enter Folder Name");
    dlg.setGraphic(null);
    BlueFX.style(dlg.getDialogPane());
    Optional<String> str = dlg.showAndWait();
    if (!str.isPresent() || str.get().length() == 0) {
        return;
    }
    String folderName = str.get();
    if (folderName.length() == 0) {
        return;
    }
    PresetGroup newFolder = new PresetGroup();
    newFolder.setPresetGroupName(folderName);
    presetGroup.getSubGroups().add(newFolder);
    Collections.sort(presetGroup.getSubGroups());
    updatePresetMenu();
}
Also used : PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup) TextInputDialog(javafx.scene.control.TextInputDialog)

Aggregations

PresetGroup (blue.orchestra.blueSynthBuilder.PresetGroup)14 Preset (blue.orchestra.blueSynthBuilder.Preset)6 TreeModelEvent (javax.swing.event.TreeModelEvent)3 TreePath (javax.swing.tree.TreePath)3 BSBGraphicInterface (blue.orchestra.blueSynthBuilder.BSBGraphicInterface)2 Point (java.awt.Point)2 DropTargetContext (java.awt.dnd.DropTargetContext)2 JTree (javax.swing.JTree)2 BlueSynthBuilder (blue.orchestra.BlueSynthBuilder)1 PresetsManagerDialog (blue.orchestra.editor.blueSynthBuilder.PresetsManagerDialog)1 ObjectBuilder (blue.soundObject.ObjectBuilder)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 IOException (java.io.IOException)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ContextMenu (javafx.scene.control.ContextMenu)1 Menu (javafx.scene.control.Menu)1 MenuItem (javafx.scene.control.MenuItem)1 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)1