use of electric.xml.Elements in project blue by kunstmusik.
the class ClojureProjectData method loadFromXML.
/* SERIALIZATION CODE */
public static ClojureProjectData loadFromXML(Element data) {
ClojureProjectData projData = new ClojureProjectData();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
final Element node = nodes.next();
projData.libraryList.add(ClojureLibraryEntry.loadFromXML(node));
}
return projData;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class LiveObjectBins method loadFromXML.
public static LiveObjectBins loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
LiveObjectBins retVal;
if (data.getAttributeValue("columns") != null) {
int columns = Integer.parseInt(data.getAttributeValue("columns"));
int rows = Integer.parseInt(data.getAttributeValue("rows"));
retVal = new LiveObjectBins(new LiveObject[columns][rows]);
} else {
throw new Exception("LiveObjectBins could not load");
}
Elements nodes = data.getElements();
int column = 0;
while (nodes.hasMoreElements()) {
int row = 0;
Element node = nodes.next();
String name = node.getName();
if (name.equals("bin")) {
Elements lObjNodes = node.getElements();
while (lObjNodes.hasMoreElements()) {
Element lObjNode = lObjNodes.next();
name = lObjNode.getName();
if (name.equals("liveObject")) {
retVal.liveObjectBins[column][row] = LiveObject.loadFromXML(lObjNode, objRefMap);
}
row++;
}
column++;
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class LineList method loadFromXML.
public static LineList loadFromXML(Element data) {
LineList retVal = new LineList();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
retVal.add(Line.loadFromXML(node));
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Parameter method loadFromXML.
public static Parameter loadFromXML(Element data) {
Parameter retVal = new Parameter();
String val = data.getAttributeValue("uniqueId");
if (val != null && val.length() > 0) {
retVal.uniqueId = val;
}
val = data.getAttributeValue("name");
if (val != null && val.length() > 0) {
retVal.name = val;
}
val = data.getAttributeValue("label");
if (val != null && val.length() > 0) {
retVal.label = val;
}
val = data.getAttributeValue("min");
if (val != null && val.length() > 0) {
retVal.min = Double.parseDouble(val);
}
val = data.getAttributeValue("max");
if (val != null && val.length() > 0) {
retVal.max = Double.parseDouble(val);
}
// Blue 2.7.0 - updated to use big decimal, this remains
// to parse older double values from projects
val = data.getAttributeValue("resolution");
if (val != null && val.length() > 0) {
double res = Double.parseDouble(val);
retVal.resolution = new BigDecimal(res).setScale(5, RoundingMode.HALF_UP).stripTrailingZeros();
}
val = data.getAttributeValue("bdresolution");
if (val != null && val.length() > 0) {
retVal.resolution = new BigDecimal(val);
}
val = data.getAttributeValue("automationEnabled");
if (val != null && val.length() > 0) {
retVal.setAutomationEnabled(Boolean.valueOf(val).booleanValue());
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("line")) {
retVal.line = Line.loadFromXML(node);
retVal.line.addTableModelListener(retVal);
}
}
/*
* For checking of older projects where line did not have resolution
* property (0.111.0)
*/
if (retVal.line.getResolution() != retVal.getResolution()) {
retVal.line.setResolution(retVal.getResolution());
}
/*
* Seeting Value property from first line point, introduced in 0.124.0
*/
val = data.getAttributeValue("value");
if (val != null && val.length() > 0) {
retVal.value = Double.parseDouble(val);
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class ClojureLibraryEntry method loadFromXML.
public static ClojureLibraryEntry loadFromXML(Element data) {
ClojureLibraryEntry lib = new ClojureLibraryEntry();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
final Element node = nodes.next();
final String nodeText = node.getTextString();
switch(node.getName()) {
case "coordinates":
lib.setDependencyCoordinates(nodeText);
break;
case "version":
lib.setVersion(nodeText);
break;
}
}
return lib;
}
Aggregations