use of electric.xml.Element in project blue by kunstmusik.
the class AutomatableBSBObject method initBasicFromXML.
public static void initBasicFromXML(Element data, BSBObject bsbObj) {
BSBObject.initBasicFromXML(data, bsbObj);
Element elem = data.getElement("automationAllowed");
AutomatableBSBObject automatableBsbObj = ((AutomatableBSBObject) bsbObj);
if (elem != null) {
automatableBsbObj.automationAllowed = Boolean.valueOf(elem.getTextString()).booleanValue();
} else {
automatableBsbObj.automationAllowed = false;
}
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBDropdown method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = getBasicXML(this);
retVal.setAttribute("version", "2");
retVal.addElement("selectedIndex").setText(Integer.toString(this.getSelectedIndex()));
retVal.addElement("fontSize").setText(Integer.toString(getFontSize()));
retVal.addElement(XMLUtilities.writeBoolean("randomizable", isRandomizable()));
Element items = retVal.addElement("bsbDropdownItemList");
for (BSBDropdownItem item : dropdownItems) {
items.addElement(item.saveAsXML());
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBDropdownItem method loadFromXML.
public static BSBDropdownItem loadFromXML(Element data) {
BSBDropdownItem item = new BSBDropdownItem();
String uniqueId = data.getAttributeValue("uniqueId");
if (uniqueId != null && uniqueId.length() > 0) {
item.uniqueId = uniqueId;
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element elem = nodes.next();
String name = elem.getName();
switch(name) {
case "name":
item.setName(elem.getTextString());
break;
case "value":
item.setValue(elem.getTextString());
break;
}
}
return item;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBValue method saveAsXML.
/*
* (non-Javadoc)
*
* @see blue.orchestra.blueSynthBuilder.BlueSynthBuilderObject#saveAsXML()
*/
@Override
public Element saveAsXML() {
Element retVal = getBasicXML(this);
retVal.addElement("minimum").setText(Double.toString(getMinimum()));
retVal.addElement("maximum").setText(Double.toString(getMaximum()));
retVal.addElement("defaultValue").setText(Double.toString(getDefaultValue()));
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBValue method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBValue value = new BSBValue();
double minVal = 0.0;
double maxVal = 1.0;
double val = 0.0;
initBasicFromXML(data, value);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
final String nodeText = node.getTextString();
switch(nodeName) {
case "minimum":
minVal = Double.parseDouble(nodeText);
break;
case "maximum":
maxVal = Double.parseDouble(nodeText);
break;
case "defaultValue":
val = Double.parseDouble(nodeText);
break;
}
}
value.setDefaultValueProperty(new ClampedValue(minVal, maxVal, val, new BigDecimal(-1.0)));
return value;
}
Aggregations