Search in sources :

Example 21 with Element

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

the class AutomatableBSBObject method initBasicFromXML.

public static void initBasicFromXML(Element data, BSBObject bsbObj) {
    BSBObject.initBasicFromXML(data, bsbObj);
    Element elem = data.getElement("automationAllowed");
    AutomatableBSBObject automatableBsbObj = ((AutomatableBSBObject) bsbObj);
    if (elem != null) {
        automatableBsbObj.automationAllowed = Boolean.valueOf(elem.getTextString()).booleanValue();
    } else {
        automatableBsbObj.automationAllowed = false;
    }
}
Also used : Element(electric.xml.Element)

Example 22 with Element

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

the class BSBDropdown method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = getBasicXML(this);
    retVal.setAttribute("version", "2");
    retVal.addElement("selectedIndex").setText(Integer.toString(this.getSelectedIndex()));
    retVal.addElement("fontSize").setText(Integer.toString(getFontSize()));
    retVal.addElement(XMLUtilities.writeBoolean("randomizable", isRandomizable()));
    Element items = retVal.addElement("bsbDropdownItemList");
    for (BSBDropdownItem item : dropdownItems) {
        items.addElement(item.saveAsXML());
    }
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 23 with Element

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

the class BSBDropdownItem method loadFromXML.

public static BSBDropdownItem loadFromXML(Element data) {
    BSBDropdownItem item = new BSBDropdownItem();
    String uniqueId = data.getAttributeValue("uniqueId");
    if (uniqueId != null && uniqueId.length() > 0) {
        item.uniqueId = uniqueId;
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element elem = nodes.next();
        String name = elem.getName();
        switch(name) {
            case "name":
                item.setName(elem.getTextString());
                break;
            case "value":
                item.setValue(elem.getTextString());
                break;
        }
    }
    return item;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 24 with Element

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

the class BSBValue method saveAsXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.orchestra.blueSynthBuilder.BlueSynthBuilderObject#saveAsXML()
     */
@Override
public Element saveAsXML() {
    Element retVal = getBasicXML(this);
    retVal.addElement("minimum").setText(Double.toString(getMinimum()));
    retVal.addElement("maximum").setText(Double.toString(getMaximum()));
    retVal.addElement("defaultValue").setText(Double.toString(getDefaultValue()));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 25 with Element

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

the class BSBValue method loadFromXML.

public static BSBObject loadFromXML(Element data) {
    BSBValue value = new BSBValue();
    double minVal = 0.0;
    double maxVal = 1.0;
    double val = 0.0;
    initBasicFromXML(data, value);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        final String nodeText = node.getTextString();
        switch(nodeName) {
            case "minimum":
                minVal = Double.parseDouble(nodeText);
                break;
            case "maximum":
                maxVal = Double.parseDouble(nodeText);
                break;
            case "defaultValue":
                val = Double.parseDouble(nodeText);
                break;
        }
    }
    value.setDefaultValueProperty(new ClampedValue(minVal, maxVal, val, new BigDecimal(-1.0)));
    return value;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements) BigDecimal(java.math.BigDecimal)

Aggregations

Element (electric.xml.Element)310 Elements (electric.xml.Elements)120 Document (electric.xml.Document)22 Vector (java.util.Vector)14 Iterator (java.util.Iterator)12 File (java.io.File)10 BigDecimal (java.math.BigDecimal)10 IOException (java.io.IOException)8 SoundObject (blue.soundObject.SoundObject)7 ParseException (electric.xml.ParseException)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 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 Test (org.junit.Test)3 ParameterList (blue.automation.ParameterList)2 LiveObject (blue.blueLive.LiveObject)2 LiveObjectBins (blue.blueLive.LiveObjectBins)2 Line (blue.components.lines.Line)2