Search in sources :

Example 91 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 92 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 93 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 94 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements) BigDecimal(java.math.BigDecimal)

Example 95 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Aggregations

Elements (electric.xml.Elements)131 Element (electric.xml.Element)120 Document (electric.xml.Document)12 BigDecimal (java.math.BigDecimal)10 Vector (java.util.Vector)10 File (java.io.File)4 SoundObject (blue.soundObject.SoundObject)3 EffectOption (blue.tools.blueShare.effects.EffectOption)3 InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 SoundObjectOption (blue.tools.blueShare.soundObjects.SoundObjectOption)3 OpcodeList (blue.udo.OpcodeList)3 ParseException (electric.xml.ParseException)3 ArrayList (java.util.ArrayList)3 ParameterList (blue.automation.ParameterList)2 Line (blue.components.lines.Line)2 Color (java.awt.Color)2 IOException (java.io.IOException)2 Font (javafx.scene.text.Font)2 LiveObject (blue.blueLive.LiveObject)1 LiveObjectBins (blue.blueLive.LiveObjectBins)1