Search in sources :

Example 6 with Elements

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

the class PythonInstrument method loadFromXML.

public static Instrument loadFromXML(Element data) throws Exception {
    PythonInstrument instr = new PythonInstrument();
    InstrumentUtilities.initBasicFromXML(data, instr);
    Elements elements = data.getElements();
    while (elements.hasMoreElements()) {
        Element node = elements.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "globalOrc":
                instr.setGlobalOrc(node.getTextString());
                break;
            case "globalSco":
                instr.setGlobalSco(node.getTextString());
                break;
            case "instrumentText":
                instr.setText(node.getTextString());
                break;
            case "opcodeList":
                instr.opcodeList = OpcodeList.loadFromXML(node);
                break;
        }
    }
    return instr;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 7 with Elements

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

the class BSBCheckBox method loadFromXML.

public static BSBObject loadFromXML(Element data) {
    BSBCheckBox checkBox = new BSBCheckBox();
    initBasicFromXML(data, checkBox);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "label":
                checkBox.setLabel(node.getTextString());
                break;
            case "selected":
                checkBox.setSelected(node.getTextString().equals("true"));
                break;
            case "randomizable":
                checkBox.setRandomizable(XMLUtilities.readBoolean(node));
                break;
        }
    }
    return checkBox;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 8 with Elements

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

the class BSBDropdownItemList method loadFromXML.

public static BSBDropdownItemList loadFromXML(Element data) {
    BSBDropdownItemList list = new BSBDropdownItemList();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element elem = nodes.next();
        String name = elem.getName();
        if (name.equals("bsbDropdownItem")) {
            list.add(BSBDropdownItem.loadFromXML(elem));
        }
    }
    return list;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 9 with Elements

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

the class BSBGraphicInterface method loadFromXML.

public static BSBGraphicInterface loadFromXML(Element data) throws Exception {
    BSBGraphicInterface graphicInterface = new BSBGraphicInterface();
    Elements giNodes = data.getElements();
    String editEnabledStr = data.getAttributeValue("editEnabled");
    if (editEnabledStr != null) {
        graphicInterface.setEditEnabled(Boolean.valueOf(editEnabledStr).booleanValue());
    }
    GridSettings gridSettings = null;
    while (giNodes.hasMoreElements()) {
        Element node = giNodes.next();
        String name = node.getName();
        switch(name) {
            case "bsbObject":
                BSBObject obj = (BSBObject) ObjectUtilities.loadFromXML(node);
                if (obj instanceof BSBGroup) {
                    graphicInterface.setRootGroup((BSBGroup) obj);
                } else {
                    // legacy reading of BSBObjects stored here pre-2.7.0
                    graphicInterface.getRootGroup().addBSBObject(obj);
                }
                break;
            case "gridSettings":
                gridSettings = GridSettings.loadFromXML(node);
                break;
        }
    }
    if (gridSettings == null) {
        // preserve behavior of older projects (before 2.5.8)
        graphicInterface.getGridSettings().setGridStyle(GridStyle.NONE);
        graphicInterface.getGridSettings().setSnapEnabled(false);
    } else {
        graphicInterface.setGridSettings(gridSettings);
    }
    return graphicInterface;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 10 with Elements

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

the class BSBGroup method loadFromXML.

public static BSBGroup loadFromXML(Element data) throws Exception {
    BSBGroup bsbGroup = new BSBGroup();
    initBasicFromXML(data, bsbGroup);
    // left in to work with 2.7.0 dev releases that used attributes for
    // groupName
    String groupName = data.getAttributeValue("groupName");
    if (groupName != null) {
        bsbGroup.setGroupName(groupName);
    }
    Elements elems = data.getElements();
    while (elems.hasMoreElements()) {
        Element node = elems.next();
        String name = node.getName();
        switch(name) {
            case "groupName":
                bsbGroup.setGroupName(node.getTextString());
                break;
            case "backgroundColor":
                bsbGroup.setBackgroundColor(Color.valueOf(node.getTextString()));
                break;
            case "borderColor":
                bsbGroup.setBorderColor(Color.valueOf(node.getTextString()));
                break;
            case "labelTextColor":
                bsbGroup.setLabelTextColor(Color.valueOf(node.getTextString()));
                break;
            case "bsbObject":
                Object obj = ObjectUtilities.loadFromXML(node);
                // FIXME
                bsbGroup.addBSBObject((BSBObject) obj);
                break;
            case "titleEnabled":
                bsbGroup.setTitleEnabled(XMLUtilities.readBoolean(node));
                break;
            case "width":
                bsbGroup.setWidth(Integer.parseInt(node.getTextString()));
                break;
            case "height":
                bsbGroup.setHeight(Integer.parseInt(node.getTextString()));
                break;
        }
    }
    return bsbGroup;
}
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