use of electric.xml.Elements 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.Elements 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.Elements in project blue by kunstmusik.
the class NoteProcessorChainMap method loadFromXML.
public static NoteProcessorChainMap loadFromXML(Element data) throws Exception {
NoteProcessorChainMap map = new NoteProcessorChainMap();
Elements npcNodes = data.getElements("npc");
while (npcNodes.hasMoreElements()) {
Element elem = npcNodes.next();
String name = elem.getAttributeValue("name");
NoteProcessorChain npc = NoteProcessorChain.loadFromXML(elem.getElement("noteProcessorChain"));
map.put(name, npc);
}
return map;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class RandomAddProcessor method loadFromXML.
public static NoteProcessor loadFromXML(Element data) {
RandomAddProcessor rap = new RandomAddProcessor();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "pfield":
rap.setPfield(node.getTextString());
break;
case "min":
rap.setMin(node.getTextString());
break;
case "max":
rap.setMax(node.getTextString());
break;
case "seedUsed":
rap.setSeedUsed(node.getTextString());
break;
case "seed":
rap.setSeed(node.getTextString());
break;
}
}
return rap;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BSBHSliderBank method loadFromXML.
public static BSBObject loadFromXML(Element data) {
BSBHSliderBank sliderBank = new BSBHSliderBank();
double minVal = 0;
double maxVal = 1.0;
BigDecimal resolution = new BigDecimal("0.1");
initBasicFromXML(data, sliderBank);
Elements nodes = data.getElements();
sliderBank.getSliders().clear();
List<BSBHSlider> childSliders = new ArrayList<>();
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 "resolution":
resolution = new BigDecimal(Double.parseDouble(node.getTextString())).setScale(5, RoundingMode.HALF_UP).stripTrailingZeros();
break;
case "bdresolution":
resolution = new BigDecimal(node.getTextString());
break;
case "sliderWidth":
sliderBank.setSliderWidth(Integer.parseInt(node.getTextString()));
break;
case "gap":
sliderBank.setGap(Integer.parseInt(node.getTextString()));
break;
case "randomizable":
sliderBank.setRandomizable(XMLUtilities.readBoolean(node));
break;
case "valueDisplayEnabled":
sliderBank.setValueDisplayEnabled(XMLUtilities.readBoolean(node));
break;
case "bsbObject":
BSBHSlider hSlider = (BSBHSlider) BSBHSlider.loadFromXML(node);
childSliders.add(hSlider);
break;
}
}
sliderBank.setValueProperty(new ClampedValue(minVal, maxVal, 0.0, resolution));
sliderBank.getSliders().addAll(childSliders);
return sliderBank;
}
Aggregations