Search in sources :

Example 41 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class External method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    External external = new External();
    SoundObjectUtilities.initBasicFromXML(data, external);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "text":
                external.setText(node.getTextString());
                break;
            case "commandLine":
                external.setCommandLine(node.getTextString());
                break;
            case "syntaxType":
                external.setSyntaxType(node.getTextString());
                break;
        }
    }
    return external;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 42 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class ObjectBuilder method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    ObjectBuilder bsb = new ObjectBuilder();
    SoundObjectUtilities.initBasicFromXML(data, bsb);
    String editEnabledStr = data.getAttributeValue("editEnabled");
    if (editEnabledStr != null) {
        bsb.setEditEnabled(Boolean.valueOf(editEnabledStr).booleanValue());
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "code":
                bsb.setCode(node.getTextString());
                break;
            case "commandLine":
                bsb.setCommandLine(node.getTextString());
                break;
            case "isExternal":
                // For Blue version < 2.7.2
                if (XMLUtilities.readBoolean(node)) {
                    bsb.setLanguageType(LanguageType.EXTERNAL);
                } else {
                    bsb.setLanguageType(LanguageType.PYTHON);
                }
                ;
                break;
            case "graphicInterface":
                bsb.setGraphicInterface(BSBGraphicInterface.loadFromXML(node));
                break;
            case "presetGroup":
                bsb.setPresetGroup(PresetGroup.loadFromXML(node));
                break;
            case "comment":
                bsb.setComment(node.getTextString());
                break;
            case "languageType":
                bsb.setLanguageType(LanguageType.valueOf(node.getTextString()));
                break;
        }
    }
    return bsb;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 43 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class Sound method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    Sound sObj = new Sound();
    SoundObjectUtilities.initBasicFromXML(data, sObj);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            // For backwards compatibility with Blue versions < 2.6.0
            case "instrumentText":
                sObj.bsbObj.setInstrumentText(node.getTextString());
                break;
            case "instrument":
                sObj.setBlueSynthBuilder((BlueSynthBuilder) BlueSynthBuilder.loadFromXML(node));
                break;
            case "comment":
                sObj.setComment(node.getTextString());
                break;
        }
    }
    return sObj;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 44 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class ScriptCategory method loadFromXML.

public static ScriptCategory loadFromXML(Element data) throws Exception {
    ScriptCategory scriptCat = new ScriptCategory();
    scriptCat.setCategoryName(data.getAttributeValue("categoryName"));
    scriptCat.setRoot(Boolean.valueOf(data.getAttributeValue("isRoot")).booleanValue());
    Elements subCatNodes = data.getElements("scriptCategory");
    while (subCatNodes.hasMoreElements()) {
        scriptCat.addScriptCategory(ScriptCategory.loadFromXML(subCatNodes.next()));
    }
    Elements scripts = data.getElements("script");
    while (scripts.hasMoreElements()) {
        scriptCat.addScript(Script.loadFromXML(scripts.next()));
    }
    return scriptCat;
}
Also used : Elements(electric.xml.Elements)

Example 45 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class PresetGroup method loadFromXML.

public static PresetGroup loadFromXML(Element data) {
    PresetGroup group = new PresetGroup();
    group.setPresetGroupName(data.getAttributeValue("name"));
    String val = data.getAttributeValue("currentPresetUniqueId");
    if (val != null && val.length() > 0) {
        group.setCurrentPresetUniqueId(val);
    }
    val = data.getAttributeValue("currentPresetModified");
    if (val != null && val.length() > 0) {
        group.setCurrentPresetModified(Boolean.valueOf(val).booleanValue());
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "presetGroup":
                PresetGroup pGroup = PresetGroup.loadFromXML(node);
                group.getSubGroups().add(pGroup);
                break;
            case "preset":
                Preset preset = Preset.loadFromXML(node);
                group.getPresets().add(preset);
                break;
        }
    }
    return group;
}
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