Search in sources :

Example 11 with Element

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

the class BSBCheckBox method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = getBasicXML(this);
    retVal.addElement("label").setText(getLabel());
    retVal.addElement("selected").setText(Boolean.toString(isSelected()));
    retVal.addElement(XMLUtilities.writeBoolean("randomizable", isRandomizable()));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 12 with Element

use of electric.xml.Element 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 13 with Element

use of electric.xml.Element 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 14 with Element

use of electric.xml.Element 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 15 with Element

use of electric.xml.Element 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

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