Search in sources :

Example 36 with Element

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

the class BSBSubChannelDropdown method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = getBasicXML(this);
    retVal.addElement("channelOutput").setText(getChannelOutput());
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 37 with Element

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

the class BSBSubChannelDropdown method loadFromXML.

public static BSBObject loadFromXML(Element data) {
    BSBSubChannelDropdown dropDown = new BSBSubChannelDropdown();
    initBasicFromXML(data, dropDown);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element elem = nodes.next();
        String name = elem.getName();
        if (name.equals("channelOutput")) {
            dropDown.setChannelOutput(elem.getTextString());
        }
    }
    return dropDown;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 38 with Element

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

the class BSBTextField method loadFromXML.

public static BSBObject loadFromXML(Element data) {
    BSBTextField bsbText = new BSBTextField();
    initBasicFromXML(data, bsbText);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "value":
                bsbText.setValue(node.getTextString());
                if (bsbText.getValue() == null) {
                    bsbText.setValue("");
                }
                break;
            case "textFieldWidth":
                bsbText.setTextFieldWidth(Integer.parseInt(node.getTextString()));
                break;
        }
    }
    return bsbText;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 39 with Element

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

the class BSBVSlider method loadFromXML.

public static BSBObject loadFromXML(Element data) {
    BSBVSlider slider = new BSBVSlider();
    double minVal = 0.0;
    double maxVal = 1.0;
    double val = 0.0;
    BigDecimal res = new BigDecimal("0.1");
    initBasicFromXML(data, slider);
    String verString = data.getAttributeValue("version");
    int version = (verString == null) ? 1 : Integer.parseInt(verString);
    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 = parseNum(nodeText, version);
                break;
            case "maximum":
                maxVal = parseNum(nodeText, version);
                break;
            case "resolution":
                res = new BigDecimal(Double.parseDouble(nodeText)).setScale(5, RoundingMode.HALF_UP).stripTrailingZeros();
                break;
            case "bdresolution":
                res = new BigDecimal(nodeText);
                break;
            case "value":
                val = Double.parseDouble(nodeText);
                break;
            case "sliderHeight":
                slider.setSliderHeight(Integer.parseInt(node.getTextString()));
                break;
            case "randomizable":
                slider.setRandomizable(XMLUtilities.readBoolean(node));
                break;
            case "valueDisplayEnabled":
                slider.setValueDisplayEnabled(XMLUtilities.readBoolean(node));
                break;
        }
    }
    slider.setValueProperty(new ClampedValue(minVal, maxVal, val, res));
    return slider;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements) BigDecimal(java.math.BigDecimal)

Example 40 with Element

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

the class BSBVSlider method saveAsXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.orchestra.blueSynthBuilder.BlueSynthBuilderObject#saveAsXML()
     */
@Override
public Element saveAsXML() {
    Element retVal = getBasicXML(this);
    retVal.setAttribute("version", "2");
    retVal.addElement("minimum").setText(Double.toString(getMinimum()));
    retVal.addElement("maximum").setText(Double.toString(getMaximum()));
    retVal.addElement("bdresolution").setText(getResolution().toString());
    retVal.addElement("value").setText(Double.toString(getValue()));
    retVal.addElement("sliderHeight").setText(Integer.toString(getSliderHeight()));
    retVal.addElement(XMLUtilities.writeBoolean("randomizable", isRandomizable()));
    retVal.addElement(XMLUtilities.writeBoolean("valueDisplayEnabled", isValueDisplayEnabled()));
    return retVal;
}
Also used : Element(electric.xml.Element)

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