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);
}
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);
}
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);
}
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);
}
}
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();
}
Aggregations