Package net.sf.jabref.gui

Examples of net.sf.jabref.gui.FileListTableModel


            // Then check the "file" field:
            dir = panel.metaData().getFileDirectory(GUIGlobals.FILE_FIELD);
            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


     */
    public static NamedCompound upgradePdfPsToFile(BibtexDatabase database, String[] fields) {
        NamedCompound ce = new NamedCompound(Globals.lang("Move external links to 'file' field"));
       
        for (BibtexEntry entry : database.getEntryMap().values()){
            FileListTableModel tableModel = new FileListTableModel();
            // If there are already links in the file field, keep those on top:
            String oldFileContent = entry.getField(GUIGlobals.FILE_FIELD);
            if (oldFileContent != null) {
                tableModel.setContent(oldFileContent);
            }
            int oldRowCount = tableModel.getRowCount();
            for (int j = 0; j < fields.length; j++) {
                String o = entry.getField(fields[j]);
                if (o != null) {
                    String s = o;
                    if (s.trim().length() > 0) {
                        File f = new File(s);
                        FileListEntry flEntry = new FileListEntry(f.getName(), s,
                                Globals.prefs.getExternalFileTypeByExt(fields[j]));
                        tableModel.addEntry(tableModel.getRowCount(), flEntry);
                       
                        entry.clearField(fields[j]);
                        ce.addEdit(new UndoableFieldChange(entry, fields[j], o, null));
                    }
                }
            }
            if (tableModel.getRowCount() != oldRowCount) {
                String newValue = tableModel.getStringRepresentation();
                entry.setField(GUIGlobals.FILE_FIELD, newValue);
                ce.addEdit(new UndoableFieldChange(entry, GUIGlobals.FILE_FIELD, oldFileContent, newValue));
            }
        }
        ce.end();
View Full Code Here

public class FileLink implements ParamLayoutFormatter {

    String fileType = null;

    public String format(String field) {
        FileListTableModel tableModel = new FileListTableModel();
        if (field == null)
            return "";

        tableModel.setContent(field);
        String link = null;
        if (fileType == null) {
            // No file type specified. Simply take the first link.
            if (tableModel.getRowCount() > 0)
                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

                fileBibMap = new HashMap<String, Set<BibtexEntry>>();

    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);
View Full Code Here

TOP

Related Classes of net.sf.jabref.gui.FileListTableModel

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.