Package org.fcrepo.client.export

Examples of org.fcrepo.client.export.ExportOptionsDialog


                    if (dlg.getFile() != null) {
                        File file =
                                new File(new File(dlg.getDirectory()), dlg
                                        .getFile());
                        Administrator.setLastDir(file.getParentFile()); // remember the dir for next time
                        ExportOptionsDialog optsDialog =
                                new ExportOptionsDialog("Select Options for Export");
                        if (optsDialog.getFormatSelection() != null) {
                            exporter.export(pid,
                                            optsDialog.getFormatSelection(),
                                            optsDialog.getContextSelection(),
                                            new FileOutputStream(file));
                            JOptionPane.showMessageDialog(Administrator
                                    .getDesktop(), "Exported " + pid);
                        }
                    }
                } catch (Exception e) {
                    Administrator.showErrorDialog(Administrator.getDesktop(),
                                                  "Export Failure",
                                                  e.getClass().getName() + ": "
                                                          + e.getMessage(),
                                                  e);
                }
            } else {
                // If there are multiple pids, select a directory first.
                try {
                    JFileChooser browse;
                    if (Administrator.getLastDir() == null) {
                        browse = new JFileChooser();
                    } else {
                        browse = new JFileChooser(Administrator.getLastDir());
                    }
                    browse.setApproveButtonText("Export");
                    browse.setApproveButtonMnemonic('E');
                    browse
                            .setApproveButtonToolTipText("Exports to the selected directory.");
                    browse.setDialogTitle("Export to...");
                    browse.setDialogTitle("Choose export directory...");
                    browse.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                    int returnVal =
                            browse.showOpenDialog(Administrator.getDesktop());
                    if (returnVal == JFileChooser.APPROVE_OPTION) {
                        Administrator.setLastDir(browse.getSelectedFile()); // remember the dir for next time
                        ExportOptionsDialog optsDialog =
                                new ExportOptionsDialog("Select Options for Export");
                        if (optsDialog.getFormatSelection() != null) {
                            while (pidIter.hasNext()) {
                                String pid = (String) pidIter.next();
                                StringBuffer buf = new StringBuffer();
                                for (int i = 0; i < pid.length(); i++) {
                                    char c = pid.charAt(i);
                                    if (c == ':') {
                                        buf.append('_');
                                    } else {
                                        buf.append(c);
                                    }
                                }
                                File outFile =
                                        new File(browse.getSelectedFile(), buf
                                                .toString()
                                                + ".xml");
                                exporter
                                        .export(pid,
                                                optsDialog.getFormatSelection(),
                                                optsDialog
                                                        .getContextSelection(),
                                                new FileOutputStream(outFile));
                            }
                            JOptionPane.showMessageDialog(Administrator
                                    .getDesktop(), "Exported " + m_pids.size()
View Full Code Here

TOP

Related Classes of org.fcrepo.client.export.ExportOptionsDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.