use of electric.xml.Elements in project blue by kunstmusik.
the class Preset method loadFromXML.
public static Preset loadFromXML(Element data) {
Preset p = new Preset();
p.setPresetName(data.getAttributeValue("name"));
String uniqueId = data.getAttributeValue("uniqueId");
if (uniqueId != null && uniqueId.length() > 0) {
p.uniqueId = uniqueId;
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
if (node.getName().equals("setting")) {
String name = node.getAttributeValue("name");
String val = node.getTextString();
p.addSetting(name, val);
}
}
return p;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BSBFileSelector method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBFileSelector selector = new BSBFileSelector();
initBasicFromXML(data, selector);
Elements nodes = data.getElements();
// false by default for legacy projects
boolean stringChannelEnabled = false;
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "fileName":
selector.setFileName(node.getTextString());
break;
case "textFieldWidth":
selector.setTextFieldWidth(Integer.parseInt(node.getTextString()));
break;
case "stringChannelEnabled":
stringChannelEnabled = XMLUtilities.readBoolean(node);
break;
}
}
selector.setStringChannelEnabled(stringChannelEnabled);
return selector;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BSBKnob method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBKnob knob = new BSBKnob();
double minVal = 0;
double maxVal = 0;
double value = 0;
initBasicFromXML(data, knob);
// set false by default when loading for backwards compatibility with
// Blue versions < 2.7.2
knob.setLabelEnabled(false);
int version = 1;
String versionStr = data.getAttributeValue("version");
if (versionStr != null) {
version = Integer.parseInt(versionStr);
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "minimum":
minVal = Double.parseDouble(node.getTextString());
break;
case "maximum":
maxVal = Double.parseDouble(node.getTextString());
break;
case "value":
value = Double.parseDouble(node.getTextString());
break;
case "knobWidth":
knob.setKnobWidth(Integer.parseInt(node.getTextString()));
break;
case "randomizable":
knob.setRandomizable(XMLUtilities.readBoolean(node));
break;
case "valueDisplayEnabled":
knob.setValueDisplayEnabled(XMLUtilities.readBoolean(node));
break;
case "label":
knob.setLabel(node.getTextString());
break;
case "labelEnabled":
knob.setLabelEnabled(XMLUtilities.readBoolean(node));
break;
case "font":
knob.setLabelFont(BSBFontUtil.loadFromXML(node));
break;
}
}
// convert from relative to absolute values (0.110.0)
if (version == 1) {
double range = maxVal - minVal;
value = (value * range) + minVal;
}
knob.setKnobValueProperty(new ClampedValue(minVal, maxVal, value, new BigDecimal(-1.0)));
return knob;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BSBLineObject method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBLineObject lineObj = new BSBLineObject();
initBasicFromXML(data, lineObj);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "canvasWidth":
lineObj.setCanvasWidth(XMLUtilities.readInt(node));
break;
case "canvasHeight":
lineObj.setCanvasHeight(XMLUtilities.readInt(node));
break;
case "xMax":
lineObj.setXMax(XMLUtilities.readDouble(node));
break;
case "commaSeparated":
boolean val = XMLUtilities.readBoolean(node);
if (val) {
lineObj.setSeparatorType(SeparatorType.COMMA);
}
break;
case "separatorType":
lineObj.setSeparatorType(SeparatorType.fromString(node.getTextString()));
break;
case "relativeXValues":
lineObj.setRelativeXValues(XMLUtilities.readBoolean(node));
break;
case "lines":
lineObj.setLines(LineList.loadFromXML(node));
break;
case "leadingZero":
lineObj.setLeadingZero(XMLUtilities.readBoolean(node));
break;
case "locked":
lineObj.setLocked(XMLUtilities.readBoolean(node));
break;
}
}
return lineObj;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BSBSubChannelDropdown method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBSubChannelDropdown dropDown = new BSBSubChannelDropdown();
initBasicFromXML(data, dropDown);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element elem = nodes.next();
String name = elem.getName();
if (name.equals("channelOutput")) {
dropDown.setChannelOutput(elem.getTextString());
}
}
return dropDown;
}
Aggregations