Search in sources :

Example 6 with ParseException

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

the class BlueShareRemoteCaller method getSoundObject.

public static SoundObject getSoundObject(SoundObjectOption iOption) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    v.add(new Integer(iOption.getSoundObjectId()));
    result = (String) xrpc.execute("blueShare.getSoundObject", v);
    SoundObject soundObject = null;
    try {
        Document d = new Document(result);
        soundObject = (SoundObject) ObjectUtilities.loadFromXML(d.getRoot(), new HashMap<>());
    } catch (Exception e) {
    }
    return soundObject;
}
Also used : SoundObject(blue.soundObject.SoundObject) Document(electric.xml.Document) Vector(java.util.Vector) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) ParseException(electric.xml.ParseException)

Example 7 with ParseException

use of electric.xml.ParseException 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 8 with ParseException

use of electric.xml.ParseException 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 9 with ParseException

use of electric.xml.ParseException 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 10 with ParseException

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

the class SoundObjectImportPane method importSoundObject.

private void importSoundObject() {
    SoundObjectOption iOption = iTableModel.getSoundObjectOption(instrumentTable.getSelectedRow());
    if (iOption == null) {
        return;
    }
    try {
        SoundObject soundObject = BlueShareRemoteCaller.getSoundObject(iOption);
        if (soundObject == null) {
            String error = "Error: Could not import this SoundObject.";
            JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
            return;
        }
        // data.getOrchestra().addSoundObject(instrument);
        // instrumentTreeModel.reload();
        Library<SoundObject> instrLib = BlueSystem.getSoundObjectLibrary();
        importSoundObjectToLibrary(instrLib, soundObject);
        String message = BlueSystem.getString("blueShare.importSuccess");
        JOptionPane.showMessageDialog(null, message, BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
    } catch (ParseException pe) {
        String error = BlueSystem.getString("blueShare.selectServer.couldNotReadResponse");
        JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
        return;
    } catch (XmlRpcException xre) {
        String error = "Error: " + xre.getLocalizedMessage();
        JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
        return;
    } catch (IOException ioe) {
        String error = "Error: " + ioe.getLocalizedMessage();
        JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
        return;
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) ParseException(electric.xml.ParseException) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Aggregations

ParseException (electric.xml.ParseException)20 Document (electric.xml.Document)14 IOException (java.io.IOException)14 XmlRpcException (org.apache.xmlrpc.XmlRpcException)9 File (java.io.File)7 Element (electric.xml.Element)5 Vector (java.util.Vector)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 SoundObject (blue.soundObject.SoundObject)3 Elements (electric.xml.Elements)3 MissingResourceException (java.util.MissingResourceException)3 TreeNode (javax.swing.tree.TreeNode)3 Effect (blue.mixer.Effect)2 Instrument (blue.orchestra.Instrument)2 UDOLibrary (blue.udo.UDOLibrary)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 InstrumentLibrary (blue.InstrumentLibrary)1 Library (blue.library.Library)1 EffectsLibrary (blue.ui.core.mixer.EffectsLibrary)1 EnvironmentVars (blue.utility.EnvironmentVars)1