Search in sources :

Example 16 with ParseException

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

the class UDORepositoryBrowser method populateUDOList.

/**
 * @param tempCat
 */
protected void populateUDOList(UDOItem tempCat) {
    if (tempCat.itemId >= 0) {
        String result = null;
        Vector<Integer> v = new Vector<>();
        v.add(tempCat.itemId);
        try {
            result = (String) xrpc.execute("udo.getUDOList", v);
        } catch (XmlRpcException | IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if (result == null) {
            System.out.println("Null List");
            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();
        DefaultListModel<UDOItem> listItems = new DefaultListModel<>();
        Elements nodes = root.getElements();
        while (nodes.hasMoreElements()) {
            Element node = nodes.next();
            UDOItem item = new UDOItem();
            item.itemId = Integer.parseInt(node.getAttributeValue("udoId"));
            item.itemName = node.getAttributeValue("name");
            listItems.addElement(item);
        }
        udoList.setModel(listItems);
    }
}
Also used : Element(electric.xml.Element) DefaultListModel(javax.swing.DefaultListModel) IOException(java.io.IOException) Document(electric.xml.Document) Elements(electric.xml.Elements) ParseException(electric.xml.ParseException) Vector(java.util.Vector) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 17 with ParseException

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

the class CodeRepositoryMenu method reinitialize.

public static void reinitialize() {
    menu = new JMenu("Custom");
    try {
        TreeNode root = CodeRepositoryManager.getCodeRepositoryTreeNode(true);
        handleOpcodeDocCategory(menu, root);
    } catch (ParseException ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ParseException(electric.xml.ParseException) JMenu(javax.swing.JMenu)

Example 18 with ParseException

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

the class InstrumentImportPane method importInstrument.

private void importInstrument() {
    InstrumentOption iOption = iTableModel.getInstrumentOption(instrumentTable.getSelectedRow());
    if (iOption == null) {
        return;
    }
    try {
        Instrument instrument = BlueShareRemoteCaller.getInstrument(iOption);
        if (instrument == null) {
            String error = BlueSystem.getString("blueShare.importError");
            JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
            return;
        }
        // data.getOrchestra().addInstrument(instrument);
        // instrumentTreeModel.reload();
        InstrumentLibrary instrLib = BlueSystem.getUserInstrumentLibrary();
        instrLib.importInstrument(instrument);
        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 : InstrumentLibrary(blue.InstrumentLibrary) Instrument(blue.orchestra.Instrument) ParseException(electric.xml.ParseException) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 19 with ParseException

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

the class EffectsLibrary method getInstance.

public static EffectsLibrary getInstance() {
    if (library == null) {
        String effectLibFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "effectsLibrary.xml";
        File f = new File(effectLibFileName);
        if (f.exists()) {
            boolean error = false;
            try {
                Document doc = new Document(f);
                library = EffectsLibrary.loadFromXML(doc.getRoot());
            } catch (ParseException e1) {
                e1.printStackTrace();
                error = true;
            } catch (Exception e) {
                e.printStackTrace();
                error = true;
            }
            if (error) {
                JOptionPane.showMessageDialog(null, "There was an error loading " + f.getAbsolutePath() + "\nPlease fix this file or remove it and restart blue.", "Error", JOptionPane.ERROR_MESSAGE);
                System.exit(0);
            }
        }
        if (library == null) {
            library = new EffectsLibrary();
            System.out.println("Creating new Effects Library");
        }
    }
    return library;
}
Also used : ParseException(electric.xml.ParseException) Document(electric.xml.Document) File(java.io.File) IOException(java.io.IOException) ParseException(electric.xml.ParseException)

Example 20 with ParseException

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

the class AddToCodeRepositoryDialog method initTree.

public void initTree() {
    TreeNode rootNode;
    try {
        rootNode = CodeRepositoryManager.getCodeRepositoryTreeNode(false);
        categoryTree.setModel(new DefaultTreeModel(rootNode));
    } catch (ParseException e) {
        JOptionPane.showMessageDialog(this, "Error: There was an error trying to open or parse codeRepository.xml");
        e.printStackTrace();
    }
}
Also used : TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ParseException(electric.xml.ParseException)

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