Search in sources :

Example 16 with Document

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

the class WindowSettingManager method load.

private void load() {
    String userDir = BlueSystem.getUserConfigurationDirectory();
    String settingsFile = userDir + File.separator + SETTINGS_FILE_NAME;
    File f = new File(settingsFile);
    if (!f.exists()) {
        return;
    }
    try {
        Document doc = new Document(f);
        Element root = doc.getRoot();
        Elements nodes = root.getElements();
        while (nodes.hasMoreElements()) {
            Element node = nodes.next();
            String key = node.getAttributeValue("windowName");
            settings.put(key, node);
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }
}
Also used : Element(electric.xml.Element) ParseException(electric.xml.ParseException) Document(electric.xml.Document) Elements(electric.xml.Elements) File(java.io.File)

Example 17 with Document

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

the class UDORepositoryBrowser method populateUDOList.

/**
 * @param itemId
 */
protected void populateUDOList(int itemId) {
    if (itemId >= 0) {
        String result = null;
        Vector<Integer> v = new Vector<>();
        v.add(new Integer(itemId));
        try {
            result = (String) xrpc.execute("udo.getUDO", v);
        } catch (XmlRpcException | IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if (result == null) {
            System.err.println("Null Opcode");
            return;
        }
        Document doc = null;
        try {
            doc = new Document(result);
        } catch (ParseException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        if (doc == null) {
            return;
        }
        // System.out.println(doc.toString());
        Element root = doc.getRoot();
        udoDisplayPanel.setUDO(root);
    }
}
Also used : Element(electric.xml.Element) IOException(java.io.IOException) ParseException(electric.xml.ParseException) Document(electric.xml.Document) Vector(java.util.Vector) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 18 with Document

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

the class UDORepositoryBrowser method refreshCategoriesList.

public void refreshCategoriesList() {
    String result = null;
    try {
        result = (String) xrpc.execute("udo.getUDOCategoryTree", new Vector<Object>());
    } catch (XmlRpcException | IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (result == null) {
        return;
    }
    Document doc = null;
    try {
        doc = new Document(result);
    } catch (ParseException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    if (doc == null) {
        return;
    }
    Element root = doc.getRoot();
    DefaultMutableTreeNode rootNode = getCategory(root);
    categories.setModel(new DefaultTreeModel(rootNode));
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Element(electric.xml.Element) IOException(java.io.IOException) ParseException(electric.xml.ParseException) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Document(electric.xml.Document) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 19 with Document

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

the class EffectsUtil method importEffect.

public static Effect importEffect() {
    List<File> retVal = FileChooserManager.getDefault().showOpenDialog(IMPORT_DIALOG, WindowManager.getDefault().getMainWindow());
    Effect effect = null;
    if (!retVal.isEmpty()) {
        File f = retVal.get(0);
        Document doc;
        try {
            doc = new Document(f);
            Element root = doc.getRoot();
            if (root.getName().equals("effect")) {
                effect = Effect.loadFromXML(root);
            } else {
                JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Error: File did not contain Effect", "Error", JOptionPane.ERROR_MESSAGE);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Error: Could not read Effect from file", "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
    return effect;
}
Also used : Element(electric.xml.Element) Document(electric.xml.Document) File(java.io.File) IOException(java.io.IOException)

Example 20 with Document

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

the class BlueShareRemoteCaller method getInstrumentCategoryTree.

public static BlueShareInstrumentCategory[] getInstrumentCategoryTree() throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    Document doc;
    result = (String) xrpc.execute("blueShare.getInstrumentCategoryTree", v);
    doc = new Document(result);
    Element root = doc.getRoot();
    return getSubCategories(root);
}
Also used : Element(electric.xml.Element) Document(electric.xml.Document) Vector(java.util.Vector)

Aggregations

Document (electric.xml.Document)35 Element (electric.xml.Element)22 ParseException (electric.xml.ParseException)17 Vector (java.util.Vector)17 IOException (java.io.IOException)13 Elements (electric.xml.Elements)12 File (java.io.File)12 XmlRpcException (org.apache.xmlrpc.XmlRpcException)6 SoundObject (blue.soundObject.SoundObject)4 EffectOption (blue.tools.blueShare.effects.EffectOption)3 InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 SoundObjectOption (blue.tools.blueShare.soundObjects.SoundObjectOption)3 MissingResourceException (java.util.MissingResourceException)3 BlueData (blue.BlueData)2 UDOLibrary (blue.udo.UDOLibrary)2 FileOutputStream (java.io.FileOutputStream)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 SoundLayer (blue.SoundLayer)1 Library (blue.library.Library)1 Effect (blue.mixer.Effect)1