Package net.sf.jabref

Examples of net.sf.jabref.MetaData


          ArrayList<BibtexEntry> appendedEntries = new ArrayList<BibtexEntry>();
          ArrayList<BibtexEntry> originalEntries = new ArrayList<BibtexEntry>();
          BibtexDatabase database = panel.database();
          BibtexEntry originalEntry;
          NamedCompound ce = new NamedCompound(Globals.lang("Append database"));
          MetaData meta = new MetaData(pr.getMetaData(), pr.getDatabase());

          if (importEntries) { // Add entries
              boolean overwriteOwner = Globals.prefs.getBoolean("overwriteOwner");
              boolean overwriteTimeStamp = Globals.prefs.getBoolean("overwriteTimeStamp");

            for (String key : fromDatabase.getKeySet()){
                originalEntry = fromDatabase.getEntryById(key);
                  BibtexEntry be = (BibtexEntry) (originalEntry.clone());
                  be.setId(Util.createNeutralId());
                  Util.setAutomaticFields(be, overwriteOwner, overwriteTimeStamp);
                  database.insertEntry(be);
                  appendedEntries.add(be);
                  originalEntries.add(originalEntry);
                  ce.addEdit(new UndoableInsertEntry(database, be, panel));
              }
          }

          if (importStrings) {
              for (BibtexString bs : fromDatabase.getStringValues()){
                  if (!database.hasStringLabel(bs.getName())) {
                      database.addString(bs);
                      ce.addEdit(new UndoableInsertString(panel, database, bs));
                  }
              }
          }

          if (importGroups) {
              GroupTreeNode newGroups = meta.getGroups();
              if (newGroups != null) {

                  // ensure that there is always only one AllEntriesGroup
                  if (newGroups.getGroup() instanceof AllEntriesGroup) {
                      // create a dummy group
                      ExplicitGroup group = new ExplicitGroup("Imported",
                              AbstractGroup.INDEPENDENT); // JZTODO lyrics
                      newGroups.setGroup(group);
                      for (int i = 0; i < appendedEntries.size(); ++i)
                          group.addEntry(appendedEntries.get(i));
                  }

                  // groupsSelector is always created, even when no groups
                  // have been defined. therefore, no check for null is
                  // required here
                  frame.groupSelector.addGroups(newGroups, ce);
                  // for explicit groups, the entries copied to the mother fromDatabase have to
                  // be "reassigned", i.e. the old reference is removed and the reference
                  // to the new fromDatabase is added.
                  GroupTreeNode node;
                  ExplicitGroup group;
                  BibtexEntry entry;
                 
                  for (Enumeration<GroupTreeNode> e = newGroups
          .preorderEnumeration(); e.hasMoreElements();) {
          node = e.nextElement();
          if (!(node.getGroup() instanceof ExplicitGroup))
            continue;
          group = (ExplicitGroup) node.getGroup();
          for (int i = 0; i < originalEntries.size(); ++i) {
            entry = originalEntries.get(i);
            if (group.contains(entry)) {
              group.removeEntry(entry);
              group.addEntry(appendedEntries.get(i));
            }
          }
        }
                  frame.groupSelector.revalidateGroups();
              }
          }

          if (importSelectorWords) {
            for (String s : meta){
                  if (s.startsWith(Globals.SELECTOR_META_PREFIX)) {
                      panel.metaData().putData(s, meta.getData(s));
                  }
              }
          }

          ce.end();
View Full Code Here


     */
    public ImportInspectionDialog(JabRefFrame frame, BasePanel panel, String[] fields,
        String undoName, boolean newDatabase) {
        this.frame = frame;
        this.panel = panel;
        this.metaData = (panel != null) ? panel.metaData() : new MetaData();
        this.fields = fields;
        this.undoName = undoName;
        this.newDatabase = newDatabase;
        preview = new PreviewPanel(null, metaData, Globals.prefs.get("preview1"));

View Full Code Here

    private void init(String title) {
        diag = new JDialog(frame, title, false);

        int activePreview = Globals.prefs.getInt("activePreview");
        preview = new PreviewPanel(null, new MetaData(),
                activePreview == 0 ? Globals.prefs.get("preview0") : Globals.prefs.get("preview1"));

        sortedEntries = new SortedList<BibtexEntry>(entries, new EntryComparator(false, true, "author"));
        model = new EventTableModel<BibtexEntry>(sortedEntries,
                new EntryTableFormat());
View Full Code Here

                 }
             }
             statement.close();
         }

         MetaData metaData = new MetaData();
         metaData.initializeNewDatabase();

         // Read the groups tree:
         importGroupsTree(dbtype, metaData, entries, conn);

         return new Object[] {database, metaData};
View Full Code Here

        super.setActiveBasePanel(panel);
        if (panel == null) { // hide groups
            frame.sidePaneManager.hide("groups");
            return;
        }
        MetaData metaData = panel.metaData();
        if (metaData.getGroups() != null) {
            setGroups(metaData.getGroups());
        } else {
            GroupTreeNode newGroupsRoot = new GroupTreeNode(new AllEntriesGroup());
            metaData.setGroups(newGroupsRoot);
            setGroups(newGroupsRoot);
        }

        // auto show/hide groups interface
        if (Globals.prefs.getBoolean("groupAutoShow") &&
View Full Code Here

TOP

Related Classes of net.sf.jabref.MetaData

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.