use of electric.xml.Element in project blue by kunstmusik.
the class BSBSubChannelDropdown method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = getBasicXML(this);
retVal.addElement("channelOutput").setText(getChannelOutput());
return retVal;
}
use of electric.xml.Element 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;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBTextField method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBTextField bsbText = new BSBTextField();
initBasicFromXML(data, bsbText);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "value":
bsbText.setValue(node.getTextString());
if (bsbText.getValue() == null) {
bsbText.setValue("");
}
break;
case "textFieldWidth":
bsbText.setTextFieldWidth(Integer.parseInt(node.getTextString()));
break;
}
}
return bsbText;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBVSlider method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBVSlider slider = new BSBVSlider();
double minVal = 0.0;
double maxVal = 1.0;
double val = 0.0;
BigDecimal res = new BigDecimal("0.1");
initBasicFromXML(data, slider);
String verString = data.getAttributeValue("version");
int version = (verString == null) ? 1 : Integer.parseInt(verString);
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 = parseNum(nodeText, version);
break;
case "maximum":
maxVal = parseNum(nodeText, version);
break;
case "resolution":
res = new BigDecimal(Double.parseDouble(nodeText)).setScale(5, RoundingMode.HALF_UP).stripTrailingZeros();
break;
case "bdresolution":
res = new BigDecimal(nodeText);
break;
case "value":
val = Double.parseDouble(nodeText);
break;
case "sliderHeight":
slider.setSliderHeight(Integer.parseInt(node.getTextString()));
break;
case "randomizable":
slider.setRandomizable(XMLUtilities.readBoolean(node));
break;
case "valueDisplayEnabled":
slider.setValueDisplayEnabled(XMLUtilities.readBoolean(node));
break;
}
}
slider.setValueProperty(new ClampedValue(minVal, maxVal, val, res));
return slider;
}
use of electric.xml.Element in project blue by kunstmusik.
the class BSBVSlider method saveAsXML.
/*
* (non-Javadoc)
*
* @see blue.orchestra.blueSynthBuilder.BlueSynthBuilderObject#saveAsXML()
*/
@Override
public Element saveAsXML() {
Element retVal = getBasicXML(this);
retVal.setAttribute("version", "2");
retVal.addElement("minimum").setText(Double.toString(getMinimum()));
retVal.addElement("maximum").setText(Double.toString(getMaximum()));
retVal.addElement("bdresolution").setText(getResolution().toString());
retVal.addElement("value").setText(Double.toString(getValue()));
retVal.addElement("sliderHeight").setText(Integer.toString(getSliderHeight()));
retVal.addElement(XMLUtilities.writeBoolean("randomizable", isRandomizable()));
retVal.addElement(XMLUtilities.writeBoolean("valueDisplayEnabled", isValueDisplayEnabled()));
return retVal;
}
Aggregations