Examples of FileListEntry


Examples of net.sf.jabref.gui.FileListEntry

            String field = entry.getField(GUIGlobals.FILE_FIELD);
            if (field != null) {
                FileListTableModel tm = new FileListTableModel();
                tm.setContent(field);
                for (int j=0; j<tm.getRowCount(); j++) {
                    FileListEntry flEntry = tm.getEntry(j);
                    if ((flEntry.getType()!=null) && (flEntry.getType().getName().toLowerCase().equals("pdf"))) {
                        f = Util.expandFilename(flEntry.getLink(), new String[]{dir,"."});
                        if (f != null)
                            files.add(f);
                    }
                }
            }
View Full Code Here

Examples of net.sf.jabref.gui.FileListEntry

                link = tableModel.getEntry(0).getLink();
        }
        else {
            // A file type is specified:
            for (int i=0; i< tableModel.getRowCount(); i++) {
                FileListEntry flEntry = tableModel.getEntry(i);
                if (flEntry.getType().getName().toLowerCase().equals(fileType)) {
                    link = flEntry.getLink();
                    break;
                }
            }
        }
       
View Full Code Here

Examples of net.sf.jabref.gui.FileListEntry

        if ((fDirectory != null) && fDirectory.trim().equals(""))
            fDirectory = null;
        final String directory = fDirectory;
        final String suggestDir = directory != null ? directory : System.getProperty("user.home");
        File file = new File(new File(suggestDir), suggestedName);
        FileListEntry entry = new FileListEntry("", bibtexKey != null ? file.getCanonicalPath() : "",
                suggestedType);
        editor = new FileListEntryEditor(frame, entry, true, false, metaData);
        editor.getProgressBar().setIndeterminate(true);
        editor.setOkEnabled(false);
        editor.setExternalConfirm(new ConfirmCloseFileListEntryEditor() {
            public boolean confirmClose(FileListEntry entry) {
                File f = directory != null ? expandFilename(directory, entry.getLink())
                        : new File(entry.getLink());
                if (f.isDirectory()) {
                    JOptionPane.showMessageDialog(frame,
                            Globals.lang("Target file cannot be a directory."), Globals.lang("Download file"),
                            JOptionPane.ERROR_MESSAGE);
                    return false;
                }
                if (f.exists()) {
                    return JOptionPane.showConfirmDialog
                        (frame, "'"+f.getName()+"' "+Globals.lang("exists. Overwrite file?"),
                        Globals.lang("Download file"), JOptionPane.OK_CANCEL_OPTION)
                            == JOptionPane.OK_OPTION;
                } else
                    return true;
            }
        });
        if (!dontShowDialog) // If an error occured with the URL, this flag may have been set
            editor.setVisible(true, false);
        else
            return;
        // Editor closed. Go on:
        if (editor.okPressed()) {
            File toFile = directory != null ? expandFilename(directory, entry.getLink())
                    : new File(entry.getLink());
            String dirPrefix;
            if (directory != null) {
                if (!directory.endsWith(System.getProperty("file.separator")))
                    dirPrefix = directory+System.getProperty("file.separator");
                else
                    dirPrefix = directory;
            } else
                dirPrefix = null;

            try {
                boolean success = Util.copyFile(tmp, toFile, true);
                if (!success) {
                    // OOps, the file exists!
                    System.out.println("File already exists! DownloadExternalFile.download()");
                }

                // If the local file is in or below the main file directory, change the
                // path to relative:
                if ((directory != null) && entry.getLink().startsWith(directory) &&
                        (entry.getLink().length() > dirPrefix.length())) {
                    entry.setLink(entry.getLink().substring(dirPrefix.length()));
                }

                callback.downloadComplete(entry);
            } catch (IOException ex) {
                ex.printStackTrace();
View Full Code Here

Examples of net.sf.jabref.gui.FileListEntry

    for (BibtexEntry entry : getDb().getEntries()) {
      String fField = entry.getField(GUIGlobals.FILE_FIELD);
      FileListTableModel fLTM = new FileListTableModel();
      fLTM.setContent(fField);
      for (int i = 0; i < fLTM.getRowCount(); i++) {
        FileListEntry flEntry = fLTM.getEntry(i);
        String link = flEntry.getLink();
//        String fileDir = getMd().getFileDirectory(GUIGlobals.FILE_FIELD);
//        File f = net.sf.jabref.Util.expandFilename(link, fileDir);
        if (fileBibMap.containsKey(link)) {
          Set<BibtexEntry> s = fileBibMap.get(link);
          s.add(entry);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.