Package net.sf.jabref

Examples of net.sf.jabref.BibtexEntry


    int piv = 0;

    private void parse(ImportInspector dialog, String text, int startIndex, int firstEntryNumber) {
        piv = startIndex;
        int entryNumber = firstEntryNumber;
        BibtexEntry entry;
        while (((entry = parseNextEntry(text, piv, entryNumber)) != null)
            && (shouldContinue)) {
            if (entry.getField("title") != null) {
                dialog.addEntry(entry);
                dialog.setProgress(parsed + unparseable, hits);
                parsed++;
            }
            entryNumber++;
View Full Code Here


        URL bibtexUrl = new URL(startUrl + bibtexAddr.group(1));
        BufferedReader in = new BufferedReader(new InputStreamReader(bibtexUrl.openStream()));
        ParserResult result = BibtexParser.parse(in);
        in.close();
        Collection<BibtexEntry> item = result.getDatabase().getEntries();
        BibtexEntry entry = item.iterator().next();
        if (abs == true) {
          Matcher absMatch = absPattern.matcher(page);
          if (absMatch.find()) {
            String absBlock = absMatch.group(1);
            entry.setField("abstract", convertHTMLChars(absBlock).trim());
          } else {
            System.out.println("No abstract matched.");
            //System.out.println(page);
          }
        }
View Full Code Here

        int index = allText.indexOf(toFind, startIndex);
        int endIndex = allText.indexOf("</table>", index+1);
        //if (endIndex < 0)
            endIndex = allText.length();

        BibtexEntry entry = null;

        if (index >= 0) {
            piv = index+1;
            String text = allText.substring(index, endIndex);
            // Always try RIS import first
View Full Code Here

                        String booktitle = hm.get("booktitle");
                        hm.remove("booktitle");
                        hm.put("journal", booktitle);
                    }

                    BibtexEntry b =
                        new BibtexEntry(BibtexFields.DEFAULT_BIBTEXENTRY_ID,
                                        Globals.getEntryType(Type));

                    // create one here
                    b.setField(hm);

                    bibitems.add(b);
                }
                hm.clear()// ready for next record
                first = true;
View Full Code Here

    mainloop: while ((s = in.readLine()) != null){
        if (s.equals("")) continue;
        if (s.startsWith("-----------------------------")) break mainloop;
        String[] fields = s.split("\t");
        BibtexEntry be = new BibtexEntry(Util.createNeutralId());
        try{
        if (fields[0].equals("FLA")) be.setType(BibtexEntryType
                            .getType("article"));
        ImportFormatReader.setIfNecessary(be, "title", fields[2]);
        ImportFormatReader.setIfNecessary(be, "author", AuthorList.fixAuthor_lastNameFirst(fields[4].replaceAll("; ", " and ")));
        ImportFormatReader.setIfNecessary(be, "journal", fields[7]);
        ImportFormatReader.setIfNecessary(be, "volume", fields[9]);
View Full Code Here

            final int row = entryTable.rowAtPoint(e.getPoint());

            // A double click on an entry should highlight the entry in its BasePanel:
            if (e.getClickCount() == 2) {
                // Get the selected entry:
                BibtexEntry toShow = model.getElementAt(row);
                // Look up which BasePanel it belongs to:
                BasePanel p = entryHome.get(toShow);
                // Show the correct tab in the main window:
                frame.showBasePanel(p);
                // Highlight the entry:
View Full Code Here

            }
            //if (e.)
            final int col = entryTable.columnAtPoint(e.getPoint()),
                    row = entryTable.rowAtPoint(e.getPoint());
            if (col < PAD) {
                BibtexEntry entry = sortedEntries.get(row);
                BasePanel p = entryHome.get(entry);
                switch (col) {
                    case FILE_COL:
                        Object o = entry.getField(GUIGlobals.FILE_FIELD);
                        if (o != null) {
                            FileListTableModel tableModel = new FileListTableModel();
                            tableModel.setContent((String) o);
                            if (tableModel.getRowCount() == 0)
                                return;
                            FileListEntry fl = tableModel.getEntry(0);
                            (new ExternalFileMenuItem(frame, entry, "", fl.getLink(), null,
                                p.metaData(), fl.getType())).actionPerformed(null);
                        }
                        break;
                    case URL_COL:
                        Object link = entry.getField("url");
                        try {
                            if (link != null)
                                Util.openExternalViewer(p.metaData(), (String) link, "url");
                        } catch (IOException ex) {
                            ex.printStackTrace();
View Full Code Here

         * user is pointing at a file link icon. Otherwise a general context
         * menu should be shown.
         * @param e The triggering mouse event.
         */
        public void processPopupTrigger(MouseEvent e) {
            BibtexEntry entry = sortedEntries.get(entryTable.rowAtPoint(e.getPoint()));
            BasePanel p = entryHome.get(entry);
            int col = entryTable.columnAtPoint(e.getPoint());
            JPopupMenu menu = new JPopupMenu();
            int count = 0;

            if (col == FILE_COL) {
                // We use a FileListTableModel to parse the field content:
                Object o = entry.getField(GUIGlobals.FILE_FIELD);
                FileListTableModel fileList = new FileListTableModel();
                fileList.setContent((String)o);
                // If there are one or more links, open the first one:
                for (int i=0; i<fileList.getRowCount(); i++) {
                    FileListEntry flEntry = fileList.getEntry(i);
View Full Code Here

     */
    class EntrySelectionListener implements ListEventListener<BibtexEntry> {

            public void listChanged(ListEvent<BibtexEntry> listEvent) {
                if (listEvent.getSourceList().size() == 1) {
                    BibtexEntry entry = listEvent.getSourceList().get(0);
                    // Find out which BasePanel the selected entry belongs to:
                    BasePanel p = entryHome.get(entry);
                    // Update the preview's metadata reference:
                    preview.setMetaData(p.metaData());
                    // Update the preview's entry:
View Full Code Here

       try {
         BibtexDatabase dbase = parseBibtexDatabase(idSelected, includeAbstract);
         Collection<BibtexEntry> items = dbase.getEntries();
         Iterator<BibtexEntry> iter = items.iterator();
         while (iter.hasNext()) {
           BibtexEntry entry = iter.next();
           dialog.addEntry(cleanup(entry));
                  dialog.setProgress(parsed + unparseable, hits);
                  parsed++;
         }
       } catch (IOException e) {
         e.printStackTrace();
       }
      //for
        } else {
          BibtexEntry entry;
          while (((entry = parseNextEntry(text, piv)) != null) && shouldContinue) {
              if (entry.getField("title") != null) {
                  dialog.addEntry(entry);
                  dialog.setProgress(parsed + unparseable, hits);
                  parsed++;
              }
              entryNumber++;
View Full Code Here

TOP

Related Classes of net.sf.jabref.BibtexEntry

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.