use of electric.xml.Elements in project blue by kunstmusik.
the class LiveObjectSetList method loadFromXML.
public static LiveObjectSetList loadFromXML(Element data, LiveObjectBins liveObjectBins) {
LiveObjectSetList retVal = new LiveObjectSetList();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String name = node.getName();
if (name.equals("liveObjectSet")) {
retVal.add(LiveObjectSet.loadFromXML(node, liveObjectBins));
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class LiveObjectSet method loadFromXML.
public static LiveObjectSet loadFromXML(Element data, LiveObjectBins bins) {
LiveObjectSet retVal = new LiveObjectSet();
String val = data.getAttributeValue("name");
if (val != null && val.length() > 0) {
retVal.name = val;
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("liveObjectRef")) {
String uniqueId = node.getTextString();
LiveObject lObj = bins.getLiveObjectByUniqueId(uniqueId);
if (lObj != null) {
retVal.add(lObj);
}
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Line method loadFromXML.
public static Line loadFromXML(Element data) {
Line line = new Line(false, false);
switch(data.getName()) {
case "line":
line.varName = data.getAttributeValue("name");
line.setZak(false);
break;
case "zakline":
line.channel = Integer.parseInt(data.getAttributeValue("channel"));
line.setZak(true);
break;
}
int version = 1;
String versionStr = data.getAttributeValue("version");
if (versionStr != null) {
version = Integer.parseInt(versionStr);
}
line.max = Double.parseDouble(data.getAttributeValue("max"));
line.min = Double.parseDouble(data.getAttributeValue("min"));
if (data.getAttributeValue("resolution") != null) {
line.resolution = new BigDecimal(Double.parseDouble(data.getAttributeValue("resolution"))).setScale(5, RoundingMode.HALF_UP).stripTrailingZeros();
}
if (data.getAttributeValue("bdresolution") != null) {
line.resolution = new BigDecimal(data.getAttributeValue("bdresolution"));
}
String colorStr = data.getAttributeValue("color");
if (colorStr != null && colorStr.length() > 0) {
line.color = new Color(Integer.parseInt(colorStr));
} else {
// some older project files may not have a color associated with
// their Line objects. However, a color IS required in the
// LineCanvas
// implementation, so we makeup a color.
line.color = new Color(128, 128, 128);
}
String rBound = data.getAttributeValue("rightBound");
if (rBound != null && rBound.length() > 0) {
line.rightBound = Boolean.valueOf(rBound).booleanValue();
}
String endLinked = data.getAttributeValue("endPointsLinked");
if (endLinked != null && endLinked.length() > 0) {
line.endPointsLinked = Boolean.valueOf(endLinked).booleanValue();
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
LinePoint lp = LinePoint.loadFromXML(node);
line.addLinePoint(lp);
if (version == 1) {
lp.setLocation(lp.getX(), migrateYValue(lp.getY(), line.max, line.min));
}
}
return line;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Library method loadLibraryItem.
private static <T extends SoundObject> TreeItem<LibraryItem<T>> loadLibraryItem(Element elem, Function<Element, T> loader) {
TreeItem<LibraryItem<T>> item;
if (FOLDER_NAMES.contains(elem.getName())) {
item = new LibraryTreeItem<>(new LibraryItem<>(elem.getAttributeValue("categoryName")));
Elements children = elem.getElements();
while (children.hasMoreElements()) {
item.getChildren().add(loadLibraryItem(children.next(), loader));
}
} else {
item = new LibraryTreeItem<>(new LibraryItem<>(loader.apply(elem)));
}
return item;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class ChannelList method loadFromXML.
public static ChannelList loadFromXML(Element data) throws Exception {
ChannelList channels = new ChannelList();
Elements nodes = data.getElements();
String associationVal = data.getAttributeValue("association");
if (associationVal != null && !"null".equals(associationVal)) {
channels.setAssociation(data.getAttributeValue("association"));
}
String listName = data.getAttributeValue("listName");
if (listName != null && !"null".equals(listName)) {
channels.setListName(listName);
}
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("channel")) {
channels.add(Channel.loadFromXML(node));
}
}
return channels;
}
Aggregations